Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
40fafa1
refactor(utils): rename transform.hpp to coordinate.hpp
heyeuu Sep 1, 2025
83751c5
feat(classifier): add classifier
heyeuu Sep 2, 2025
477a35f
fix(classifier): resolve issues in classifier class implementation
heyeuu Sep 2, 2025
cd95986
添加注释
fans963 Sep 2, 2025
879682b
feat(logging): add logger module
heyeuu Sep 2, 2025
0e7e505
fix(build): correct CMakeLists.txt include directory configuration
heyeuu Sep 3, 2025
78f16f9
feat(logging): add logger module
heyeuu Sep 3, 2025
7e477e6
feat(debug): add stringifier utility for ID string conversion
heyeuu Sep 3, 2025
1586caf
feat(identifier): add identifier module for armor identification
heyeuu Sep 3, 2025
541f531
fix(utils): correct incomplete namespace in stringifier module
heyeuu Sep 3, 2025
4304b8c
refactor(solver): rewrite interface implementation and add index-to-i…
heyeuu Sep 4, 2025
43109dc
add comment
fans963 Sep 4, 2025
cbff1ad
Merge remote-tracking branch 'upstream/main' into tongji-dev
heyeuu Sep 4, 2025
ac59b59
Merge remote-tracking branch 'upstream/with_comment' into tongji-dev
heyeuu Sep 4, 2025
8b24d98
fix(identifier):enhance identifier debug output and change target col…
heyeuu Sep 4, 2025
2bc4e9d
fix(identifier):enhance identifier debug output
heyeuu Sep 5, 2025
99a4bc7
fix(identifier):add internal recording flag
heyeuu Sep 5, 2025
53fd55a
添加了接口的注释
AlrayQiu Sep 7, 2025
570d100
修复错误的函数签名
AlrayQiu Sep 12, 2025
7fe53df
feat: add state machine
heyeuu Sep 14, 2025
244d7c5
feat: Add predictor module
heyeuu Sep 15, 2025
af9017c
feat(env): Add libfmt-dev and libspdlog-dev dependencies
heyeuu Sep 15, 2025
399aa78
Merge branch 'main' into tongji-dev
AlrayQiu Sep 15, 2025
d024183
refactor(interface): Rename the file of armors and change the armor i…
heyeuu Sep 17, 2025
deef680
WIP: partially implement ITargetPredictor interface
heyeuu Sep 17, 2025
00fdd5e
WIP: partially implement ITargetPredictor interface
heyeuu Sep 18, 2025
9596d7a
WIP: partially implement ITargetPredictor interface
heyeuu Sep 18, 2025
dc596de
refactor(prediction): refactor IPredictor and ITargetPredictor implem…
heyeuu Sep 20, 2025
0dcffbf
refactor(predictor): overhaul predictor implementation
heyeuu Sep 22, 2025
eeb09ae
Merge branch 'main' into tongji-dev
AlrayQiu Sep 22, 2025
b873347
feat: add state machine
heyeuu Sep 14, 2025
e746464
merge: fix conflicts from git merge
heyeuu Sep 23, 2025
2d7eb52
fix(targeting): correct armor target acquisition logic
heyeuu Sep 25, 2025
30235d2
refactor(predict, utils): move Extended Kalman Filter from utils to p…
heyeuu Sep 26, 2025
1538095
feat: add trajectory
heyeuu Sep 28, 2025
442f366
[Add] 添加火控实现的头文件
AlrayQiu Oct 1, 2025
da83d40
Merge remote-tracking branch 'origin/main' into tongji-dev
heyeuu Oct 1, 2025
337fc34
Merge remote-tracking branch 'origin/tongji-dev' into tongji-dev
heyeuu Oct 1, 2025
ba1f6fb
[Add] 添加Tracker实现
AlrayQiu Oct 2, 2025
e38116e
Merge branch 'tongji-dev' of github.com:Alliance-Algorithm/alliance_a…
heyeuu Oct 2, 2025
3e0fe3d
fix(tracker): fix data structure in tracker.hpp
heyeuu Oct 2, 2025
64e372a
fix(tracker): fix data structure in tracker.hpp
heyeuu Oct 2, 2025
44a79ff
feat(fire_controller): add aim point selection and trajectory classes
heyeuu Oct 3, 2025
2dc6cd8
feat(fire_control): add fire command validation class fire_judge
heyeuu Oct 3, 2025
c44607a
refactor(control): rename classes and refine fire logic
heyeuu Oct 4, 2025
3aa3c9d
feat(fire_control): implement basic module interfaces
heyeuu Oct 4, 2025
890a40a
fix(tracking): improve live_target convergence logic
heyeuu Oct 6, 2025
e599cb4
feat: complete core logic across multiple modules
heyeuu Oct 6, 2025
b11971e
chore(state_machine):refactor StateMachine to PIMPL pattern and do so…
heyeuu Oct 7, 2025
faaa5b1
feat(tracking): complete LiveTargetManager update logic
heyeuu Oct 7, 2025
08b7ebd
feat(fire_control):enhance CalculateTarget logic and add miss public …
heyeuu Oct 8, 2025
7e3b743
refactor(state_machine): complete state machine update logic
heyeuu Oct 8, 2025
010b466
perf(filter): make Kalman filter type inference compile-time
heyeuu Oct 8, 2025
ab6f47a
feat(decider): implement priority assessment logic
heyeuu Oct 9, 2025
344ee50
chore(state): remove redundant logic from state machine
heyeuu Oct 9, 2025
6b29508
chore: remove miscellaneous trivial cruft
heyeuu Oct 9, 2025
919cae3
chore(fire controller): remove redundant timestamp setter function
heyeuu Oct 10, 2025
5111275
refactor: complete initial architectural restructuring
heyeuu Oct 13, 2025
7b15810
refactor(project): reorganize directory structure to match new archit…
heyeuu Oct 13, 2025
9ccbf65
refactor(namespace): update namespaces to align with new architecture
heyeuu Oct 13, 2025
3bfab35
fix(initialization): repair incomplete constructor implementations
heyeuu Oct 13, 2025
50f1976
refactor(filter): rewrite Kalman filter with template implementation
heyeuu Oct 21, 2025
c760351
merge: sync with latest main branch updates
heyeuu Oct 21, 2025
94e19fc
fix(pimpl): correct PIMPL implementation issues
heyeuu Oct 23, 2025
3e50b68
fix(pimpl): correct modern C++ PIMPL implementation
heyeuu Oct 23, 2025
499be08
Merge remote-tracking branch 'origin/main' into tongji-dev
heyeuu Oct 23, 2025
3d6ce85
refactor(config): load identifier parameters from YAML configuration
heyeuu Oct 23, 2025
b95cf4c
refactor(config):Convert fire_controller and predictor constructor to…
heyeuu Oct 23, 2025
5793805
refactor(api): return timestamp by value instead of reference
heyeuu Oct 25, 2025
892f37c
refactor(coordinates): define explicit coordinate systems and update …
heyeuu Oct 26, 2025
adea28e
refactor(solver): extract common logic for better code reuse
heyeuu Oct 27, 2025
e982df8
fix(pimpl): correct PIMPL implementation errors
heyeuu Oct 27, 2025
2b7f997
fix: resolve solver redundancies and predictor timestamp issues
heyeuu Oct 28, 2025
e027f88
Merge remote-tracking branch 'origin/main' into tongji-dev
heyeuu Oct 28, 2025
1798e33
WIP: initial implementation of auto_aim_system with design questions
heyeuu Oct 28, 2025
10e685a
[V1] identifier设置图片时间戳
AlrayQiu Oct 28, 2025
8aead8f
[Tongji] PnpSolver 修正输出的时间戳
AlrayQiu Oct 28, 2025
797750d
[Tongji] TargetManager 修复卡尔曼滤波器更新所传入时间的错误
AlrayQiu Oct 28, 2025
86c7c61
[Tongji] 把内部的指针转换变为传入参数的约束,维持状态机原始实现
AlrayQiu Oct 28, 2025
83167b6
[Tongji] Firecontrol 修复时间
AlrayQiu Oct 28, 2025
ea3ee96
[Tongji] 修复Solve的时序错误
AlrayQiu Oct 28, 2025
e383c64
[Framework]: 将内容单一重复的接口提取为DTO
AlrayQiu Oct 28, 2025
af9f8af
[V1] 补充火控的预测器设置
AlrayQiu Oct 31, 2025
a9d79d5
fix(fire_control): correct logical issues in fire controller
heyeuu Oct 31, 2025
c408908
Merge branch 'tongji-dev' of github.com:Alliance-Algorithm/alliance_a…
heyeuu Oct 31, 2025
b0705c5
chore(config): clean up redundant parameters and fix timestamp config…
heyeuu Oct 31, 2025
3b880b5
chore(predictor): remove redundant Snapshot classes and related code
heyeuu Oct 31, 2025
1f3bb95
[CI] 添加子仓库recursive update
AlrayQiu Nov 1, 2025
a3f8679
test(coordinate): verify coordinate transformation utilities
heyeuu Nov 1, 2025
18f04b4
Merge branch 'tongji-dev' of github.com:Alliance-Algorithm/alliance_a…
heyeuu Nov 1, 2025
0477bbf
test(math): verify mathematical utilities functionality
heyeuu Nov 1, 2025
6382a71
feat(architecture): separate tongji-dev logic from v1 and complete co…
heyeuu Nov 1, 2025
c26fbac
refactor(architecture): extract shared utilities from t v1 mo
heyeuu Nov 1, 2025
372885d
feat(planning): add tiny_mpc library for trajectory planning
heyeuu Nov 2, 2025
7324448
Merge branch 'tongji-dev' of github.com:Alliance-Algorithm/alliance_a…
heyeuu Nov 2, 2025
276ac5e
feat(planning): implement trajectory planner module
heyeuu Nov 3, 2025
f1609a8
Revert "feat(planning): implement trajectory planner module"
heyeuu Nov 6, 2025
73ac173
Revert "feat(planning): add tiny_mpc library for trajectory planning"
heyeuu Nov 6, 2025
d4629a8
Revert "refactor(architecture): extract shared utilities from t v1 mo"
heyeuu Nov 6, 2025
69ec5b8
Revert "test(math): verify mathematical utilities functionality"
heyeuu Nov 6, 2025
2cb0713
revert: restore to version before directory restructuring
heyeuu Nov 6, 2025
3bec246
Merge remote-tracking branch 'origin' into tongji-dev
heyeuu Nov 6, 2025
89fe0f1
Merge remote-tracking branch 'origin/main' into tongji-dev
heyeuu Nov 6, 2025
85dd33b
fix(merge): resolve conflicts after revert operation
heyeuu Nov 6, 2025
08eef45
test: synchronize test-related modifications
heyeuu Nov 6, 2025
1c69040
test:add gimbal mock test
heyeuu Nov 6, 2025
fa2f06d
test:add gimbal mock test
heyeuu Nov 6, 2025
2c3751d
test:add gimbal mock test
heyeuu Nov 7, 2025
45d44ed
Merge branch 'main' into tongji-dev
AlrayQiu Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/tongji/auto_aim_system.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#include "auto_aim_system.hpp"

#include <chrono>

#include <cstdio>
#include <exception>
#include <iostream>
#include <memory>
#include <opencv2/core/mat.hpp>
#include <opencv2/highgui.hpp>
#include <print>
#include <tuple>

#include "../v1/sync/syncer.hpp"
#include "core/event_bus.hpp"
#include "data/mat_stamped.hpp"
#include "data/predictor_update_package.hpp"
#include "data/sync_data.hpp"
#include "data/time_stamped.hpp"
#include "enum/car_id.hpp"
#include "parameters/params_system_v1.hpp"
#include "parameters/profile.hpp"
#include "parameters/rm_parameters.hpp"
Expand All @@ -23,7 +25,6 @@
#include "tongji/solver/solver.hpp"
#include "tongji/state_machine/state_machine.hpp"
#include "utils/fps_counter.hpp"
#include "utils/visualization.hpp"
#include "v1/identifier/identifier.hpp"

namespace world_exe::tongji {
Expand Down Expand Up @@ -73,8 +74,6 @@ class AutoAimSystem::Impl {
// if (fps_.count()) std::cout << fps_.fps() << std::endl;
// return;

// std::cout << "here" << std::endl;

if (flag == enumeration::ArmorIdFlag::None) return;
// std::cout << "here" << std::endl;
state_machine_->Update(armors_in_image,
Expand Down Expand Up @@ -167,6 +166,7 @@ class AutoAimSystem::Impl {
std::shared_ptr<predictor::CarPredictorManager> live_target_manager_;
std::unique_ptr<world_exe::v1::Syncer> syncer_;
std::unique_ptr<fire_control::FireController> fire_controller_;
// std::unique_ptr<tests::mock::Camera2GimbalTransformer> mock_camera_tranform_;
};

AutoAimSystem::AutoAimSystem(const bool& debug)
Expand Down
4 changes: 2 additions & 2 deletions src/tongji/predictor/kalman_filter/extended_kalman_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ template <typename EKFModel> class ExtendedKalmanFilter {

// Stable Compution of the Posterior Covariance
// https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/07-Kalman-Filter-Math.ipynb
// FIXME: P -> P^-
P << (I - K * H) * P_prior;
// FIXME: P -> P^-
// P << (I - K * H) * P_prior * (I - K * H).transpose() + K * R * K.transpose();
P << (I - K * H) * P_prior;
const auto P_inverse = P_prior.inverse();
const auto error = x - x_prior;

Expand Down
8 changes: 8 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ add_executable(test_main test_main.cpp)

add_executable(runable runable_main.cpp)

add_executable(gimbal_mock mock_gimbal_test.cpp)


# 确保测试使用 C++20
target_compile_features(test_main PRIVATE cxx_std_20)
target_compile_features(runable PRIVATE cxx_std_20)
Expand All @@ -30,10 +33,15 @@ target_link_libraries(test_main
GTest::gmock_main
alliance_auto_aim
)

target_link_libraries(runable
alliance_auto_aim
)

target_link_libraries(gimbal_mock
alliance_auto_aim
)


include(GoogleTest)
gtest_discover_tests(test_main)
57 changes: 57 additions & 0 deletions tests/mock_gimbal_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

#include "mocks/MockArmorInCamera.hpp"
#include "mocks/MockArmorInWorld.hpp"
#include "mocks/mock_camera_tranform.hpp"
#include <Eigen/src/Core/Matrix.h>
#include <Eigen/src/Geometry/AngleAxis.h>

#include <Eigen/src/Geometry/Quaternion.h>
#include <memory>
#include <opencv2/highgui.hpp>

#include <utils/visualization.hpp>

#include <parameters/profile.hpp>
#include <parameters/rm_parameters.hpp>

int main() {
using namespace world_exe::util::visualization;

Eigen::Vector3d V_input(1., 0., 0.);
double Omega_Yaw = 0.1;
double Omega_Pitch = 0.05;
double Max_Pitch = M_PI / 48.0;
auto transformer = world_exe::tests::mock::Camera2GimbalTransformer(
V_input, Omega_Yaw, Omega_Pitch, Max_Pitch);

double dt = 0.01;

cv::Mat image = cv::Mat { 1080, 1440, CV_8UC3, { 255, 255, 255 } };
auto tmp = image.clone();

auto armor_in_camera = std::make_shared<world_exe::tests::mock::MockArmorInCamera>(0, 0);
auto armor_in_gimbal = std::make_shared<world_exe::tests::mock::MockArmorInWorld>(0, 0);

auto armors_in_camera_3 = armor_in_camera->GetArmors(armor_in_camera->armorid);
auto armors_in_gimbal_3 = armor_in_gimbal->GetArmors(armor_in_gimbal->armorid);

auto num = armors_in_camera_3.size();
while (true) {
image.copyTo(tmp);

draw_armor_in_camera(*armor_in_camera,
world_exe::parameters::HikCameraProfile::get_intrinsic_parameters(),
world_exe::parameters::HikCameraProfile::get_distortion_parameters(),
world_exe::parameters::Robomaster::NormalArmorObjectPointsRos, tmp);

auto transform = transformer.updateAndGetTransform(dt);

draw_armor_in_gimbal(*armor_in_gimbal,
world_exe::parameters::HikCameraProfile::get_intrinsic_parameters(),
world_exe::parameters::HikCameraProfile::get_distortion_parameters(),
world_exe::parameters::Robomaster::NormalArmorObjectPointsRos, transform.inverse(),
tmp);
cv::imshow("imshow", tmp);
cv::waitKey(1);
}
}
96 changes: 96 additions & 0 deletions tests/mocks/mock_camera_tranform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#include <Eigen/Dense>

#include <cmath>
#include <cstdlib>

using namespace Eigen;
using AffineTransform = Affine3d; // 仿射变换矩阵 (4x4)
using Vector3D = Vector3d;
using QuaternionType = Quaterniond;

namespace world_exe::tests::mock {

class Camera2GimbalTransformer {
private:
// --- 状态变量 ---
// 当前的仿射变换 (包含位置和姿态)
AffineTransform T_current;

// 当前时间
double current_time;

// --- 输入参数 ---
// 1. 水平平移速度 (在世界坐标系下)
const Vector3D V_horizontal;
// 2. 绕竖直轴 (Z轴) 的角速度 (在世界坐标系下)
const double Omega_Yaw;
// 3. 绕 Pitch 轴的角速度 (在世界坐标系下)
double Omega_Pitch;
// 4. 最大 Pitch 角度 (用于约束)
const double Max_Pitch_Angle;

// 用于追踪当前 Pitch 角度,以实现角度约束 (假设Pitch轴是Y轴)
double current_pitch_angle;

public:
/**
* @brief 构造函数
* @param v_horiz 水平速度向量 (例如: 1.0, 0.0, 0.0)
* @param omega_yaw 绕 Z 轴角速度 (rad/s)
* @param omega_pitch 绕 Pitch 轴角速度 (rad/s)
* @param max_pitch_angle 绕 Pitch 轴的最大角度限制 (rad)
*/
Camera2GimbalTransformer(
const Vector3D& v_horiz, double omega_yaw, double omega_pitch, double max_pitch_angle)
: V_horizontal(v_horiz)
, Omega_Yaw(omega_yaw)
, Omega_Pitch(omega_pitch)
, Max_Pitch_Angle(std::abs(max_pitch_angle))
, // 确保最大角度是正值
T_current(AffineTransform::Identity())
, current_time(0.0)
, current_pitch_angle(0.0) { }

/**
* @brief 按照给定的时间步长进行一次状态积分,并返回更新后的 Affine 变换
* @param dt 时间步长 (秒)
* @return 更新后的 Affine 变换矩阵
*/
AffineTransform updateAndGetTransform(double dt) {
Vector3D delta_t = V_horizontal * dt;

double delta_yaw = Omega_Yaw * dt;
AngleAxisd R_yaw(delta_yaw, Vector3D::UnitZ());

double delta_pitch = Omega_Pitch * dt;
double next_pitch_angle = current_pitch_angle + delta_pitch;
if (next_pitch_angle > Max_Pitch_Angle || next_pitch_angle < -Max_Pitch_Angle) {

Omega_Pitch = -Omega_Pitch;
delta_pitch = Omega_Pitch * dt;
}

current_pitch_angle = current_pitch_angle + delta_pitch;

AngleAxisd R_pitch(delta_pitch, Vector3D::UnitY());

// 2c. 组合旋转增量:R_total = R_yaw * R_pitch
// 假设 Pitch 和 Yaw 是在世界坐标系下连续作用的 (即增量也是在世界坐标系下)
// 结果是一个 AngleAxisd 或 Quaternion,需要转换为 Affine
AffineTransform T_rot_increment = AffineTransform(R_yaw * R_pitch);

// --- 3. 组合总增量 T_delta ---

// T_delta = T_平移 * T_旋转
AffineTransform T_delta = Translation3d(delta_t) * T_rot_increment;

// --- 4. 状态更新 ---

// T_new = T_delta * T_old (因为 T_delta 是相对于世界坐标系W的增量)
T_current = T_delta * T_current;
current_time += dt;

return T_current;
}
};
}