"Creating a New Layer" Tutorial grid_layer Offset Issue

asked 2019-11-09 16:02:02 -0600

cmcheung gravatar image

updated 2019-11-09 16:02:55 -0600

I am running the "Creating a New Layer" tutorial at http://wiki.ros.org/costmap_2d/Tutori..., and have it successfully running. However, the grid_layer is putting the obstacles in the incorrect place.

The relevant code from the example is as follows:

  double mark_x = robot_x + cos(robot_yaw), mark_y = robot_y + sin(robot_yaw);
  if(worldToMap(mark_x, mark_y, mx, my)){
    setCost(mx, my, LETHAL_OBSTACLE);
  }

This should notionally put an obstacle in front of the robot. However, when run with the Husky Gazebo code in RVIZ, the obstacle ends up appearing behind and to the right of the robot, as show in this image (the pink dot is the obstacle):

image description

Any ideas on what's happening and how to fix it?

edit retag flag offensive close merge delete