Commit Graph

203 Commits

Author SHA1 Message Date
374a09c821 fix(robot_cpp): per-call-site throttle window trong log_*_throttle
static local dung chung 1 window cho ca ham nen nhieu diem goi giam len
nhau (controller_runner co 11 diem goi log_error_throttle, diem no in
truoc se cam diem kia im ca cua so). Chuyen sang bang lock-free keyed
theo return address (__builtin_return_address) + format pointer, moi
call site giu window rieng.

Kem theo:
- color_enabled chuyen std::atomic<bool>, tranh data race khi control
  loop / sensor callback / planner thread cung goi log.
- is_color_supported() cache ket qua qua std::call_once, bo getenv() lap
  lai moi dong log trong control loop.
- NaN/am trong throttle gio la "khong throttle" thay vi cam log vinh
  vien (NaN truoc day fail phep so >= mai mai).
- them test_console_throttle.cpp + dang ky ConsoleThrottleTest qua
  add_test trong CMakeLists.txt.
2026-09-15 15:07:13 +07:00
2b0993bd53 feat: lifecycle contract for move_base2 cancel/pause/resume + component status probe
- robot_nav_core::Preemptable (new header): mixin a BaseGlobalPlanner may
  implement to accept a preempt() cut during makePlan(), no vtable break for
  planners that don't.
- move_base_core::component_status_probe.h (new): ComponentStatusEntry +
  boost::dll alias name ("MoveBaseComponentStatus") a host can probe to read
  per-component phase (idle/busy/stopping/paused/hung) without linking
  move_base2 directly.
- nav_c_api_2.h/.cpp: NavComponentStatus struct and
  navigation_get_component_status() — lazy dlsym of the probe above, returns
  0 rows if the loaded .so doesn't export it. Doc: PREEMPTING is now a
  truthful "still winding down" state, not "acknowledged", and a host must
  poll to quiescence rather than resend immediately.
- move_base_common_params.yaml: settle_timeout, stopped_measured_linear/
  angular_eps, watchdog_period + per-component stall budgets (Vietnamese
  comments, matches the schema). Also fixes a wrong comment on
  max_planning_retries: 0 means escalate on the FIRST failure, not
  "unlimited" (-1 is unlimited) — the inverted comment likely caused the
  dev machine's max_planning_retries: 0.

Root cause and measurements: Test/move_base2/docs/PLAN_LIFECYCLE_CANCEL_PAUSE_RESUME.md.

Excluded from this commit (pre-existing, unrelated): config/hybrid_local_planner_params.yaml,
config/priest_local_planner_params.yaml, config/recovery_behaviors_params.yaml (dock/PRIEST
tuning, dated before this work), src/Libraries/common_msgs and src/Libraries/costmap_2d
(submodule pointer bumps from other work), src/Libraries/robot_cpp console throttle changes
and doc/cpp_host_guide.md (separate, unrelated task).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 22:06:17 +07:00
37e44eb571 fix(nav_2d): xoá UB trong TwoPointsPlanner và pointer hoang trong tf_help
- two_points_planner.cpp: nhánh suy biến (start == goal, ca quay tại chỗ)
  đọc `theta` chưa khởi tạo trước khi dùng trong cos()/sin(). Khởi tạo bằng
  yaw hiện tại của start; comment nêu rõ vì sao chặng rotate chạm nhánh này.

- tf_help.cpp: `canTransform()` nhận `std::string *error_msg` chưa khởi
  tạo — tf3 ghi qua con trỏ đó khi transform thất bại, tức ghi vào vùng nhớ
  bất kỳ. Đổi sang std::string thật + log tên hai frame khi thất bại.

- tf_help.cpp: `transformPose()` gọi transform() rồi `return true` vô điều
  kiện ở cả nhánh chính lẫn nhánh ExtrapolationException — lookup hỏng để
  lại out_pose mặc định (yaw 0, trông như hướng thật) mà vẫn báo thành
  công. Trả thẳng kết quả của transform().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 10:45:44 +07:00
09799dffdd api: the sensor key is a topic, so call it one
Five add* functions each named the same argument differently - map_name,
laser_scan_name, point_cloud_name, point_cloud2_name, odometry_name - while
addDepthCameraData already called it topic. The get* and remove* families
disagreed in the same way, though they take the same key.

It is not a label. It has to match the topic a costmap layer names in
observation_sources, and the entry in sensor_store_params.yaml. A key matching
nothing is accepted in silence and read by nobody, which surfaces as an empty
costmap with no error anywhere - so the parameter name is the first place to
say what the string is for.

Fourteen declarations now say topic. A parameter name has no effect at a call
site, so this touches no host: no ABI change, nothing to rebuild in lockstep.

addDepthCameraData is the one add* taking a const pointer rather than a value,
and the header now says why, because the next reader will otherwise see an
inconsistency and even it up. Every other sensor is reduced by the host before
it arrives - a laser scan is 5.5 KB, a depth cloud is voxel-filtered from
3.26 MB to 24 KB - and copying all four together costs about 25 microseconds
per second of runtime, measured against a running simulation. A depth image
arrives whole at 398 KB because the voxel layer needs the full frame for its
clearing frustum, and copying that costs roughly 250 times the other four
combined. That is what earns a pointer, and a 5 KB scan does not.
2026-08-27 12:05:53 +07:00
ab3a6c68c7 config: bring the nav core config tree up to the current planner schema
hybrid_local_planner_params.yaml gains 120 keys and drops 12, including a whole
HybridDockingLocalPlanner block that was not here at all. The additions are the
two-tier velocity limits the planner has been reading for a while - acc_lim_*
bounding the DWA sampling window, output_acc_lim_*/output_decel_lim_* clamping
the command on its way out - plus min_velocity, min_yawrate and the blend
distances. The removed keys are the old rejoin_* group, which no longer exists
in the planner.

A config tree that names keys the planner does not read, and omits keys it
does, fails silently: the plugin falls back to its C++ defaults and nobody is
told. That is the "works on my machine, not on the robot" shape.

The comments are rewritten around what the two tiers actually decide, because
the split is not obvious from the key names: DWA owns forward velocity and is
the only tier that can command a turn in place, while Pure Pursuit only steers,
through omega = |v| * pp_weight_omega * sin(err) / lookahead - a law that
degenerates at v = 0, which is why steering authority returns to DWA below
pp_min_steering_velocity.

mppi_local_planner_params.yaml is real tuning: goal tolerances tightened from
0.10/0.10 to 0.03/0.02, the control weights zeroed, goal_capture_radius and
goal_overshoot_margin added, and the stale LocalPlannerAdapter block dropped.

move_base_common_params.yaml is a typo in a comment - #ybridLocalPlanner. The
active value is untouched.

All three parse; the key sets were compared with a YAML load rather than by eye.
2026-08-27 09:35:56 +07:00
48db28b4d2 build: bump costmap_2d và data_convert sau khi dọn dependency PCL
costmap_2d  d60e1e8 -> af66991  (bỏ hẳn PCL, gói không dùng)
data_convert f23037b -> 6708cdf  (thu hẹp còn COMPONENTS common)

Cả hai nhằm cắt chuỗi PCL -> VTK -> VTK::mpi -> MPI::MPI_C, thứ làm
`cmake ..` gãy ở generate step trên robot aarch64 có VTK 9.1 build kèm MPI.
Root project khai LANGUAGES CXX nên find_package(MPI COMPONENTS C) không bao
giờ thành công.
2026-08-25 12:39:14 +07:00
e2f2f55660 feat(dock_planner): bump submodule và bổ sung schema động học vào config
Con trỏ submodule dock_planner: a301987 -> 1f04a95 (mô hình động học
differential/ackermann + maneuver straight-pivot-straight).

config/dock_global_params.yaml thêm ba khoá mới khớp với loader:
- kinematics/model: ackermann | differential
- kinematics/minimum_turning_radius: chỉ dùng khi model=differential
- maneuver/pivot_fallback_extension, maneuver/pivot_safety_margin

Giá trị mặc định giữ nguyên hành vi cũ: model=ackermann,
pivot_fallback_extension=0.0 (tắt maneuver mới). Comment đầu file mô tả lại
ba kiểu đường và thứ tự planner thử dựng.
2026-08-25 12:15:39 +07:00
2f204f88d2 chore: bump costmap_2d — tên thread map-update cho pidstat/top
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 10:24:04 +07:00
3a991c2e2a config: khoá metrics/debug/snapshot cho costmap (mặc định tắt) + bump costmap_2d
Đồng bộ schema từ cây move_base2/config/runtime: performance_metrics_enabled,
performance_metrics_period, debug_level, snapshot_for_readers — bản này là
default trung tính nên toàn bộ để tắt/0/false; cây đang chạy khi test là
move_base2/config/runtime (ở đó metrics+snapshot bật).

Bump submodule costmap_2d 3196a19 -> 84c8378: debug metrics updateMap +
snapshot API cho reader (chi tiết ở log submodule).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 20:19:59 +07:00
fccd377505 config: cập nhật comment goal_blocked_check_radius — dò đĩa nửa thân (priest 6d78767)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:36:09 +07:00
5456dfef3b config: khoá goal_blocked_check_radius (0 = tắt) cho priest — đồng bộ 8182297
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:18:32 +07:00
de677ccc14 config: khoá hold_timeout 10 s cho priest — đồng bộ 245d656
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:01:07 +07:00
970dc165cd config: khoá weight_velocity_deficit (mặc định 0 = tắt) — đồng bộ priest 73bbdd1
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 16:16:17 +07:00
ab3ee1ae97 config: khoá head_slowdown_inscribed_scale (mặc định 1.0) — đồng bộ priest 2455707
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 16:05:21 +07:00
f00fb6a887 config: comment debug_command priest theo format mới (priest eb413f5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:30:25 +07:00
6118cb7b7b config: comment head slowdown — trọng số độ-gần-thời-gian (priest ea05d0d)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:25:51 +07:00
9da19da7e5 config: head slowdown priest sang bản so tương đối + head_slowdown_release_cycles (vẫn TẮT)
Đồng bộ schema với priest_local_planner 6d75b73.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:20:48 +07:00
98efe89312 feat(config): khoá side_switch_feasible_res + head_slowdown cho priest (mặc định TẮT)
Đồng bộ schema với priest_local_planner 50375f2 — guard đổi bên theo tính
thực thi + giảm tốc theo đầu quỹ đạo. Giữ tắt tới khi thử trên robot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:11:00 +07:00
87cbcf8957 feat(config): khoá obstacle_time_discount cho priest (mặc định TẮT 0.0/1.0)
Đồng bộ schema với priest_local_planner 8405e29 — co ellipse vật cản theo
thời gian horizon, trị vòng rộng đầu mission. Giữ tắt tới khi thử trên robot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:30:27 +07:00
802a528d85 config: đồng bộ schema khoá rotate_settle_yawrate cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:45:45 +07:00
210ba931f1 config: đồng bộ schema khoá side_infeasible_res cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:19:33 +07:00
3d630d0bad config: cập nhật comment rotate_to_path cho PriestLocalPlanner
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:06:05 +07:00
5ed80df405 config: đồng bộ schema khoá rotate_to_path_enabled cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 09:53:22 +07:00
21886bc2fb config: đồng bộ schema khoá start_violation_ramp_time cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 09:37:39 +07:00
4a66099492 config: đồng bộ schema khoá t_fin_min cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:59:05 +07:00
64929b60cf config: đồng bộ schema khoá omega_ff_min_speed cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:35:09 +07:00
0ff610eed7 config: đồng bộ schema khoá goal_approach_distance cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:26:40 +07:00
b43d1b94df config: đồng bộ schema khoá xy_latch_release_factor cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:10:59 +07:00
b979276e63 config: đồng bộ schema 3 khoá mới của PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 21:56:53 +07:00
a230e0665f config: đồng bộ schema proj_early_exit + footprint circles cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 21:37:16 +07:00
fce619feae config: đồng bộ schema khoá side_hysteresis cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:56:26 +07:00
64863c2286 config: đồng bộ schema khoá obstacle_corridor cho PriestLocalPlanner (tắt)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:31:52 +07:00
14e0fdf720 config: đồng bộ schema khối debug + cổng va chạm cho PriestLocalPlanner
Chỉ thêm khoá mới (debug_level 0, collision_check_enabled false) — không đổi
giá trị tuning nào; đồng bộ tập khoá với cây move_base2/config/runtime.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:27:27 +07:00
492cafabbf chore: bump con trỏ submodule dock_planner 2026-08-15 13:38:11 +07:00
9009564f56 docs: viết lại comment cây config bằng tiếng Việt, bỏ ba khoá chết
dock_global_params bỏ maneuver/straight_lateral_tolerance,
maneuver/straight_yaw_tolerance và terminal/direction: DockPlannerConfig::load
không đọc khoá nào trong số đó, riêng terminal/direction còn gợi ý sai rằng chiều
đoạn cuối cấu hình được trong khi nó được suy ra từ phía robot đứng. Bổ sung
direct_entry_min_curve_room và straight_length. Không đổi giá trị nào khác.
2026-08-15 13:38:03 +07:00
4a302517c5 chore: bump the submodule pointers
custom_planner, dock_planner, common_msgs, costmap_2d, data_convert, geometry2,
laser_geometry, robot_time and voxel_grid.
2026-08-15 13:09:39 +07:00
d080e1bbd5 docs: update the C API guide and the C# integration report 2026-08-15 13:09:39 +07:00
599bce1731 config: update the installed planner profiles to the current schema
custom_global_params documents the CustomPlanner namespace and drops the stale
SBPL keys; dock_global_params moves to the straight-terminal DockPlanner schema
and keeps its 1.0 m terminal padding.
2026-08-15 13:09:39 +07:00
e942a7d157 build: default the tests to the build mode instead of always on
The standalone CMake build is the robot deployment path and must not produce
test executables; a catkin workspace is a development machine and keeps them.
Force with -D<option>=ON to build the tests from a standalone build.
2026-08-15 12:41:31 +07:00
75078db589 optimal vitural function 2026-08-10 21:42:52 +07:00
771ee5d5e7 add new file 2026-08-10 13:21:31 +07:00
ad28a413cc add new file nav_c_api2 and function 2026-08-06 19:50:46 +07:00
565e18bfb8 Add recovery and mission manager structure 2026-07-03 17:37:39 +07:00
33d6537947 Tạm bỏ 2026-04-27 15:09:17 +07:00
62a2fed488 fix lỗi xoay khi về đích 2026-04-27 14:24:40 +07:00
1a19e38b2d update 2026-04-25 16:26:12 +07:00
0d10ec2208 update config 2026-04-25 15:35:10 +07:00
270bbcc0c4 update 2026-04-25 15:29:44 +07:00
dbbda958a2 update logic xoay 2026-04-24 15:01:37 +07:00
875db4ba1e Hiep sử custom và thông số rotate 2026-04-24 14:52:11 +07:00