Ask Your Question
0

[Python]How to know pose of turtlebot

asked 2017-09-27 09:54:01 -0600

sabruri1 gravatar image

Hello ! I want to know the pose of turtlebot (x,y,z, z rotation) respect to the point from which it started. What is the best way to do that in python?

edit retag flag offensive close merge delete

Comments

What do you mean by

respect to the point from which it started

? Are you talking about in some reference frame like world or map? Or, are you comparing two poses (initial and final)?

jayess gravatar imagejayess ( 2017-09-27 12:11:44 -0600 )edit

My robot starts from a point in the room. I would fix a reference frame in this point. Robot reaches a new point. I want to know x,y coordinates of this point in the initial fixed reference frame and it's orientation. Maybe I can use odom topic

sabruri1 gravatar imagesabruri1 ( 2017-09-27 12:32:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-10-05 11:00:04 -0600

Alberto E. gravatar image

Hello!

As you suggest in your last message, the best practice for doing that is to use the odom topic. For that, you can create a simple subscriber in Python that gets the data you need, which is, position and orientation respect to an starting point. The code for a simple subscriber could be like this:

#! /usr/bin/env python

import rospy
from nav_msgs.msg import Odometry

def callback(msg):
    print msg.pose.pose

rospy.init_node('check_odometry')
odom_sub = rospy.Subscriber('/odom', Odometry, callback)
rospy.spin()

This code basically subscribes to the odom topic, and prints the pose component of the message, which contains the position and orientation values. I've also created a video with a quick demonstration, which may be helpful: https://www.youtube.com/watch?v=kPsrO...

edit flag offensive delete link more

Comments

Hi,

this msg.pose.pose.orientation.w, return a value 1 in the initial configuration where everything should be zero.

Can you explain why?

srnand gravatar imagesrnand ( 2018-03-29 12:43:30 -0600 )edit
1

(0,0,0,1) is the identity quaternion: I'd suggest reading more about quaternions. https://answers.ros.org/question/9981...

tfoote gravatar imagetfoote ( 2018-03-29 17:53:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-09-27 09:54:01 -0600

Seen: 3,222 times

Last updated: Oct 05 '17