slope: test doc tu dong (--slope-test) -- dinh vi lai xong robot tu tim truc doc tren ban do (do cao san cua node), quay mat xuong doc, cho nut Y (gamepad.button_test) roi chay N luot xuong/len, moi luot mot van toc (mac dinh 10 luot 0.10..0.46 m/s)

Lenh di qua FSM an toan nhu moi lenh khac; dung han khi lech duong > 0.4 m, scan mat khop 1.5 s, pose nhay > 0.3 m, nghieng > 20 do. Do lech dinh vi 2 lan/giay (khop scan voi likelihood field, doc lap RTAB-Map) ra logs/slope_test_<gio>.csv + bang tong. Sim 08/10 (slope_two_ramps, 10 luot): lech that trung vi 0.9 cm, max 3.0 cm, sai z trung vi 0.3 cm, khong troi tu luot 1 den 10.
This commit is contained in:
trung09122002
2026-10-08 15:52:02 +07:00
parent f8049be038
commit fc03420d2c
13 changed files with 1462 additions and 1 deletions

View File

@@ -100,6 +100,9 @@ struct GamepadConfig {
int button_zero = 1; // B -- ve 0 ngay
int button_turbo = 5; // RB
int button_slow = 4; // LB
// Y -- test doc tu dong (--slope-test): bat dau / chay tiep sau tam dung.
// Bat ke dang bat dieu khien hay khong.
int button_test = 3;
// Duong thoat khi bo tay cam nguoc chieu. Doi mot dong YAML thay vi sua code
// roi build lai -- chieu truc chi kiem duoc bang cach cam tay cam vao robot
@@ -191,6 +194,9 @@ struct GamepadCommand {
// Chuyen trang thai, chi de LOG. Mapper khong tu log: no thuan.
bool enabled_changed = false;
bool connected_changed = false;
// Vua BAM nut test (canh len) -- runtime dem so lan bam.
bool test_pressed = false;
};
// Tho -> van toc. THUAN: khong doc dong ho, khong doc file, khong log.
@@ -215,6 +221,7 @@ class GamepadMapper {
bool enable_pressed_ = false; // chong dap phim, = start_pressed_ ben kia
bool was_connected_ = false;
bool have_active_ = false; // da tung co lenh chuyen dong
bool test_prev_ = false; // nut test vong truoc (bat canh len)
UnixTime last_active_;
};

View File

@@ -91,6 +91,7 @@ GamepadCommand GamepadMapper::Step(const GamepadState& s, UnixTime now) {
enabled_ = false;
enable_pressed_ = false;
was_connected_ = false;
test_prev_ = false;
}
out.enabled = false;
// Van gui 0 trong cua so idle: rut day giua luc dang chay thi lenh cuoi
@@ -108,6 +109,12 @@ GamepadCommand GamepadMapper::Step(const GamepadState& s, UnixTime now) {
out.connected_changed = true;
}
// --- Nut test (Y): canh len, BAT KE dang bat dieu khien hay khong ---------
// Dat TRUOC moi nhanh `return` ben duoi (nut B, coc LT, chua bat).
const bool test_now = s.Button(cfg_.button_test);
out.test_pressed = test_now && !test_prev_;
test_prev_ = test_now;
// --- Nut Start: BAT/TAT dieu khien --------------------------------------
// joy_control_node.cpp:180-194. Chong dap phim bang co canh len.
if (s.Button(cfg_.button_enable)) {