ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

laser scan not being used for costmap

asked 2019-11-08 01:13:38 -0600

logan.ydid gravatar image

updated 2019-11-13 13:33:36 -0600

Hi All,

I have a robot with a kinect sensor and a traditional lidar. The lidar is able to see 360 degrees around the robot at a height of 2 meters off the ground. the kinect is on the front of the robot at about 0.5 meters off the ground. i have recently switched to using the kinect to create a voxel grid in the costmap using spatio_temporal_voxel_layer. However, now its not using the laser anymore so sometimes itll back into things. I would like for it to use the laser and the voxel layer in the global costmap. Any tips in achieving this?

launch file

<?xml version="1.0"?>
    <param name="robot_description" textfile="$(find navigation)/src/urdf/testbot_revised(Suzi) laser added.urdf"/>
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
<!-- Start the laser stuff -->
    <include file="$(find navigation)/src/launch/connect_kinnect_no_scan.launch"/>
    <include file="$(find rplidar_ros)/launch/rplidar.launch"/>
<!-- Start rosbridge for javascript comms -->
    <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/>

    <include file="$(find diff_drive)/src/launch/run_diff_drive.launch"/>
    <include file="$(find arduino_comm)/src/launch/run_arduino_comms.launch"/>
    <node name="map_server" pkg="map_server" type="map_server" args="$(find navigation)/src/maps/SD_room_dual_laser_low_rez.yaml"/>
    <node pkg="amcl" type="amcl" name="amcl" output="screen">
      <param name="min_particles" value="250"/>
      <param name="max_particles" value="500"/>
    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
        <rosparam file="$(find navigation)/src/costmap_common_params.yaml" command="load" ns="global_costmap" />
        <rosparam file="$(find navigation)/src/costmap_common_params.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find navigation)/src/local_costmap_params.yaml" command="load" />
        <rosparam file="$(find navigation)/src/global_costmap_params.yaml" command="load" />
        <!--rosparam file="$(find navigation)/src/base_local_planner_params.yaml" command="load" /-->
        <rosparam file="$(find navigation)/src/dwa_local_planner_params.yaml" command="load" />

        <param name="planner_frequency" value="5"/>
        <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS"/>



global costmap params

  global_frame: map
  robot_base_frame: base_link
  static_map: true
  transform tolerance: 0.5
  width: 20
  height: 20
  origin_x: -5
  origin_y: -5
  resolution: 0.15
  publish_frequency: 1
  update_frequency: 1.0
  - {name: static_layer,            type: "costmap_2d::StaticLayer"}
  - {name: rgbd_obstacle_layer, type: "spatio_temporal_voxel_layer/SpatioTemporalVoxelLayer"}
  - {name: inflation_layer,   type: "costmap_2d::InflationLayer"}
  - {name: obstacle_layer,          type: "costmap_2d::VoxelLayer"}

local costmap params

  global_frame: odom
  robot_base_frame: base_link
  rolling_window: true
  static_map: false
  resolution: 0.15
  publish_frequency: 1
  update_frequency: 5.0
  - {name: rgbd_obstacle_layer, type: "spatio_temporal_voxel_layer/SpatioTemporalVoxelLayer"}
  - {name: inflation_layer,   type: "costmap_2d::InflationLayer"}

common costmap params

footprint: [[0.3,0.2],[0.3,-0.2],[-0.4,-0.2],[-0.4,0.2]]
raytrace_range: 3.0
obstacle_range: 2.5
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: camera_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}

  enabled:               true
  voxel_decay:           30     #seconds if linear, e^n if exponential
  decay_model:           0      #0=linear, 1=exponential, -1=persistent
  voxel_size:            0.1   #meters
  track_unknown_space:   true   #default space is unknown
  observation_persistence: 0.0  #seconds
  max_obstacle_height:   2.0    #meters
  unknown_threshold:     15     #voxel height
  mark_threshold:        0      #voxel height ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-11-09 04:15:50 -0600

parzival gravatar image

In your common costmap params file, you've only listed one sensor:

observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: camera_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}

If you're publishing depthimage as laser scan on /scan topic, then only the kinect will be taken into account.

Basically you need to write down both point_cloud sensor (kinect) and laser_scan sensor (lidar) in the file. Something like this:

observation_sources: laser_scan_sensor point_cloud_sensor

laser_scan_sensor: {sensor_frame: frame_name, data_type: LaserScan, topic: topic_name, marking: true, clearing: true}

point_cloud_sensor: {sensor_frame: frame_name, data_type: PointCloud, topic: topic_name, marking: true, clearing: true}
edit flag offensive delete link more


Thank you so much for your reply! i implemented your suggestions but im still not seeing the laser scan in my local costmap. ill update the info in my question.

logan.ydid gravatar image logan.ydid  ( 2019-11-13 13:22:08 -0600 )edit

I think the observations sources should be on the obstacle_layer namespace, something like

    - {name: obstacle_layer,        type: "costmap_2d::VoxelLayer"}
    observation_sources: laser_scan_sensor
    laser_scan_sensor: {sensor_frame: camera_link, data_type: LaserScan, topic: scan, marking: true, clearing: true}

Also, make sure the topic and frames are correct, I mean, that there are not previous namespaces or something added to the topic name.


Mario Garzon gravatar image Mario Garzon  ( 2019-11-14 04:03:04 -0600 )edit

@logan.ydid I've attached the code in the answer above as per navigation wiki. Are you sure you added both laser_scan_sensor and point_cloud_sensor as written above in the answer?

parzival gravatar image parzival  ( 2019-11-14 04:52:47 -0600 )edit

You've defined laser_scan_sensor and point_cloud_sensor as observation sources, but later changed the name to obstacle_layer. Maybe that's what is causing trouble.

parzival gravatar image parzival  ( 2019-11-14 04:57:35 -0600 )edit

Hey @parzival i am facing the same issue on my setup and i have done everything that you have mentioned here in the comments and answer. Any help is appreciated.

cryptichead gravatar image cryptichead  ( 2022-03-02 04:12:43 -0600 )edit

Question Tools



Asked: 2019-11-08 01:13:38 -0600

Seen: 1,216 times

Last updated: Nov 13 '19