Commit Graph

51 Commits

Author SHA1 Message Date
648243a0cd config: add the arc_std profile for the concave cradle
Matches the Gazebo dock_cradle_arc model - radius 0.40 m over 2.0 rad. Numbers
for simulation; no real dock has been measured.

offset_x is 0.92 and the derivation is worth stating, because the contact point
is NOT the deepest point. The cradle mouth is 0.673 m across while the robot is
0.960 m wide, so the robot never gets inside the cradle - it meets the two
mouth edges, which stand 0.184 m towards the robot from the deepest point:

    R - R*cos(arc_span/2) = 0.40 - 0.40*cos(1.0) = 0.184 m

so 0.583 rear extent + 0.070 padding + 0.184 + 0.08 clearance = 0.92. Changing
either arc_span or arc_radius moves the mouth and this has to be recomputed.

arc_min_span defaults to 0.52 rad off measured data rather than intuition: on a
0.40 m arc with 3 mm noise the fitted radius drifts +1.9 mm at 45 degrees of
span, +8.6 mm at 30, +25.4 mm at 20. Below 30 degrees a 0.40 m cradle can be
scored as 0.43 and fall outside arc_radius_tolerance.

arc_max_rms is the gate that matters. Every set of points fits some circle, a
right-angled corner included, so the residual is the only thing separating an
arc from a bend.

The tuning in the detect block stays out of this commit; it is someone else's
in-flight work on the same file.
2026-08-26 20:15:19 +07:00
1f18f446b4 config: add the detect_lidar handler and its dock profiles
DockPatternActionHandler detects the dock from raw LiDAR instead of taking a
pose perception already computed over TF, so it can reject a wrong candidate
inside a single scan - supporting rays per wing, fit error, vertex angle, wing
length - rather than relying on agreement across many samples.

DetectCharger moves from detect to detect_lidar; detect keeps DetectPallet.
Both handlers cannot claim the same actionType, and in simulation detect runs
use_simulated_goal, which fabricates the pose rather than detecting anything.

Three profiles. v_std matches the Gazebo dock_plate_v model, v_wide is a second
shape to show how an order picks one by name, and v_tape is v_std with the
reflective-tape check turned on.

The tape group is off in v_std and v_wide. Turned on, a candidate that already
passed every geometric gate must also carry two runs of bright rays the right
distance apart. Geometry alone cannot answer the question that matters in a
warehouse - every wall corner and every pair of pallets at a right angle is a V
of some size - and none of them carry reflective tape at the expected spacing.

v_tape exists as a separate profile rather than as a switch inside v_std
because v_std works today and a new feature should not change the behaviour of
something that works. Once it has run on the robot, move the tape_* group into
v_std and drop this profile.

Measured in the sim on the parked robot, 8 and 13 bright rays: spacing 0.196 m
against 0.195 configured, widths 0.120 and 0.119 m against 0.120. It settled in
0.65 s over 5 detections, against 1.90 s over 31 for v_std on the same scene.

tape_min_intensity carries each sensor's own units - Gazebo passes laser_retro
through untouched, a real nanoscan3 does not - so it has to be measured on the
sensor in use, not copied from here.

The tuning in the detect block is deliberately left out of this commit; it is
someone else's in-flight work on the same file.
2026-08-26 17:59:18 +07:00
ff2eb71f7a Drop terminal_direction from the docking marker fixture
The key is dead. Nothing reads it: PlannerRunner deliberately does not accept
it, because the direction of the final straight segment is derived from which
side of the goal the robot stands on, the layer above having already offset
the goal so base_link ends up on it. A marker key that could force the other
direction would contradict the goal position it was given, so it was dropped
rather than implemented.

Leaving it in the fixture invites someone to set it and expect an effect.
2026-08-26 11:35:29 +07:00
b102391fb8 Keep raw sensor readings so plugins can reach what the costmap threw away
Sensor data entered this runtime and disappeared into the costmap. At 0.05 m
with inflation the costmap has destroyed ray order and object shape, so a dock
detector fitting lines to find a V plate cannot reconstruct what the laser
saw - two 0.2 m wings on that grid are one blob. A reinforcement-learning
local planner wants the raw scan for the same reason. Neither had a route:
ActionContext held only TF, and LocalPlanner::initialize takes only a costmap.

NavigationServer now owns a SensorStore and feeds it from all five doors,
handing a read-only port to the action registry and to the controller runner.

The store gets the reading BEFORE the filter. Anything that wants filtering
filters upstream; the store does not know a filter exists. With laser SOR on,
the store and the costmap deliberately see different data - one wants outliers
gone, the other wants the true shape - and the comment at addLaserScan now
says so, because the one it replaces claimed the opposite.

remove* mirrors into the store, dropping readings while keeping the topic
declared. A host that has disowned data while the store still serves it means
the two disagree about what the robot can currently see, and max_age only
covers the tail of that.

Reaching a local planner without breaking every other one: widening
LocalPlanner::initialize would break hybrid, mppi, priest, stanley and
deep_mpc at once for the sake of one planner. A planner that wants sensor data
inherits SensorConsumer instead, and ControllerRunner finds out with a
dynamic_cast after loading it, at all three sites that build an instance and
always before initialize(). Planners that do not inherit it cast to null and
nothing happens, so nothing needs rebuilding. That cast crosses a .so boundary
and depends on matching RTTI, which a green build does not prove - hence the
log line, and hence TestControllerSensorProbe, dlopen'd like a real plugin, to
check it actually matches.

sensor_store/report_period prints what the store holds every N seconds, off by
default. Until a consumer exists it is the only way to see whether data
arrives at all, and it is what separates a mistyped topic from a dead sensor -
without it the two look identical. It reads age from the control loop's clock,
not robot::Time::now(), which is the wall clock while a simulated scan is not.

Config is refused at boot, not at first use: an unknown data_type, a short name
two packages share, a duplicate topic, a capacity below 1, a max_age that is
not positive. Declaring no sensor at all is valid and leaves the store empty
and silent - a runtime with no consumer of raw data holds nothing, which is an
answer rather than a reason to refuse to start.

robot_nav_msgs/OccupancyGrid is registered here rather than in
robot_sensor_ports, which ships only its own package's types; pulling
robot_nav_msgs into every translation unit that touches the store would be the
cost of doing otherwise.
2026-08-26 11:35:17 +07:00
ea02392c69 build: bỏ dependency PCL không dùng
Gói không include một header pcl/ nào. Khối find_package ở đây copy từ
recovery_core, mượn PCL_INCLUDE_DIRS phòng khi header robot_costmap_2d lộ
dependency PCL — nhưng robot_costmap_2d cũng không include PCL ở đâu cả.

Trên robot aarch64 có VTK 9.1 build kèm MPI, chuỗi PCL -> VTK -> VTK::mpi ->
MPI::MPI_C làm CMake gãy ở generate step: root project khai LANGUAGES CXX nên
find_package(MPI COMPONENTS C) không bao giờ thành công và target MPI::MPI_C
không được tạo. Máy dev không dính vì không cài VTK cmake package, find_VTK()
tìm không thấy rồi bỏ qua trong im lặng.

Bỏ find_package, PCL_INCLUDE_DIRS và nhánh if(PCL_FOUND).
2026-08-25 12:38:18 +07:00
a4e6bb2970 feat: chế độ snapshot costmap cho controller + bật metrics, nâng local 10 Hz
controller_runner: 3 điểm khoá (setPlan/computeVelocityCommands/isGoalReached)
— snapshot bật thì refreshSnapshot() (lock ngắn bằng memcpy) thay cho giữ mutex
suốt lượt plugin chạy; snapshot tắt giữ nguyên lock dài cũ. Rollback bằng
config, không cần build.

config runtime: performance_metrics_enabled + debug_level 1 (key phải nằm TRONG
namespace local_costmap/global_costmap — bản root ở costmap_common là key chết);
snapshot_for_readers local=true, global=false (global planner chưa migrate);
update_frequency local 6 -> 10 Hz sau khi hết tranh chấp.

Số đo sim trước/sau: lock_wait local median 7.5 ms (max 53 ms) -> ~0 (max 13 us),
p99 cycle 21.4 -> 3.4 ms; 10 Hz chạy 0 lần rớt nhịp, thread costmap 1.2% một core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 20:19:46 +07:00
e282557079 config: cập nhật comment goal_blocked_check_radius — dò đĩa nửa thân, không phải 1 cell (priest 6d78767)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:36:09 +07:00
be62564fb2 config: khoá goal_blocked_check_radius 1.5 m cho priest — dừng-chờ khi obs đè goal (priest 8182297)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:18:32 +07:00
7934db040c config: khoá hold_timeout 10 s cho priest — hết treo câm khi obs đè goal (priest 245d656)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:01:06 +07:00
f9f87d0865 config: weight_velocity_deficit 2.0 cho priest sim — trị solver-crawl (priest 73bbdd1)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 16:16:16 +07:00
4aa94a145b config: head_slowdown_inscribed_scale 0.7 cho priest sim (kèm min_scale 0.35 user chỉnh)
Đồng bộ với priest 2455707 — 253 ở probe mép thân chỉ rà nhẹ, 254 mới
đạp sâu; hết phanh đáy mỗi lần vào band hành lang.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 16:05:20 +07:00
c1e4b89206 config: xy_latch_release_factor 2.0 -> 5.0 cho priest sim — vành 0.10 m hết orbit quanh goal
Đo 19/8: latch lúc còn trôi 0.2 m/s văng khỏi vành 0.04 m (nhả oan ở
0.041/0.042), orbit 74 s. Kèm fix fallback priest d0661e6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:45:10 +07:00
0c24363a78 config: bật debug_command cho priest sim — [DBG-PRIEST-CMD] format mới (priest eb413f5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:30:25 +07:00
6af1999f4a 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
768831b36a config: head slowdown priest sang bản so tương đối + head_slowdown_release_cycles
Đồng bộ với priest_local_planner 6d75b73 — hành lang hẹp không còn phanh
đáy 81 s; nhả phanh debounce 10 chu kỳ.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:20:39 +07:00
62747503f4 feat(config): khoá side_switch_feasible_res + head_slowdown cho priest (sim BẬT 0.3 / 1.5s)
Chống cú quệt khi nhảy nghiệm quá muộn (sim 19/8: flip ở sv=10, res 2.9-3.9,
sv 54): guard chỉ cho đổi bên khi nghiệm bên mới thực thi được từ pose hiện
tại; head slowdown bò theo ô costmap xấu nhất dưới thân dọc đầu quỹ đạo.
Kèm theo gate threshold 254 -> 253 (INSCRIBED) đúng vai trò của gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:10:24 +07:00
7295de12fc feat(config): khoá obstacle_time_discount cho priest — co ellipse vật cản theo thời gian horizon
Cụm vật cản chỉ chạm đuôi quỹ đạo (gần góc cua path rẽ trước khi tới) bẻ cong
toàn bộ spline — robot vào cua lượn rộng thừa ~0.5 m (sim 19/8: res treo 9.2,
sv=0, vi phạm toàn ở đuôi horizon). Bật trên cây sim: start 2.0 s, min 0.2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:29:53 +07:00
160469d3a5 config: bật rotate_settle_yawrate 0.05 cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:45:45 +07:00
b0f4da03bd config: bật side_infeasible_res 0.3 cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:19:33 +07:00
8173dd7494 config: cập nhật comment rotate_to_path — chỉ align một lần ở đầu plan
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 10:06:05 +07:00
71e5e1bf51 config: bật rotate_to_path cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 09:53:22 +07:00
4e0c65a2fd config: bật start_violation_ramp_time 1.5 cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 09:37:39 +07:00
9b98ab3263 config: bật t_fin_min 1.0 (re-time horizon) cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:59:04 +07:00
51d9550054 config: omega_ff_min_speed 0.15 + comment direct-approach cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:35:08 +07:00
179f087b8b config: goal_approach_distance 0.5 cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:26:40 +07:00
d8a74ed574 config: bật goal XY latch (release factor 2.0) cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 22:10:58 +07:00
64ba7ece70 config: probe hông gate 0.48 + early-exit residual 0.05 + side_hold 10 (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 21:56:53 +07:00
0500c2c007 config: bật proj_early_exit 0.01 + footprint 3 circle cho PriestLocalPlanner (sim)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 21:37:15 +07:00
bf6a3fed25 config: bật side_hysteresis cho PriestLocalPlanner trên cây sim
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:56:26 +07:00
00db0d6ea3 config: bật obstacle_corridor cho PriestLocalPlanner trên cây sim
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:31:52 +07:00
290cc13176 config: khối debug + cổng va chạm cho PriestLocalPlanner (cây sim)
debug_level 2 (throttle 1 Hz) phục vụ đo baseline solve time / obstacle
saturation; collision_check bật với footprint T800 (front/rear 0.583).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 20:27:27 +07:00
b82076374e sim: tạm thay bước LiftFork bằng một chặng lùi ra
Handler LiftFork chưa nối vào thiết bị nên bước đó chỉ báo thành công giả. Thay
bằng chặng lùi 1.0 m để chuỗi PickUp vẫn chạy hết được trong sim; dòng LiftFork
giữ lại dưới dạng comment để bật lại khi có handler thật.
2026-08-18 11:06:25 +07:00
cf5c41ba6e config: hạ steer_bias_min_vel xuống dưới tốc độ làm việc của profile chậm
0.30 m/s lớn hơn max_vel_x của chính profile docking và go_straight, nên bộ tích
phân bù lái KHÔNG BAO GIỜ chạy: log 33 mọi dòng DBG-SS của dock đều bias=0.0000
trong khi offset đứng 2.8 cm không ai khử. Ngưỡng mới 0.15 nằm dưới tốc độ làm
việc 0.20 m/s.

Kèm nới yaw_goal_tolerance docking 0.02 -> 0.05 rad và siết xy_goal_tolerance
của go_straight xuống 0.0001 m.
2026-08-18 11:06:25 +07:00
5891cbb281 sim: đưa goal dock giả về phía sau robot và nới tham số dock planner
simulated_offset_x 2.5 -> -1.3 để chạy lại ca docking lùi càng vào pallet.
max_steering_angle về 0.50, direct_entry_min_curve_room 0.5 -> 0.6 và
straight_length 0 -> 0.4 để đoạn thẳng cuối dài hơn cho robot chỉnh hướng.
2026-08-18 11:06:25 +07:00
31c5b218cb docs: viết lại comment các file config bằng tiếng Việt
File YAML là thứ người vận hành mở ra sửa khi đứng cạnh robot, nên comment phải
đọc hiểu ngay. Mỗi tham số ghi đủ đơn vị, ý nghĩa và hệ quả khi tăng/giảm. Tên
key, plugin, frame, topic và thuật ngữ đã chuẩn hoá giữ nguyên tiếng Anh.
Không đổi một giá trị nào.
2026-08-15 13:37:50 +07:00
0c45d5491a sim: default the simulation to APM and move the fake dock goal ahead of the robot
simulated_offset_x 2.5 with yaw 0.12 exercises the forward-entry docking side.
The maze world and depth_image_proc includes are commented out because the
current sim scene does not use them.
2026-08-15 13:09:09 +07:00
26c2293e0e config: add the dock planner direct-entry and straight-terminal keys
direct_entry_min_curve_room enables the no-cusp entry when there is room for the
arc; straight_length sets the length of the straight terminal leg. Also raises
max_steering_angle to the value measured on the robot.
2026-08-15 13:09:09 +07:00
85e40cbef2 feat: copy terminal_direction down to the docking global planner
Third per-marker key alongside footprint_dock and dock_anchor, so a marker can
override which direction the final straight leg into the dock is driven.
2026-08-15 13:09:09 +07:00
fd0249d3d0 Document the sliding-window detection and switch go_straight to Stanley
action_handlers_params now describes what sample_window means after the change:
it bounds the sliding window and sets when the first evaluation happens, while
timeout is the deadline the detection has to converge within. min_samples gates
whether a window is judged at all rather than failing the attempt outright, and
max_spread_* now reads "no window met this before the timeout".

hold_time is declared with its default of 0, which keeps publishing on the
first good window. Raising it to 0.5-1.0 s guards the case a single window
cannot catch: perception locking steadily onto the wrong object, where the
samples are tight but tight around the wrong place.

go_straight moves from PNKXGoStraightLocalPlanner to
StanleyGoStraightLocalPlanner, the alias the Stanley library exports for a
straight two-point leg, so the profile no longer depends on the old planner.
2026-08-13 22:47:00 +07:00
b3ca39cfdc Document the simulation Stanley profile parameter by parameter
stanley_local_planner_params.yaml carried a short header and bare values, so
tuning it meant reading the source to find out what each key did and which log
line showed whether it needed changing. Every parameter now states what it
controls, which direction to move it, and the symptom that calls for it, with
the diagnostic line to read named alongside.

The docking block keeps its own copy of the full parameter set rather than
inheriting: StanleyDockingLocalPlanner is a separate instance of the same
library reading the block that matches its alias, so a key missing there falls
back to the built-in default, not to the position profile's value.

Simulation values: max_vel_x raised to 1.20 m/s, and the detect handler's
simulated_offset_yaw sign corrected to +0.09 rad so the fake target sits on the
same side as the real one.

move_base2_sim.launch is deliberately left out: it currently carries a local
Gazebo experiment (robot_type APM, world include commented out).
2026-08-13 22:17:33 +07:00
383a04fe29 Report why an action failed instead of a bare "action failed"
FrameSamplerActionHandler already builds a precise reason for each way it can
fail: too few samples, detection too scattered, could not publish the output
frame, raw frame never appeared. All four reached the log as the same four
words, because control_loop read the tick, kept only the status, and dropped
the message, while the state machine passed a hard-coded string to finish().

Three field runs in a row could not be diagnosed for that reason: the detector
was healthy, the host confirmed pallet_raw was published and resolvable, and
the only thing navigation said was "action failed".

The handler message now travels through StateMachineInput into the terminal
reason, so it reaches the host feedback as well as the log, and control_loop
logs it directly - as an error when the action fails, as info when it succeeds,
where it carries the sample count worth comparing against the next failure.

StateMachineOutput::reason is a const char* and enter() stores the pointer
rather than copying, so the composed string lives in a StateMachine member.
Building it in a local would return a pointer into destroyed memory - every
other reason in that class is a string literal, so nothing had hit this before.
Two tests cover it: the message reaches the reason, and the reason survives the
StateMachineInput that carried it.

Config in this tree follows the same split as the robot: per-marker dock_anchor
and footprint_dock in maker_sources.yaml, detect handlers separated into
detect_charger and detect_pallet.
2026-08-13 15:01:48 +07:00
d10c240395 Feed per-marker docking parameters to the global planner
A docking global planner has no way to learn which marker the leg is for:
BaseGlobalPlanner::initialize() takes only the plugin name and the costmap,
and the plugin builds its own NodeHandle to read parameters. The only channel
left is the parameter tree, so copy the marker's keys into the planner's
namespace before the instance is built - the same shape as
Costmap2DROBOT::copyParentParameters() pouring parameters into each layer.

PlannerPort::bindDockingMarker() is called at the request gate, right before
swapPlanner(), because swapPlanner is where the instance is built and reads
its parameters. Copying afterwards would be a no-op: initialize() runs once.

- The destination is whatever global_planner the profile names, so a marker
  bound to a planner other than DockPlanner writes into that planner's
  namespace. Only DockPlanner reads footprint_dock today; the config
  documents that the value is inert elsewhere.
- The namespace is verified after construction. robot::NodeHandle silently
  falls back to its parent when a namespace does not resolve, so a mistyped
  marker would otherwise read footprint from ROOT - the robot footprint -
  and use it as the dock's size.
- The cached instance is rebuilt when the marker changes, and swapPlanner no
  longer short-circuits on an unchanged planner name, otherwise the second
  dock would run with the first dock's geometry. Rebuilds are skipped when
  the same marker is bound again.
- The replaced instance is retired rather than destroyed: the planner thread
  captures the active pointer and releases the mutex before calling into the
  plugin, so destroying it from the control thread is a use-after-free.

Add eight PlannerRunner tests. The test plugin now exports its initialize()
count and the footprint it read, which is the only way to observe from
outside that the rebuild actually happened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 21:53:12 +07:00
a2a2ea2829 optimal 2026-08-10 21:50:42 +07:00
65f8c7ce1c update 2026-08-10 17:20:30 +07:00
2b4c897015 fix file cmake 2026-08-10 12:15:04 +07:00
3e4dd22bbb fix file cmake 2026-08-10 11:39:11 +07:00
20ae52ea84 update 2026-08-09 19:17:02 +07:00
5375a9da9e update 2026-08-06 15:17:59 +07:00
701d25f952 optimal & fix file cmake 2026-08-03 22:41:32 +07:00
d8babff20b optimal 2026-07-30 09:24:47 +07:00