Files
move_base2/launch/move_base2_control.launch
duongtd f4f99650df feat: tiep nhan route graph (Voronoi) cho global planner + anytime ARA* schema, don doc EnvMonitor
- navigation_server: them addRouteGraph(topic, RouteGraph), day vao sensor_store cung namespace
  addStaticMap; consumer (SBPLLatticePlanner) tu doi chieu map_hash.
- PlannerRunner: them setSensorReader()/attachSensors() - trao SensorReader cho global planner
  nao ke thua robot_sensor_ports::SensorConsumer, goi TRUOC initialize() (dynamic_cast, giong co
  che ControllerRunner dang dung).
- sensor_store_params.yaml: khai topic /route_graph (data_type RouteGraph, capacity 1).
- sbpl_global_params.yaml (config/runtime): dong bo schema initial_epsilon/final_epsilon/
  eps_step/repair_time/return_first_solution + khoi voronoi_corridor (xem pnkx_nav_core
  c52cbe5, Test/sbpl_lattice_planner cho code doc cac khoa nay).
- launch: them arg launch_prefix (vd "stdbuf -oL" - robot::log_* dung printf khong flush, qua
  `| tee` bi block-buffer 8 KB lam log dung o dong cu du node con chay); them
  route_graph_maps_dir/route_graph_topic cho amr_node doc file voronoi.json theo map dang kich hoat.
- docs: xoa PLAN_LIFECYCLE_CANCEL_PAUSE_RESUME.md (don sang Test/docs/move_base2/), sua duong dan
  ENV_MONITOR_PLAN.md trong comment cac header EnvMonitor lien quan.
2026-09-22 15:31:43 +07:00

103 lines
6.9 KiB
XML

<?xml version="1.0"?>
<!--
Nav stack chạy trên move_base2. Bản độc lập, viết theo mẫu `amr_startup/launch/amr_control.launch`
nhưng KHÔNG include nó — để đổi thứ gì ở đây cũng không đụng vào đường chạy của move_base cũ.
Khác biệt so với bản gốc đúng hai chỗ:
1. `PNKX_NAV_CORE_CONFIG_DIR` trỏ vào cây overlay của move_base2 (xem config/runtime/README).
2. Không cần `export` thủ công nữa — launch tự đặt.
Mọi tham số PHÍA ROS (footprint, costmap, localization, mqtt) vẫn đọc từ `amr_startup/config`,
đúng như bản gốc: đó là cây config của phía ROS, không phải của nav core.
-->
<launch>
<arg name="robot_type" default="T800" doc="T800 | imr | hook_150 | APM" />
<arg name="local_planner" default="pnkx" doc="dwa | dwb | eband | base | teb | pose | pnkx" />
<arg name="global_planner" default="custom" doc="sbpl | two_points | custom" />
<arg name="global_plan_msg_type" default="vda5050_msgs::Order" doc="nav_msgs::Path | vda5050_msgs::Order" />
<arg name="primitive_filename" default="$(find amr_startup)/config/mprim/unicycle_highcost_5cm.mprim" />
<arg name="prefix" default="" doc="Prefix cho tf frame của robot" />
<!-- Bọc lệnh chạy node. robot::log_* in bằng printf không flush: đi qua pipe (`| tee`) thì stdout bị
block-buffer 8 KB, log dừng ở dòng cũ dù node vẫn chạy. Soi log lúc treo/chậm thì đặt
launch_prefix:="stdbuf -oL" (từng dòng); gdb: "gdb -ex run -args". Rỗng = như cũ. -->
<arg name="launch_prefix" default="" doc="vd. 'stdbuf -oL' để stdout ra từng dòng khi tee" />
<!--
ĐIỂM KHÁC BIỆT DUY NHẤT của cả đường chạy: nav core đọc config từ đây.
Cây overlay là file thật (không symlink), tự đủ khi clone repo lẻ. Bốn file riêng của
move_base2: move_base_common_params.yaml (`MoveBase: library_path: libmove_base2`),
action_handlers_params.yaml, compound_actions_params.yaml, maker_sources.yaml. Số còn lại là
bản sao của `pnkx_nav_core/config/` và KHÔNG tự đồng bộ — xem launch/README.md.
-->
<env name="PNKX_NAV_CORE_CONFIG_DIR" value="$(find move_base2)/config/runtime" />
<param name="rosconsole_config_file" value="$(find amr_startup)/rosconsole.config" />
<!-- subst_value: mqtt_general.yaml dung $(find amr_startup) cho duong dan factsheet -->
<rosparam file="$(find amr_startup)/config/mqtt_general.yaml" command="load" subst_value="true" />
<node pkg="amr_control" type="amr_control_node" respawn="false" name="amr_node" output="screen" clear_params="true"
launch-prefix="$(arg launch_prefix)">
<rosparam param="footprint" if="$(eval robot_type == 'imr')">
[[0.412, -0.304], [0.412, 0.304], [-0.412, 0.304], [-0.412, -0.304]]
</rosparam>
<rosparam param="footprint" if="$(eval robot_type == 'hook_150')">
[[0.511,-0.1955],[0.511,0.1955],[-0.511,0.1955],[-0.511,-0.1955]]
</rosparam>
<rosparam param="footprint" if="$(eval robot_type == 'T800')">
[[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]]
</rosparam>
<rosparam param="footprint" if="$(eval robot_type == 'APM')">
[[1.65,-0.4],[1.65,0.4],[-0.35,0.4],[-0.35,-0.4]]
</rosparam>
<param name="primitive_filename" value="$(arg primitive_filename)" />
<param name="global_plan_msg_type" value="$(arg global_plan_msg_type)" />
<!-- Nguồn dữ liệu depth vào costmap. Hai chế độ, KHÔNG tương đương nhau:
true = SensorConverter tự subscribe ảnh depth thô của CẢ HAI camera rồi tự dựng đám mây.
Nuôi đủ `/camera/depth/points_proc` lẫn `/camera_right/depth/points_proc`.
false = chờ node robot_depth_image_proc publish đám mây sẵn. Node đó đang cấu hình MỘT
camera, và nhánh này của SensorConverter cũng chỉ subscribe MỘT topic — nên buffer
camera phải không bao giờ được nạp, costmap stale vĩnh viễn, robot đứng im từ
giây đầu (quan sát ngày 28/8: buffer phải tăng đơn điệu tới 8.7 s).
► Muốn dùng false thì phải làm ĐỦ hai việc: cấu hình depth_image_proc cho 2 camera, VÀ
thêm subscriber camera phải vào nhánh else của SensorConverter. -->
<param name="use_depth_image_input" value="true" />
<!-- Số luồng phục vụ queue cảm biến riêng của SensorConverter (tách khỏi ros::spin() toàn cục,
nơi có timer phát cmd_vel 20 Hz). 1 = tuần tự như cũ nhưng vẫn tách queue. -->
<param name="sensor_spinner_threads" value="4" />
<!-- Route graph (Voronoi) biên dịch sẵn, SensorConverter đẩy vào nav core ngay sau /map
(`addRouteGraph`). Thư mục map hiện hành = <route_graph_maps_dir>/<tên trong
activated_map.txt>/ — cùng quy ước với loc_base; file cần có là voronoi.json (sinh bằng
voronoi_route_compile, đã có cho sehc_factory). Không có file = planner chạy full như cũ.
Consumer: SBPLLatticePlanner, khối `voronoi_corridor` trong sbpl_global_params.yaml của
cây config/runtime; khoá kho `/route_graph` khai trong sensor_store_params.yaml.
route_graph_dir (nếu đặt) chỉ đích danh một thư mục, bỏ qua activated_map.txt. -->
<param name="route_graph_maps_dir" value="$(find managerments)/maps" />
<param name="route_graph_topic" value="/route_graph" />
<!-- maker_sources is loaded by robot::NodeHandle from this launch's move_base2 runtime
overlay. Do not also load amr_startup's legacy copy: its contents diverge. -->
<rosparam file="$(find amr_startup)/config/move_base_common_params.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/$(arg global_planner)_global_params.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/$(arg local_planner)_local_planner_params.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/costmap_common_params.yaml" command="load" ns="global_costmap" subst_value="true" />
<rosparam file="$(find amr_startup)/config/costmap_global_params.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/costmap_global_params_plugins_no_virtual_walls.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/costmap_common_params.yaml" command="load" ns="local_costmap" subst_value="true" />
<rosparam file="$(find amr_startup)/config/costmap_local_params.yaml" command="load" subst_value="true" />
<rosparam file="$(find amr_startup)/config/costmap_local_params_plugins_no_virtual_walls.yaml" command="load" />
<rosparam file="$(find amr_startup)/config/localization.yaml" command="load" />
<remap from="map" to="/map" />
<remap from="marker" to="move_base_node/markers" />
</node>
</launch>