修复报错

This commit is contained in:
2026-03-21 15:03:10 +08:00
parent 56985997ae
commit ae0c8d2fd8
5 changed files with 17 additions and 12 deletions

View File

@@ -12,6 +12,7 @@
#include <opencv2/tracking/tracking.hpp>
#include <serial.h>
#include <armor_finder/classifier/solver.h>
#include <armor_finder/classifier/classifier.h>
#include <additions.h>
#define BLOB_RED ENEMY_RED

View File

@@ -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
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});
if (history.size() > 10) { // 仅保留最近10帧
history.erase(history.begin());

View File

@@ -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 t_camera2gimbal_data = yaml["t_camera2gimbal"].as<std::vector<double>>();
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());
*/

View File

@@ -80,8 +80,8 @@ bool ArmorFinder::sendBoxPosition(uint16_t shoot_delay) {
double y_target = -target_xyz.y / 100.0; // 垂直高度差
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);
}

View File

@@ -1,8 +1,12 @@
#pragma once
// Minimal logger stub — no external logging library required.
// Replace with a real logger (e.g. spdlog) if needed.
#include <iostream>
#define LOG_INFO(...) (void)0
#define LOG_WARN(...) (void)0
#define LOG_ERROR(...) (void)0
#define LOG_DEBUG(...) (void)0
#ifndef TOOLS__LOGGER_HPP
#define TOOLS__LOGGER_HPP
#include <spdlog/spdlog.h>
namespace tools
{
std::shared_ptr<spdlog::logger> logger();
} // namespace tools
#endif // TOOLS__LOGGER_HPP