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

Revision history [back]

I guess you already have the map subscribed as an OccupancyGrid (from nav_msgs.msg import OccupancyGrid).

If so, for me, I found that the ROS odom x,y axis needed to be transposed to y,x of the map OccupancyGrid (i.e. odom x {left to right in RVIZ} = map y, while odom y {down to up in RVIZ} = map x). Also you need to translate the map-origin with its x,y = 0,0 being at its bottom left hand corner; using the OccupancyGrid.info meta-data.

Also with tf, you may find that applying the odom to map transform, is easier using "from tf2_geometry_msgs import PoseStamped, do_transform_pose" - e.g. like: in_map_pose = do_transform_pose(msg.pose, trans)

I guess you already have the map subscribed as an OccupancyGrid (from OccupancyGrid:

from nav_msgs.msg import OccupancyGrid).OccupancyGrid

If so, for me, I found that the ROS odom x,y axis needed to be transposed to y,x of the map OccupancyGrid (i.e. odom x {left to right in RVIZ} = map y, while odom y {down to up in RVIZ} = map x). Also you need to translate the map-origin with its x,y = 0,0 being at its bottom left hand corner; using the OccupancyGrid.info meta-data.

Also with tf, you may find that applying the odom to map transform, is easier using "from using:

from tf2_geometry_msgs import PoseStamped, do_transform_pose" - do_transform_pose

  • e.g. like:

in_map_pose = do_transform_pose(msg.pose, trans) trans)

I guess you already have the map subscribed as an OccupancyGrid:

from nav_msgs.msg import OccupancyGrid

If so, for me, I found that the ROS odom x,y axis needed to be transposed to y,x of the map OccupancyGrid (i.e. odom x {left to right in RVIZ} = map y, while odom y {down to up in RVIZ} = map x). Also you need to translate the map-origin with its x,y = 0,0 being at its bottom left hand corner; using the OccupancyGrid.info meta-data.

Also with tf, you may find that applying the odom to map transform, is easier using:

using: from tf2_geometry_msgs import PoseStamped, do_transform_pose

  • e.g. like: in_map_pose = do_transform_pose(msg.pose, trans)

in_map_pose = do_transform_pose(msg.pose, trans)