Robotics StackExchange | Archived questions

pointcloud scan not working in move base

I am using range data and laserscan data in my move base param. Here what i found is that when i use the laserscan data from rplidar directly move base working fine. But when i use the laserscan being converted from point cloud to laserscan package, it is not working in move base. Also if i only use the pointcloud scan only in move base without range data it works fine. Here are config files.

common_costmap_param.config

robot_radius: 0.35

inflation_layer:
  inflation_radius: 1.0
  cost_scaling_factor: 5.0

obstacle_layer:
  max_obstacle_height: 0.80
  obstacle_range: 2.0
  raytrace_range: 2.5
  map_type: costmap

  observation_sources: scan
  scan: {sensor_frame: camera_depth_virtual_frame, data_type: LaserScan, topic: depth/scan_filtered, marking: true, clearing: true}

range_sensor_layer:
  clear_threshold:    0.46
  mark_threshold:     0.98
  clear_on_max_reading: true
  topics: ["/ultrasonic/ir_back"]

local_costmap_param.config:
local_costmap:
  global_frame: map
  robot_base_frame: base_footprint

  update_frequency: 5.0
  publish_frequency: 2.0
  transform_tolerance: 0.5  

  static_map: false  
  rolling_window: true
  width: 4.5
  height: 4.5
  resolution: 0.05

  plugins:
  - {name: range_sensor_layer,   type: "range_sensor_layer::RangeSensorLayer"}
  - {name: obstacle_layer,  type: "costmap_2d::ObstacleLayer"}
  - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

globalcostmapparam.yaml:

global_costmap:
  global_frame: map
  robot_base_frame: base_footprint

  update_frequency: 1.0
  publish_frequency: 0.5
  transform_tolerance: 0.5

  static_map: true

  plugins: 
    - {name: static_layer,    type: "costmap_2d::StaticLayer"}
    - {name: obstacle_layer,  type: "costmap_2d::ObstacleLayer"}
    - {name: range_sensor_layer,   type: "range_sensor_layer::RangeSensorLayer"}
    - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

point cloud to scan param:

<?xml version="1.0"?>

<launch>
    <!-- run pointcloud_to_laserscan node -->
    <node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan">

        <remap from="cloud_in" to="camera/depth/points"/>
        <remap from="scan" to="depth/scan_filtered"/>
        <rosparam>
            target_frame: camera_depth_virtual_frame # Leave disabled to output scan in pointcloud frame
            transform_tolerance: 0.01
            min_height: -1
            max_height: 1

            angle_min: -1.5708 # -M_PI/2
            angle_max: 1.5708 # M_PI/2
            angle_increment: 0.0087 # M_PI/360.0
            scan_time: 0.3333
            range_min: 0.45
            range_max: 5
            use_inf: false

            # Concurrency level, affects number of pointclouds queued for processing and number of threads used
            # 0 : Detect number of cores
            # 1 : Single threaded
            # 2->inf : Parallelism level
            concurrency_level: 1
        </rosparam>

    </node>

</launch>

Here when i feed the both scan from point cloud to scan filter and range sensor only costmap from range data is working. And if i only use scan from ponit cloud scan filter it works fine.

Here is the rviz screenshot: Here the organge represents the scan data converted from point cloud to laserscan converter which is correct. image description

Here is the gazebo screenshot: image description

Here is the node graph: image description

Here is the tf graph: image description

Here is the demonstration of all the working, i've also captured the rviz window in it.

Asked by dinesh on 2021-11-23 09:39:57 UTC

Comments

Have you checked the actual puslished topic data depth/scan_filtered as well as the pointcloud topic, do they contain the correct data? What sensors are you using rplidar direct scan output is what to use. Where does the pointcloud come from, rgbd-camera? At which z height are the sensors mounted. pointcloud_to_laserscan "target_frame" really of any use, nessesary?

Asked by Dragonslayer on 2021-11-23 10:24:39 UTC

Yes i have checked them it is comming well. When i remove the range data from move_base move_base works well with only depth/scan_filtered.

Asked by dinesh on 2021-11-23 23:48:41 UTC

I've updated the questions with screenshot of gazebo, rviz, tf tree and nodes.

Asked by dinesh on 2021-11-24 00:08:57 UTC

Thanks for the update. So in the rviz picture, there is a laserscan but it isnt inflated is the issue? It seems your camera is in the head, but you have a max obstacle hight of only 0.8 meters. Might it be ignoring those scans because they are projected above that threshold?

Asked by Dragonslayer on 2021-11-24 06:50:03 UTC

Answers

After playing lot with costmap parameters and correcting the costmap parameters both the range sensor and laserscan is working properly in move base. Here is the latest costmap param:

footprint: [[-0.25,-0.25],[-0.25,0.25],[0.37,0.25],[0.37,-0.25]]
footprint_padding: 0.05

inflation_layer:
  inflation_radius: 1.0
  cost_scaling_factor: 100.0

obstacle_layer:
  obstacle_range: 3.0
  raytrace_range: 3.5

  map_type: costmap
  observation_sources: scan
  scan: {sensor_frame: base_scan, data_type: LaserScan, topic: depth/scan_filtered, marking: true, clearing: true}

local_costmap:

local_costmap:
  global_frame: odom
  robot_base_frame: base_footprint

  update_frequency: 10.0
  publish_frequency: 10.0
  transform_tolerance: 0.5  

  static_map: false  
  rolling_window: true
  width: 5
  height: 5
  resolution: 0.05

  plugins:
    - {name: range_sensor_layer,   type: "range_sensor_layer::RangeSensorLayer"}
    - {name: obstacle_layer,  type: "costmap_2d::ObstacleLayer"}
    - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

  range_sensor_layer:
    clear_on_max_reading: true
    topics: ["/ultrasonic/ir_front", "/ultrasonic/ir_front_right", "/ultrasonic/ir_front_left", "/ultrasonic/ir_right", "/ultrasonic/ir_left"]

global_costmap:

global_costmap:
  global_frame: map
  robot_base_frame: base_footprint

  update_frequency: 10.0
  publish_frequency: 10.0
  transform_tolerance: 0.5

  static_map: true

  plugins:
    - {name: static_layer,    type: "costmap_2d::StaticLayer"}
    - {name: range_sensor_layer,   type: "range_sensor_layer::RangeSensorLayer"}
    - {name: obstacle_layer,  type: "costmap_2d::ObstacleLayer"}
    - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

  range_sensor_layer:
    clear_on_max_reading: true
    topics: ["/ultrasonic/ir_front", "/ultrasonic/ir_front_right", "/ultrasonic/ir_front_left", "/ultrasonic/ir_right", "/ultrasonic/ir_left"]

Here what i was missing was i only added the inflation_layer and obstacle_layer which was not defined previously.

Asked by dinesh on 2021-11-24 23:15:41 UTC

Comments

Nice that its working now. But your config files show the layers. Was the issue in the launch files or did you use different costmap config files for different setups(pointcloudtolaserscan vs. rplidar scan, etc.)?

Asked by Dragonslayer on 2021-11-25 07:50:11 UTC

Yes very nice. Thank you for sharing. I followed the question. Same question as @Dragonslayer

Don’t forget to accept your answer :)

Asked by osilva on 2021-11-25 08:06:32 UTC