How to translate a pose in rospy?
How would I go about translating a pose along the X axis in rospy
? Basically, I have a pose and want to to return a translated pose in my Python
script. Is tf
or tf2
useful for this? What would the line of code look like?
I suppose I'm hoping for a function that returns a translated pose, maybe like translated_pose = pose_translator(original_pose, transform)
.
EDIT: So far I've tried the following:
pose_transform = Transform()
pose_transform.translation.x = 0.15
pose_transform.translation.y = 0
pose_transform.translation.z = 0
transformed_pose = tf2_geometry_msgs.do_transform_pose(original_pose, pose_transform)
However, I get this error:
AttributeError: 'Transform' object has no attribute 'transform'
Any ideas what might be going wrong?
Do you want to translate a pose in the same frame of reference or in a different one?
Same frame :)
In general you shouldn't use tf anymore as it is depricated and has been replaced by tf2 as described here. tf still works and probably would do the job in many cases, but to future-proof you software i'd recommend to allways go with tf2.