Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f421b51
refactor: outpost EKF with omega state and Mahalanobis-only matching
heyeuu Jun 3, 2026
9dd23a8
refactor: consolidate structs, rewrite generate_slot_candidates
heyeuu Jun 3, 2026
f07e18a
refactor: simplify snapshot, remove detail namespace and snapshot.hpp…
heyeuu Jun 4, 2026
a669f8d
refactor: clean up is_converged, tune mahalanobis gate to 10.0
heyeuu Jun 4, 2026
43a9632
Merge remote-tracking branch 'origin/main' into refactor/outpost-robo…
heyeuu Jun 4, 2026
d921a98
fix: use return value of into_odom_link and fix adapter include
heyeuu Jun 4, 2026
9112f67
fix: publish full camera_link TF including translation
heyeuu Jun 4, 2026
4fb640d
fix: keep outpost optimization in camera frame, convert to odom after
heyeuu Jun 4, 2026
02620b1
tune: adjust outpost angles, simplify convergence check, tighten maha…
heyeuu Jun 4, 2026
7f062e4
chore: rename Armor
heyeuu Jun 7, 2026
a74092f
Merge remote-tracking branch 'origin/main' into refactor/outpost-robo…
heyeuu Jun 7, 2026
7323416
refactor(outpost): simplify layout model and match flow
heyeuu Jun 8, 2026
e9b178b
Merge branch 'main' into refactor/outpost-robot-state
heyeuu Jun 8, 2026
9a1a122
refactor predictor state and snapshot models
heyeuu Jun 8, 2026
02bc2da
fix: fix height template
heyeuu Jun 9, 2026
503a5fa
refactor: restructure fire_control module
heyeuu Jun 11, 2026
df221a5
refactor: restructure outpost ekf
heyeuu Jun 15, 2026
f4bd2a8
feat:add outpost rotation direction confirm
heyeuu Jun 15, 2026
5ce7a46
refactor(outpost): improve robot_state readability and reset logic
heyeuu Jun 17, 2026
9505511
fix outpost tracker reset and cleanup logic
heyeuu Jun 18, 2026
84c7c92
Merge origin/main into refactor/outpost-robot-state
heyeuu Jun 18, 2026
7a7fe50
refactor: simplify outpost slot candidate tracking
heyeuu Jun 19, 2026
c128703
feat(fire_control): add pitch tolerance to shoot evaluator
heyeuu Jun 19, 2026
7f2582b
tune(fire_control): adjust shoot parameters and threshold
heyeuu Jun 19, 2026
de77add
fix(outpost): tighten fusion and convergence checks
heyeuu Jun 19, 2026
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
28 changes: 16 additions & 12 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ capturer:
record_fps: 24
max_videos_size_gb: 50

# source: "local_video"
# source: "hikcamera" or "local_video"
source: "hikcamera"

hikcamera:
Expand All @@ -47,7 +47,7 @@ capturer:
# 替换为你具体的路径
location: "/path/to/your/video"
# double 帧率
frame_rate: 40
frame_rate: 80
# bool 是否循环播放
loop_play: true
# bool 是否允许跳帧以满足实时性
Expand Down Expand Up @@ -90,17 +90,18 @@ pose_estimator:
outpost_armor_thickness: 0.022

fire_control:
initial_bullet_speed: 21.4 # m/s
shoot_delay: 0.07 # s
initial_bullet_speed: 23.5 # m/s
shoot_delay: 0.04 # s
mpc_enable: true
yaw_offset: 0.0 # degree
pitch_offset: 0.0 # degree
yaw_offset: -0.4 # degree
pitch_offset: +0.8 # degree

aim_point_chooser:
coming_angle: 70.0 # degree
armor_target_selector:
coming_angle: 60.0 # degree
leaving_angle: 20.0 # degree
outpost_coming_angle: 70.0 # degree
outpost_leaving_angle: 20.0 # degree
outpost_coming_angle: 60.0 # degree
outpost_leaving_angle: 30.0 # degree
switch_threshold: 8.0 # degree

mpc:
mpc_max_yaw_acc: 50.0
Expand All @@ -111,11 +112,14 @@ fire_control:
mpc_pitch_q_angle: 9000000.0
mpc_pitch_q_rate: 0.0
mpc_pitch_r_acc: 1.0
mpc_max_iter: 5

shoot_evaluator:
is_lazy_gimbal: false
near_angle_tolerance: 3 # degree
far_angle_tolerance: 2 # degree
near_yaw_tolerance: 2 # degree
far_yaw_tolerance: 1 # degree
near_pitch_tolerance: 2 # degree
far_pitch_tolerance: 1 # degree
split_distance: 2 # m

visualization:
Expand Down
26 changes: 10 additions & 16 deletions src/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace rmcs {
class AutoAimComponent final : public rmcs_executor::Component {
static inline const auto kNaN = std::numeric_limits<double>::quiet_NaN();
static inline const auto kTNaN = Eigen::Vector3d { kNaN, kNaN, kNaN };
static inline const auto kQNaN = Eigen::Quaterniond { kNaN, kNaN, kNaN, kNaN };

private:
AutoAim auto_aim { };
Expand All @@ -27,7 +26,6 @@ class AutoAimComponent final : public rmcs_executor::Component {
OutputInterface<double> pitch_rate;
OutputInterface<double> yaw_acc;
OutputInterface<double> pitch_acc;
OutputInterface<bool> feedforward_valid;

std::chrono::steady_clock::time_point last_command_timestamp;

Expand All @@ -45,7 +43,6 @@ class AutoAimComponent final : public rmcs_executor::Component {
register_output("/auto_aim/pitch_rate", pitch_rate, kNaN);
register_output("/auto_aim/yaw_acc", yaw_acc, kNaN);
register_output("/auto_aim/pitch_acc", pitch_acc, kNaN);
register_output("/auto_aim/feedforward_valid", feedforward_valid, false);
}

auto before_updating() -> void override {
Expand All @@ -66,12 +63,10 @@ class AutoAimComponent final : public rmcs_executor::Component {
ctx.timestamp = Clock::now();

const auto& dir = *barrel_direction;

ctx.yaw = std::atan2(dir.y(), dir.x());
ctx.pitch = std::atan2(-dir.z(), std::hypot(dir.x(), dir.y()));
ctx.yaw = std::atan2(dir.y(), dir.x());
ctx.pitch = std::atan2(-dir.z(), std::hypot(dir.x(), dir.y()));

const auto& iso = *camera_transform;

ctx.camera_transform.translation = Translation { iso.translation() };
ctx.camera_transform.orientation = Orientation { Eigen::Quaterniond(iso.rotation()) };

Expand All @@ -84,14 +79,13 @@ class AutoAimComponent final : public rmcs_executor::Component {
using namespace std::chrono_literals;
if (Clock::now() - cmd.timestamp > 100ms) return;

*should_control = cmd.should_control;
*should_shoot = cmd.should_shoot;
*yaw_rate = cmd.yaw_rate;
*pitch_rate = cmd.pitch_rate;
*yaw_acc = cmd.yaw_acc;
*pitch_acc = cmd.pitch_acc;
*feedforward_valid = cmd.feedforward_valid;
*robot_center = {
*should_control = cmd.should_control;
*should_shoot = cmd.should_shoot;
*yaw_rate = cmd.yaw_rate;
*pitch_rate = cmd.pitch_rate;
*yaw_acc = cmd.yaw_acc;
*pitch_acc = cmd.pitch_acc;
*robot_center = {
cmd.robot_center.x,
cmd.robot_center.y,
cmd.robot_center.z,
Expand All @@ -104,7 +98,7 @@ class AutoAimComponent final : public rmcs_executor::Component {
*target_direction = Eigen::Vector3d {
std::cos(pitch) * std::cos(yaw),
std::cos(pitch) * std::sin(yaw),
std::sin(pitch),
-std::sin(pitch),
};
});
last_command_timestamp = now;
Expand Down
40 changes: 23 additions & 17 deletions src/kernel/auto_aim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,29 @@ struct AutoAim::Impl {
auto armors = snapshot->predicted_armors(Clock::now());
visual.publish(armors, "visible_robot");

const auto yaw = context.yaw;
if (auto result = fire.solve(*snapshot, yaw)) {
cmd.should_control = true;
cmd.target = target.target_id;
cmd.should_shoot = result->shoot_permitted;
cmd.yaw = result->yaw;
cmd.pitch = result->pitch;
cmd.yaw_rate = result->yaw_rate;
cmd.pitch_rate = result->pitch_rate;
cmd.yaw_acc = result->yaw_acc;
cmd.pitch_acc = result->pitch_acc;
cmd.feedforward_valid = result->feedforward_valid;
cmd.robot_center = result->center_position;

/// TODO:
/// 统一控制侧和自瞄侧的 Pitch 符号方向定义
visual.update_aiming_direction(cmd.yaw, -cmd.pitch);
const auto gimbal_state = fire_control::GimbalState {
.timestamp = context.timestamp,
.yaw = context.yaw,
.pitch = context.pitch,
};
if (auto result = fire.solve(*snapshot, gimbal_state)) {
cmd.should_control = true;
cmd.target = target.target_id;
cmd.should_shoot = result->shoot_permitted;
cmd.yaw = result->yaw;
cmd.pitch = result->pitch;
cmd.robot_center = result->center_position;

if (result->feedforward.has_value()) {
cmd.yaw_rate = result->feedforward->yaw_rate;
cmd.pitch_rate = result->feedforward->pitch_rate;
cmd.yaw_acc = result->feedforward->yaw_acc;
cmd.pitch_acc = result->feedforward->pitch_acc;
}

auto impact_armors = snapshot->predicted_armors(result->impact_time);
visual.publish(impact_armors, "impact_robot");
visual.update_aiming_direction(cmd.yaw, cmd.pitch);
visual.update_mpc_plan(cmd.yaw, cmd.pitch, cmd.yaw_rate, cmd.pitch_rate,
cmd.yaw_acc, cmd.pitch_acc);
}
Expand Down
Loading
Loading