# Unable to clear traces of obstacles on costmap

Hi all,

I am having problems with my RPLidar and Costmap obstacle and inflation layer. When I first launch the file and RViz, the inflation and obstacles seem to inflate well. However, when I start rotating the sensor, there seems to be a trace left behind it and it only starts disappearing at a certain time after. If there is an obstacle moving directly towards the sensor from the front, it seems that the trace behind the obstacle gets longer and longer. This can be seen in the screenshot provided.

(I was rotating my sensor in a clockwise direction, which leaves a trace on the left of the laserscan, the trace is cleared only when i rotate it in the other direction, with the laserscan 'clearing' the traces)

I have tried several solutions online and have also played with the parameters such as raytrace, set inf_is_valid to true, modified the offset in the costmap_2d.h file as mentioned in this link. I have also tried to ensure the sensor range is below the maximum range of my sensor. However, none of them seem to be working.

Are there any other possible solutions to this issue or am I missing out some parameter?

my example_params.yaml file:

global_frame: map

plugins:
- {name: static_map, type: "costmap_2d::StaticLayer"}
- {name: obstacles,  type: "costmap_2d::ObstacleLayer"}
- {name: inflation,  type: "costmap_2d::InflationLayer"}

update_frequency: 10.0
publish_frequency: 10.0

#set if you want the voxel map published
publish_voxel_map: false

#set to true if you want to initialize the costmap from a static map
static_map: false

#begin - COMMENT these lines if you set static_map to true
rolling_window: true
width: 5.0
height: 5.0
resolution: 0.025
#end - COMMENT these lines if you set static_map to true

transform_tolerance: 0.2
obstacle_range: 2.0
max_obstacle_height: 2.0
raytrace_range: 3.0
footprint: [[-0.1025, -0.1025], [-0.1025, 0.1175], [0.1025, 0.1175], [0.1025, -0.1025]]

obstacles:
inf_is_valid: true
observation_sources: scan
scan: {data_type: LaserScan, sensor_frame: base_link, marking: true, clearing: true, topic: scan, observation_persistance: 10.0}

inflation:
cost_scaling_factor: 10.0
lethal_cost_threshold: 100


my costmap_2D.launch

<launch>

<arg name="map_file" default="$(find launch_files)/map/mapAS.yaml"/> <!-- Map server --> <node pkg="map_server" name="map_server" type="map_server" output="screen" args="$(arg map_file)"/>

<param name="/use_sim_time" value="false"/>

<!-- Run the costmap node -->
<node name="costmap_node" pkg="costmap_2d" type="costmap_2d_node" >
<rosparam file="$(find launch_files)/params/example_params.yaml" command="load" ns="costmap" /> </node> <!-- RVIZ --> <node name="rviz" pkg="rviz" type="rviz" args="-d$(find launch_files)/rviz/prototype6.rviz" />

<!-- RPLidar -->

<node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
<param name="serial_port"         type="string" value="/dev/rplidar"/>
<param name="serial_baudrate"     type="int"    value="115200"/><!--A1/A2 -->
<!--param name="serial_baudrate"     type="int"    value="256000"--><!--A3 -->
<param name="frame_id"            type="string" value="laser"/>
<param name="inverted"            type="bool"   value="false"/>
<param name="angle_compensate"    type="bool"   value="true"/>
</node>

<node pkg="tf" type="static_transform_publisher" name="base_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 100"/>

<node pkg="tf" type ...
edit retag close merge delete