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

How to locate robot position on map using map -> base_link transform?

asked 2014-04-26 10:14:10 -0500

INait gravatar image

I'm running turtlebot in playground world and navigation

roslaunch turtlebot_gazebo turtlebot_playground.launch
roslaunch turtlebot_gazebo gmapping_demo.launch

In my program code I successfully subscribe to /map topic and process its data as 2D array[height][width] of wall coordinates, but I'm unable to interpret results of

listener_.lookupTransform( "map", "base_link", ros::Time( 0 ), transform );

How to compare results of map array and map->base_link transform?

edit retag flag offensive close merge delete


Why we should compare the results? since it is giving relative robot position.....

RB gravatar image RB  ( 2014-05-05 03:26:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-26 22:04:28 -0500

INait gravatar image

Found the answer myself.

I need to use map_metadata to get map configuration with the real world.

Cell where the robot situated is ( robot_position - map_origin ) / map_resolution, for x and y coordinates accordingly.

edit flag offensive delete link more



Don't forget to mark this as the accepted answer.

Tom Moore gravatar image Tom Moore  ( 2014-04-28 05:52:28 -0500 )edit

I don't have enough karma to do that.

INait gravatar image INait  ( 2014-04-29 00:55:21 -0500 )edit

I took care of it for you. And you should have enough karma now.

tfoote gravatar image tfoote  ( 2014-04-30 23:00:42 -0500 )edit

You are calculating robot position, but in your answer, you used again robot position??Can you please explain a little bit..I have posted a similar kind of question... .Please have a look....

RB gravatar image RB  ( 2014-05-05 03:29:14 -0500 )edit

Sorry for late response, I see in your question that you found solution, is there something left uncleared?

INait gravatar image INait  ( 2014-05-06 00:48:37 -0500 )edit

@INait, now everything is ok..

RB gravatar image RB  ( 2014-05-06 01:17:35 -0500 )edit

Question Tools

1 follower


Asked: 2014-04-26 10:14:10 -0500

Seen: 1,761 times

Last updated: Apr 26 '14