0
$\begingroup$

I'm experiencing an issue in my stack when I add the Collision Monitor and can't understand what exactly the problem is. When the project is launched I get this error:

[lifecycle_manager-18] [INFO] [1753275760.521085946] [lifecycle_manager]: Configuring /boomer_1/collision_monitor [collision_monitor-17] [INFO] [1753275760.522109107] [boomer_1.collision_monitor]: Configuring [collision_monitor-17] [ERROR] [1753275760.534541415] [boomer_1.collision_monitor]: Error while getting parameters: parameter 'observation_sources' is not initialized [collision_monitor-17] [INFO] [1753275760.534667625] [boomer_1.collision_monitor]: Cleaning up [lifecycle_manager-18] [ERROR] [1753275760.542115060] [lifecycle_manager]: Failed to change state for node: /boomer_1/collision_monitor [lifecycle_manager-18] [ERROR] [1753275760.542187257] [lifecycle_manager]: Failed to bring up all requested nodes. Aborting bringup. 

It's complaining about observation_sources not being initialized (whatever that means). My full configuration for the collision monitor is as follows:

collision_monitor: ros__parameters: base_frame_id: boomer_1/base_link odom_frame_id: boomer_1/odom cmd_vel_in_topic: /boomer_1/cmd_vel cmd_vel_out_topic: /boomer_1/cmd_vel_smoothed state_topic: /boomer_1/collision_monitor_state transform_tolerance: 0.5 source_timeout: 5.0 base_shift_correction: true stop_pub_timeout: 2.0 enable_stamped_cmd_vel: false use_realtime_priority: false polygons: [PolygonSlow] PolygonSlow: {enabled: true, type: polygon, points: '[[1.0, 1.0], [1.0, -1.0], [-0.5, -1.0], [-0.5, 1.0]]', action_type: slowdown, min_points: 4, slowdown_ratio: 0.3, visualize: true, polygon_pub_topic: /boomer_1/polygon_slowdown} observation_sources: [scan] scan: {type: scan, topic: /boomer_1/lidar} 

That is the output of the YAML that is being passed to the collision monitor process, as shown in this ps output:

ros2 8470 1.4 0.1 662448 26620 pts/0 Sl+ 14:17 0:00 /opt/ros/jazzy/lib/nav2_collision_monitor/collision_monitor --ros-args -r __node:=collision_monitor -r __ns:=/boomer_1 --params-file /home/ros2/install/boomer_bridge/share/boomer_bridge/params/nav2_collision_monitor_boomer_1.yaml -r /tf:=/boomer_1/tf -r /tf_static:=/boomer_1/tf_static 

I can't fully understand what is this initialization that is referring to, I have checked the examples and the documentation from: Using Collision Monitor and can't see anything wrong in my config file.

You might notice that my scan topic is actually: /boomer_1/lidar and that is correct as I'm using a namespaced robot (in the examples and docs that topic is simply scan, but I'm confident that that is not the source of the problem). As stated above, my stack works perfectly fine without the Collision Monitor enabled.

Any help, greatly appreaciated.

Thanks, Lucas.

$\endgroup$

1 Answer 1

0
$\begingroup$

I think the data type you have given is wrong type.

collision_monitor: ros__parameters: enabled: True base_frame_id: "base_footprint" odom_frame_id: "odom" cmd_vel_in_topic: "cmd_vel_smoothed" cmd_vel_out_topic: "cmd_vel" transform_tolerance: 0.5 source_timeout: 5.0 stop_pub_timeout: 2.0 enable_stamped_cmd_vel: True # False for Jazzy or older by default polygons: ["PolygonStop", "PolygonSlow"] PolygonStop: type: "polygon" points: "[[0.4, 0.3], [0.4, -0.3], [0.0, -0.3], [0.0, 0.3]]" action_type: "stop" min_points: 4 # max_points: 3 for Humble visualize: True polygon_pub_topic: "polygon_stop" PolygonSlow: type: "polygon" points: "[[0.6, 0.4], [0.6, -0.4], [0.0, -0.4], [0.0, 0.4]]" action_type: "slowdown" min_points: 4 # max_points: 3 for Humble slowdown_ratio: 0.3 visualize: True polygon_pub_topic: "polygon_slowdown" observation_sources: ["scan"] scan: type: "scan" topic: "scan" 

add " " for the string data type in your configuration. compare and change the parameters value with the correct notation. For me i received this error for the polygon.points when i launched

[collision_monitor-1] [ERROR] [1708621702.748142324] [collision_monitor]: [PolygonStop]: Error while getting polygon parameters: parameter 'PolygonStop.points' has invalid type: Wrong parameter type, parameter {PolygonStop.points} is of type {double_array}, setting it to {string} is not allowed. 

so i modified the points like this

points: [0.4, 0.3, 0.4, -0.3, 0.0, -0.3, 0.0, 0.3] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.