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.
75 lines
4.2 KiB
YAML
75 lines
4.2 KiB
YAML
# =================================================================================================
|
|
# Kho cảm biến THÔ dùng chung (`robot_sensor_ports`).
|
|
#
|
|
# Ai đọc file này: người cần cấp dữ liệu cảm biến cho một plugin — bộ dò dock, local planner học
|
|
# tăng cường — chứ không phải người tinh chỉnh costmap.
|
|
#
|
|
# Đây là đường THỨ HAI, chạy song song với đường vào costmap:
|
|
#
|
|
# host --> addLaserScan() --+--> kho (bản THÔ) <-- file này khai
|
|
# |
|
|
# +--> lọc SOR --> costmap <-- khối `sensors:` lo, khác hẳn
|
|
#
|
|
# Vì sao cần bản thô: costmap ở 0.05 m đã inflate và xoá mất thứ tự tia. Fit đường thẳng để bắt chữ
|
|
# V của trạm sạc thì hai cánh dài 0.2 m trên lưới đó chỉ còn là một cục — không dựng lại được.
|
|
#
|
|
# ► Quan trọng: kho KHÔNG lọc gì cả. Muốn lọc thì lọc trước khi đẩy vào. Bật `laser_sor_enabled`
|
|
# nghĩa là kho và costmap CỐ Ý nhìn hai bản khác nhau — costmap muốn bớt điểm nhiễu, bộ dò muốn
|
|
# hình dạng thật.
|
|
#
|
|
# Không khai topic nào (xoá khối này đi) là HỢP LỆ: không có consumer nào cần dữ liệu thô thì kho
|
|
# rỗng và im lặng, không tốn gì.
|
|
#
|
|
# Quy ước tên: khoá trỏ tới luồng cảm biến kết thúc bằng `_topic`; khoá trỏ tới frame TF kết thúc
|
|
# bằng `_frame`.
|
|
# =================================================================================================
|
|
|
|
sensor_store:
|
|
# [s] Chu kỳ in tình trạng kho ra terminal. 0 = tắt.
|
|
#
|
|
# ► Chỉnh: BẬT (3-5 s) khi chưa có consumer nào đọc kho — đó là lúc duy nhất không có cách nào
|
|
# khác để biết dữ liệu có vào tới nơi hay không, vì gõ sai `topic` và cảm biến chết cho CÙNG
|
|
# một triệu chứng. TẮT trên robot sản xuất: đây là log trong tiến trình điều khiển.
|
|
#
|
|
# Mỗi topic một dòng: Hz đo được, tuổi bản mới nhất, số bản đang giữ, số bản bị từ chối.
|
|
# Topic chưa từng nhận gì in ra cảnh báo NO DATA YET kèm nhắc kiểm tên.
|
|
report_period: 5.0
|
|
|
|
sensors:
|
|
# `topic` phải khớp CHÍNH XÁC chuỗi host truyền vào `addLaserScan(...)`. Dưới host ROS đó là tên
|
|
# topic ROS; dưới host .NET là chuỗi C# tự đặt.
|
|
# ► Chỉnh: gõ sai tên thì consumer chờ mãi không có gì, và triệu chứng GIỐNG HỆT cảm biến chết.
|
|
# Log lúc khởi động in ra danh sách topic kho đang giữ — đối chiếu ở đó.
|
|
- topic: /f_scan
|
|
# Tên ngắn hoặc đầy đủ đều được (`robot_sensor_msgs/LaserScan`). Sai tên -> từ chối LÚC BOOT.
|
|
data_type: LaserScan
|
|
|
|
# Số bản đọc giữ lại. 1 = chỉ bản mới nhất.
|
|
# ► Chỉnh: chỉ nâng khi có consumer cần nhiều frame liên tiếp kèm đúng dt (ví dụ observation
|
|
# xếp chồng của RL). Tốn bộ nhớ nhân theo KÍCH THƯỚC message: 5 scan là vài KB, nhưng 5 mẫu
|
|
# depth camera là hàng chục MB.
|
|
capacity: 1
|
|
|
|
# [s] Quá tuổi này thì consumer phải coi bản đọc là stale.
|
|
# ► Chỉnh: đặt ~2-3 lần chu kỳ publish của cảm biến (lidar 15 Hz -> 0.13-0.2 s; để 0.5 s là
|
|
# rộng rãi). Ngắn quá thì jitter làm dữ liệu tốt bị chê oan; dài quá thì robot hành động
|
|
# theo thứ đã cũ.
|
|
max_age: 0.5
|
|
|
|
- topic: /b_scan
|
|
data_type: LaserScan
|
|
capacity: 1
|
|
max_age: 0.5
|
|
|
|
# --- Ví dụ, đang TẮT ---------------------------------------------------------------------------
|
|
# Mở ra khi có consumer thật sự đọc. ⚠ MỘT mẫu depth đã hàng MB — đừng nâng `capacity` mà chưa đo.
|
|
# - topic: /camera/depth/data
|
|
# data_type: DepthCameraData
|
|
# capacity: 1
|
|
# max_age: 0.3 # [s] depth chậm hơn lidar, nhưng dữ liệu cũ thì nguy hơn
|
|
#
|
|
# - topic: /camera/depth/points_proc
|
|
# data_type: PointCloud2
|
|
# capacity: 1
|
|
# max_age: 0.4
|