ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Here's a sample script to do it, following @zkytony 's answer:
#!/usr/bin/env python3
import rospy
from geometry_msgs.msg import PoseStamped, TransformStamped
import tf2_ros
import tf2_geometry_msgs.tf2_geometry_msgs
one = PoseStamped()
trans = TransformStamped()
trans.transform.translation.x = 1
print(one)
two = tf2_geometry_msgs.do_transform_pose(one, trans)
print(two)
The output will be:
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
pose:
position:
x: 1.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.5
w: 0.0