Costmap_2d does not subscribe to LaserScan or PointCloud topic
Hello everyone! I will illustrate the project: I would build a local 2D costmap from a .bag file that contains 3D LIDAR point clouds in the topic /velodyne_points . I would do this task without any further mapping stage (no gmapping or similar), but I want just to obtain a local 2D cost map with inflated areas around obstacles, by using the costmap_2D package. Thus, after having processed the raw point_cloud with some custom nodes, I can obtain a point cloud from the ground (topic: /filtered_points_no_ground) and a laser scan topic (topic: /laserscan). Both of the topic are published wrt to the velodyne tf that is connected to odom by declaring this command "rosrun tf static_transform_publisher 0 0 0 0 0 0 odom velodyne 100".
The problem is that costmap_2d does not subscibe to any of the two topics I would have to provide (laser scans or filtered point cloud). Therefore, I can obtain only a blank output as I do "rostopic echo /costmap/voxel_grid" after launching the costmap_2D node with: roslaunch costmap_2d example.launch .
I attach here the .yaml file and the .launch file for the task I have described.
example_params.yaml
costmap:
global_frame: velodyne
robot_base_frame: base_link
rolling_window: true
static_map: false
resolution: 0.05
publish_frequency: 0.1
update_frequency: 0.1
plugins:
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
footprint: [[0.5,0.5],[0.5,-0.5],[-0.5,-0.3],[-0.5,0.5]]
raytrace_range: 15.0
obstacle_range: 20.0
inflation_layer:
enabled: true
cost_scaling_factor: 5.0
inflation_radius: 0.5
obstacle_layer:
enabled: true
max_obstacle_height: 1.5
track_unknown_space: false
obstacle_range: 25
raytrace_range: 30.0
origin_z: 0.0
publish_voxel_map: false
observation_sources: velodyne
velodyne: {sensor_frame: velodyne, data_type: PointCloud2, topic: filtered_points_no_ground, marking: true, clearing: true, expected_update_rate: 0.1, min_obstacle_height: 0.0, max_obstacle_height: 1.5}
(in the case I use the laser scans, I would write this:
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: velodyne, data_type: LaserScan, topic: laserscan, marking: true, clearing: true, expected_update_rate: 0.1, min_obstacle_height: 0.0, max_obstacle_height: 1.5}
)
example.launch
<launch>
<param name="/use_sim_time" value="true"/>
<!-- Publishes the voxel grid to rviz for display -->
<node pkg="costmap_2d" type="costmap_2d_markers" name="voxel_visualizer">
<remap from="voxel_grid" to="costmap/voxel_grid"/>
</node>
<!-- Run the costmap node -->
<node name="costmap_node" pkg="costmap_2d" type="costmap_2d_node" >
<rosparam file="$(find costmap_2d)/launch/example_params.yaml" command="load" ns="costmap" />
</node>
</launch>
How can I solve this problem? I also tried to check with "rostopic info" on the subscription of the topics but laserscan topic or filtered_points_no_ground are not subscribed. Additional information: Hardware: nVidia Jetson Xavier computing platform; Ubuntu 18.04; ROS: Melodic
Thanks.