ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I think you need to apply the transformation in the reverse direction.
import tf
import tf2_geometry_msgs
from geometry_msgs.msg import TransformStamped, Vector3Stamped
v = Vector3Stamped()
v.vector.x = 23.7
t = TransformStamped()
q = tf.transformations.quaternion_inverse(tf.transformations.quaternion_from_euler(0.39, 0, 1.64))
t.transform.rotation.x = q[0]
t.transform.rotation.y = q[1]
t.transform.rotation.z = q[2]
t.transform.rotation.w = q[3]
vt = tf2_geometry_msgs.do_transform_vector3(v, t)
vt looks like this
header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
vector:
x: -1.6388182331
y: -21.867875772
z: 8.98889782002