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
112 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
09e5ef5
Merge branch 'main' of github.com:Alliance-Algorithm/alliance_auto_ai…
heyeuu Nov 8, 2025
eedf28b
Merge branch 'tongji-dev' of github.com:Alliance-Algorithm/alliance_a…
heyeuu Nov 8, 2025
e486350
fix(state_machine): correct armor filter implementation
heyeuu Nov 8, 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
18 changes: 8 additions & 10 deletions src/tongji/auto_aim_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include "enum/car_id.hpp"
#include "parameters/params_system_v1.hpp"
#include "parameters/profile.hpp"
#include "parameters/rm_parameters.hpp"
#include "tongji/fire_controller/fire_controller.hpp"
#include "tongji/identifier/identifier.hpp"
#include "tongji/predictor/car_predictor/car_predictor_manager.hpp"
#include "tongji/solver/solver.hpp"
#include "tongji/state_machine/state_machine.hpp"
Expand Down Expand Up @@ -68,15 +66,16 @@ class AutoAimSystem::Impl {
// util::visualization::draw_armor_in_image(*armors_in_image, visualized);
// cv::imshow("identified", visualized);
// cv::waitKey(1);
// } else {
// std::printf("No identified armors/n");
// }
// if (fps_.count()) std::cout << fps_.fps() << std::endl;
// return;

if (flag == enumeration::ArmorIdFlag::None) return;
// std::cout << "here" << std::endl;
state_machine_->Update(armors_in_image,
if (flag == enumeration::ArmorIdFlag::None) {
state_machine_->SetLostState();
return;
}

// TODO:update invincible_armors
state_machine_->Update(armors_in_image, enumeration::CarIDFlag::None,
std::chrono::duration_cast<milliseconds>(
std::chrono::steady_clock::now() - time_stamp_));

Expand All @@ -99,8 +98,6 @@ class AutoAimSystem::Impl {
parameters::ParamsForSystemV1::tracker_current_armors_event,
live_target_manager_->Predict(flag, pack.camera_capture_begin_time_stamp));

state_machine_ = std::make_shared<state_machine::StateMachine>();

const auto target_id = state_machine_->GetAllowdToFires();

const auto gimbal_yaw = R_camera2gimbal.eulerAngles(2, 1, 0)[0];
Expand All @@ -111,6 +108,7 @@ class AutoAimSystem::Impl {

core::EventBus::Publish<data::FireControl>(
parameters::ParamsForSystemV1::fire_control_event, GetControlCommand());
time_stamp_ = std::chrono::steady_clock::now();

if (!debug) [[likely]]
return;
Expand Down
22 changes: 8 additions & 14 deletions src/tongji/identifier/armor_filter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <ranges>
#include <unordered_set>
#include <utility>
#include <vector>
Expand All @@ -15,25 +16,18 @@ class ArmorFilter {
public:
explicit ArmorFilter()
: invincible_armor_({ }) { }
std::vector<data::ArmorImageSpacing> FilterArmor(
std::vector<data::ArmorImageSpacing> armors) const {

armors.erase(std::remove_if(armors.begin(), armors.end(), [&](const auto& armor) {
auto FilterArmor(std::vector<data::ArmorImageSpacing> const& armors) const {
// 25赛季没有5号装甲板
// 不打前哨站
// 过滤掉刚复活无敌的装甲板
auto filtered = armors | std::views::filter([&](const auto& armor) {
return armor.id != enumeration::ArmorIdFlag::InfantryV
&& armor.id != enumeration::ArmorIdFlag::Outpost
&& !invincible_armor_.count(armor.id);
});

return armor.id == enumeration::ArmorIdFlag::InfantryV
|| armor.id == enumeration::ArmorIdFlag::Outpost
|| invincible_armor_.count(armor.id);
}));
// armors.erase(std::remove_if(armors.begin(), armors.end(),
// [](const auto& armor) { return armor.id == enumeration::ArmorIdFlag::Outpost; }));
// // 过滤掉刚复活无敌的装甲板
// armors.erase(std::remove_if(armors.begin(), armors.end(),
// [&](const auto& armor) { return invincible_armor_.count(armor.id); }));

return armors;
return std::vector<data::ArmorImageSpacing>(filtered.begin(), filtered.end());
}

void Update(enumeration::CarIDFlag ids) {
Expand Down
46 changes: 26 additions & 20 deletions src/tongji/identifier/tracker.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <ctime>
#include <iostream>

#include <memory>
#include <opencv2/core/types.hpp>
#include <vector>
Expand Down Expand Up @@ -32,38 +32,41 @@ class Tracker final {
~Tracker() = default;

auto SelectTrackingTargetID(const std::shared_ptr<interfaces::IArmorInImage>& armors_in_image,
const enumeration::CarIDFlag& invincible_armors,
const std::chrono::milliseconds& duration_from_last_update) noexcept
-> enumeration::ArmorIdFlag const {

CheckCameraOffline(duration_from_last_update);
armor_filter_->Update(invincible_armors);

auto filtered_ids = enumeration::ArmorIdFlag::None;

std::vector<data::ArmorImageSpacing> filtered_armors;
std::vector<data::ArmorImageSpacing> filtered_armors { };
for (uint32_t i = 0; i < static_cast<int>(enumeration::ArmorIdFlag::Count); ++i) {
auto id = static_cast<enumeration::ArmorIdFlag>(
static_cast<uint32_t>(enumeration::ArmorIdFlag::Hero) << i);

if (armors_in_image->GetArmors(id).empty()) continue;
if (auto armors = armors_in_image->GetArmors(id); !armors.empty()) {
// 对从图像识别到的装甲板进行过滤
filtered_armors = armor_filter_->FilterArmor(armors);

if (filtered_armors.empty()) continue;

// 图像中出现的装甲板
auto armors = armors_in_image->GetArmors(id);
// 对从图像识别到的装甲板进行过滤
filtered_armors = armor_filter_->FilterArmor(armors);
if (!filtered_armors.empty()) {
filtered_ids =
static_cast<enumeration::ArmorIdFlag>(static_cast<uint32_t>(filtered_ids)
| static_cast<uint32_t>(filtered_armors[0].id));
}
}

// UpdateState(!(filtered_ids == enumeration::ArmorIdFlag::None));
UpdateState(filtered_ids != enumeration::ArmorIdFlag::None);

if (state_ == TrackState::Tracking)
tracking_car_id_ = decider_->GetBestArmor(filtered_armors);

tracking_car_id_ = decider_->GetBestArmor(filtered_armors);
return tracking_car_id_;
}

TrackState GetState() const { return state_; }
void SetLostState() { state_ = TrackState::Lost; }

private:
void UpdateState(bool found) {
Expand Down Expand Up @@ -129,8 +132,11 @@ class Tracker final {
}

void CheckCameraOffline(const std::chrono::milliseconds duration_from_last_update) {
if (state_ != TrackState::Lost && (duration_from_last_update > timeout_sec_))
// if (state_ != TrackState::Lost && (duration_from_last_update > timeout_sec_);
if ((duration_from_last_update > timeout_)) {
SetState(TrackState::Lost);
// std::cout << "I am lost QAQ" << std::endl;
}
}

void SetState(TrackState new_state) {
Expand All @@ -147,14 +153,14 @@ class Tracker final {
std::unique_ptr<identifier::ArmorFilter> armor_filter_;
std::unique_ptr<Decider> decider_;

int detect_count_ = 0;
int temp_lost_count_ = 0;
int max_temp_lost_count_ = 15;
const int min_detect_count_ = 5;
const int outpost_max_temp_lost_count_ = 75;
const int normal_max_temp_lost_count_ = max_temp_lost_count_;
const int max_switch_count_ = 200;
const std::chrono::milliseconds timeout_sec_ = std::chrono::milliseconds(100);
int detect_count_ = 0;
int temp_lost_count_ = 0;
int max_temp_lost_count_ = 15;
const int min_detect_count_ = 5;
const int outpost_max_temp_lost_count_ = 75;
const int normal_max_temp_lost_count_ = max_temp_lost_count_;
const int max_switch_count_ = 200;
const std::chrono::milliseconds timeout_ = std::chrono::milliseconds(100);
};

}
2 changes: 1 addition & 1 deletion src/tongji/solver/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Solver::Impl {
std::shared_ptr<world_exe::interfaces::IArmorInCamera> EstimateAllArmorPoses(
std::shared_ptr<interfaces::IArmorInImage> armors_in_image) {
std::vector<data::ArmorCameraSpacing> armor_plates;

if (!armors_in_image) return nullptr;
for (int i = 0; i < static_cast<int>(enumeration::ArmorIdFlag::Count); i++) {
const auto& armor_id = util::enumeration::GetArmorIdFlag(i);
const auto& armors = armors_in_image->GetArmors(armor_id);
Expand Down
17 changes: 14 additions & 3 deletions src/tongji/state_machine/state_machine.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "state_machine.hpp"

#include <iostream>
#include <memory>

#include "../identifier/tracker.hpp"
Expand All @@ -17,8 +16,17 @@ class StateMachine::Impl {
const enumeration::CarIDFlag& GetAllowdToFires() const { return target_id_; }

void Update(std::shared_ptr<interfaces::IArmorInImage> armors_in_image,
const enumeration::CarIDFlag& invincible_armors,
const std::chrono::milliseconds& duration_from_last_update) {
target_id_ = tracker_->SelectTrackingTargetID(armors_in_image, duration_from_last_update);

target_id_ = enumeration::CarIDFlag::None;
target_id_ = tracker_->SelectTrackingTargetID(
armors_in_image, invincible_armors, duration_from_last_update);
}

void SetLostState() {
target_id_ = enumeration::CarIDFlag::None;
tracker_->SetLostState();
}

private:
Expand All @@ -35,7 +43,10 @@ const enumeration::CarIDFlag& StateMachine::GetAllowdToFires() const {
}

void StateMachine::Update(std::shared_ptr<interfaces::IArmorInImage> armors_in_image,
const enumeration::CarIDFlag& invincible_armors,
const std::chrono::milliseconds& duration_from_last_update) {
return pimpl_->Update(armors_in_image, duration_from_last_update);
return pimpl_->Update(armors_in_image, invincible_armors, duration_from_last_update);
}

void StateMachine::SetLostState() { return pimpl_->SetLostState(); }
}
3 changes: 3 additions & 0 deletions src/tongji/state_machine/state_machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ class StateMachine final : public interfaces::ICarState {
const enumeration ::CarIDFlag& GetAllowdToFires() const override;

void Update(std::shared_ptr<interfaces::IArmorInImage> armors_in_image,
const enumeration::CarIDFlag& invincible_armors,
const std::chrono::milliseconds& duration_from_last_update);

void SetLostState();

StateMachine(const StateMachine&) = delete;
StateMachine& operator=(const StateMachine&) = delete;
StateMachine(StateMachine&&) noexcept = default;
Expand Down
52 changes: 0 additions & 52 deletions tests/mocks/MockCamera.hpp

This file was deleted.