Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf problem #22

Open
oscar-lima opened this issue Nov 20, 2017 · 1 comment
Open

tf problem #22

oscar-lima opened this issue Nov 20, 2017 · 1 comment

Comments

@oscar-lima
Copy link
Collaborator

Question: We have some problems with the lookupTransform. We are asking the more recent position of the robot and upon a time it returns us an older position instead of the current one.

We have already used rospy.Time(0) and this doesn't solved our problem

@oscar-lima
Copy link
Collaborator Author

oscar-lima commented Nov 20, 2017

Thats weird, rospy.Time(0) should give you the latest tranform.

My advice is for you to check the code against this snippet:

import tf
import rospy

listener = tf.TransformListener()
wait_for_transform = 0.1
reference_frame = "my_reference_frame"
target_frame = "my_target_frame"

try:
    listener.waitForTransform(reference_frame, target_frame, rospy.Time(0), rospy.Duration(wait_for_transform))
    (translation, rotation) = self.listener.lookupTransform(reference_frame, target_frame, rospy.Time(0))
except tf.Exception, error:
    rospy.logwarn("Exception occurred: {0}".format(error))

# x, y, z

translation[0]
translation[1]
translation[2]
# quaternion

print rotation[0]
print rotation[1]
print rotation[2]
print rotation[3] 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant