修复报错
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <opencv2/tracking/tracking.hpp>
|
#include <opencv2/tracking/tracking.hpp>
|
||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
#include <armor_finder/classifier/solver.h>
|
#include <armor_finder/classifier/solver.h>
|
||||||
|
#include <armor_finder/classifier/classifier.h>
|
||||||
#include <additions.h>
|
#include <additions.h>
|
||||||
|
|
||||||
#define BLOB_RED ENEMY_RED
|
#define BLOB_RED ENEMY_RED
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ end:
|
|||||||
|
|
||||||
target_xyz = cv::Point3f(armor.xyz_in_gimbal.x() * 100.0, armor.xyz_in_gimbal.y() * 100.0, armor.xyz_in_gimbal.z() * 100.0); // 转换为cm
|
target_xyz = cv::Point3f(armor.xyz_in_gimbal.x() * 100.0, armor.xyz_in_gimbal.y() * 100.0, armor.xyz_in_gimbal.z() * 100.0); // 转换为cm
|
||||||
cv::Point3f current_pos = target_xyz;
|
cv::Point3f current_pos = target_xyz;
|
||||||
double current_time = static_cast<double>(frame_time.tv_sec) + static_cast<double>(frame_time.tv_usec) / 1e6;
|
double current_time = frame_time / 1000.0;
|
||||||
history.push_back({current_pos, current_time});
|
history.push_back({current_pos, current_time});
|
||||||
if (history.size() > 10) { // 仅保留最近10帧
|
if (history.size() > 10) { // 仅保留最近10帧
|
||||||
history.erase(history.begin());
|
history.erase(history.begin());
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Solver::Solver(const std::string & config_path) : R_gimbal2world_(Eigen::Matrix3
|
|||||||
auto R_camera2gimbal_data = yaml["R_camera2gimbal"].as<std::vector<double>>();
|
auto R_camera2gimbal_data = yaml["R_camera2gimbal"].as<std::vector<double>>();
|
||||||
auto t_camera2gimbal_data = yaml["t_camera2gimbal"].as<std::vector<double>>();
|
auto t_camera2gimbal_data = yaml["t_camera2gimbal"].as<std::vector<double>>();
|
||||||
R_gimbal2imubody_ = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>(R_gimbal2imubody_data.data());
|
R_gimbal2imubody_ = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>(R_gimbal2imubody_data.data());
|
||||||
R_camera2gimbal_ = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>(R_camera2gimbal_data.data());
|
R_camera2gimbal_ = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>(R_camera2gimbal_data.data());
|
||||||
t_camera2gimbal_ = Eigen::Matrix<double, 3, 1>(t_camera2gimbal_data.data());
|
t_camera2gimbal_ = Eigen::Matrix<double, 3, 1>(t_camera2gimbal_data.data());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ bool ArmorFinder::sendBoxPosition(uint16_t shoot_delay) {
|
|||||||
double y_target = -target_xyz.y / 100.0; // 垂直高度差
|
double y_target = -target_xyz.y / 100.0; // 垂直高度差
|
||||||
double pitch_comp = BallisticSolver::get_pitch(x_target, y_target, MUZZLE_VELOCITY, BALLISTIC_K);
|
double pitch_comp = BallisticSolver::get_pitch(x_target, y_target, MUZZLE_VELOCITY, BALLISTIC_K);
|
||||||
|
|
||||||
// 计算是否满足开火条件 (例如残差小于 1.5 度)
|
// 计算是否满足开火条件
|
||||||
can_fire = AutoTrigger::should_fire(yaw, pitch_comp, 1.5);
|
can_fire = AutoTrigger::should_fire(*this, MUZZLE_VELOCITY, yaw, pitch_comp);
|
||||||
|
|
||||||
return sendTarget(serial, yaw, pitch_comp, dist * 100.0, shoot_delay);
|
return sendTarget(serial, yaw, pitch_comp, dist * 100.0, shoot_delay);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
#pragma once
|
#ifndef TOOLS__LOGGER_HPP
|
||||||
// Minimal logger stub — no external logging library required.
|
#define TOOLS__LOGGER_HPP
|
||||||
// Replace with a real logger (e.g. spdlog) if needed.
|
|
||||||
#include <iostream>
|
#include <spdlog/spdlog.h>
|
||||||
#define LOG_INFO(...) (void)0
|
|
||||||
#define LOG_WARN(...) (void)0
|
namespace tools
|
||||||
#define LOG_ERROR(...) (void)0
|
{
|
||||||
#define LOG_DEBUG(...) (void)0
|
std::shared_ptr<spdlog::logger> logger();
|
||||||
|
|
||||||
|
} // namespace tools
|
||||||
|
|
||||||
|
#endif // TOOLS__LOGGER_HPP
|
||||||
Reference in New Issue
Block a user