feat: add entry_direction and derive an upside-down lidar from TF

The charger goal heading always pointed out of the station, so only robots
that reverse onto the charger were supported. Front-charging robots now set
`entry_direction: forward` (goal yaw + pi, position unchanged) together with
a front `scan_topic`. The default stays `backward`, so existing configs keep
their behaviour.

Once per run the handler looks up base_link <- scan frame and:
- fails the action if the scan plane is tilted more than 5 deg;
- fails the action if the lidar faces the side opposite to entry_direction,
  instead of writing a reversed goal;
- mirrors the bearings when the lidar is mounted upside down (roll pi),
  as the trolley handler does. No config key is needed for that.

Tests: forward vs backward, direction mismatch, upside-down V / taped V /
arc, tilted scan plane, invalid entry_direction.
This commit is contained in:
2026-11-10 15:06:00 +07:00
parent 5bbcf37f1d
commit c125bd069c
5 changed files with 287 additions and 9 deletions

View File

@@ -5,6 +5,18 @@ Handler dò trạm dock từ **scan LiDAR thô**, nạp qua Boost.DLL như mọi
Đây là tầng **adapter**, và là chỗ duy nhất trong chuỗi dò được phép biết tới TF, action và kho cảm
biến.
## Hướng vào trạm và cách gắn LiDAR
`entry_direction: backward` (mặc định) dùng LiDAR nhìn phía sau: robot lùi vào, heading goal
hướng ra khỏi trạm. `forward` dùng LiDAR nhìn phía trước: robot tiến vào, heading goal hướng vào
trạm. Đổi `scan_topic` sang LiDAR cùng phía khi đổi hướng. Handler kiểm tra TF từ frame scan tới
`robot_base_frame`; sai phía hoặc mặt phẳng scan nghiêng quá 5° làm action fail, không ghi goal.
Nếu LiDAR lộn ngược, handler tự nhận từ TF và phản chiếu bearing, không cần cấu hình flip.
Vị trí goal và `offset_x`, `offset_y`, `offset_yaw` vẫn tính trong hệ hình: trục x hướng từ đỉnh
ra phía robot, y sang trái hệ hình. Với `forward`, `offset_y` dương tương ứng phía phải robot khi
robot hướng vào trạm. Các phép kiểm TF và hình học cần được xác nhận với robot và scan thực tế.
## Chuỗi bốn tầng
```