How to get Position of turtlebot?

my question is: how do i get the position of my turtlebot in the room? I followed the instuctions from the website lear.turtlebot. I modified the code for my own issues but now my question is: when i am sending a new goal to my turtlebot (initialized as a SimpleActionClient from actionlib), using a MoveBaseGoal: where do i get the precise position of my turtlebot during the driving from?

I tried for example:

rospy.Subscriber("odom", Odometry, self.Position)

def Position(self, msg):
print msg.pose.pose


the problem here is, that the values of position.x and position.y are not the right ones, because the turtlebot ends up in the right place where i wanted it to be, but the printed information is totally wrong.

The right information is existent in rviz: a client that I use to set the initial position of my turtlebot.

Another way that i found is using a TransformListener but every tutorial i found did not work in my place. In my opinion the prblem here is that i have no idea how the topics or frames are called.

Does anyone can help me please?

edit retag close merge delete

Sort by » oldest newest most voted

Note that the odom topic contains the pose of the turtlebot in the /odom frame. This pose will drift relative to the ground truth pose as the turtlebot drives around. This is due to a variety of factors such as error in the kinematic model and wheel slippage. Due to this drift, if you are trying to control your turtlebot to a fixed location in a static environment (such as a room), the odom topic is not enough.

Are you using a map? If so, you are also likely using AMCL to "localize" your robot. In this case, you should be either transforming the pose information in the odom topic into the /map frame, or you should be looking up the transform from the /map frame to the /base frame.

more