Global and local costmap are shifted in relation to the map mapped by gmapping
Dear friends,
I have the following problem where I would love to get any hint that leads me to a solution. First of all here are my tech specs:
- ROS melodic with Stage 4.3 simulation
- Ubuntu 5.4.0-65.73~18.04.1-generic 5.4.78
- Environment variables ROS_ETC_DIR=/opt/ros/melodic/etc/ros ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311 ROS_VERSION=1 ROS_PYTHON_VERSION=2 ROS_PACKAGE_PATH=/home/emanuel/rccar_ws/src:/home/emanuel/testnav_ws/src:/home/emanuel/floribot_ws/src/base:/home/emanuel/floribot_ws/src/plc_connection:/opt/ros/melodic/share ROSLISP_PACKAGE_DIRECTORIES=/home/emanuel/rccar_ws/devel/share/common-lisp:/home/emanuel/testnav_ws/devel/share/common-lisp:/home/emanuel/floribot_ws/devel/share/common-lisp ROS_DISTRO=melodic
I am running a ROS Stage simulation with a differential drive robot equipped with a laser scanner and odometry. The robot is to pass through a corn field. It does not know the area at the beginning but is given an empty map that is dynamically builds up as the robot proceeds. The navigation stack is set up as described in http://wiki.ros.org/navigation/Tutori... with some modifications. I am using the following planners:
- global planner: A self written
planner that simply returns the goal
which yields to a straight line from
the current position to the goal not
depending on any costmap
- local planner: DWAPlannerROS
Now to my question: When I am sending navigation goals to the robot it can follow and reach them eventually. But I have noticed that almost every time the global and local costmap are shifted and do not match the map mapped by gmapping. Thus, the costs in the costmaps which are indicating an obstacle (here: corn plant) do not sit directly at the mapped obstacles but are shifted as it can be seen in the picture. This leads to a very unstable navigation: Sometimes the robot can reach its given goals but sometimes not. What can I change to have the costmaps lay perfectly onto the mapped map?
Unfortunately I do not have enough points to include a picture - therefore I uploaded it to this page: https://ibb.co/yXGFzqj
I appreciate any hint that could help me fixing this. Kind regards, Eman
P.S. here are my costmap and planner config files
costmap_common_params.yaml
global_frame: map
robot_base_frame: base_link
obstacle_range: 5.0
raytrace_range: 10.0
footprint: [[0.275, 0.125], [-0.275, 0.125], [-0.275, -0.125], [0.275, -0.125]]
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
publish_frequency: 1.0
static_layer:
unknown_cost_value: -1
lethal_cost_threshold: 250
map_topic: map
first_map_only: false
subscribe_to_updates: false
track_unknown_space: true
use_maximum: false
trinary_costmap: false
obstacle_layer:
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: base_laser_link, data_type: LaserScan, topic: base_scan, marking: true, clearing: true}
track_unknown_space: true
footprint_clearing_enabled: true
combination_method: 0
# origin_z: 0.0
# z_resolution: 0.05
# z_voxels: 10
# unknown_threshold: 10
# mark_threshold: 0
# publish_voxel_map: false
inflation_layer:
inflation_radius: 0.35 # = gap corn row / 2, so that robot runs in the very center of the row
cost_scaling_factor: 15.0 # the higher, the quicker ...