TF creating transforms seems to be wrong
Hi all, I already found something like this in a post here. But it is not directly what I am looking for. Maybe the solution for my problem is the inverse, but see yourself.
I want to create the coordinate frames "parent_frame" and "c4". Which uses the transformation matrix:
0 -1 0
-0.707 0 -0.707
-0.707 0 -0.707
which transforms from the parent frame to the c4 frame. The quaternion vector for this equals q=(0.653282, -0.653282, 0.2705967, 0.2705967)
with q=(qx,qy,qz,qw)
. The translation should be t=(1, 0, 1)
. However, if I set this via the command:
ros2 run tf2_ros static_transform_publisher 0.707 0 0.707 0.653282 -0.653282 0.2705967 0.2705967 parent_frame c4
Rviz shows the not the thing I expected. It shows the right translation, but the inverse rotation matrix. If I do enter the inverse rotation:
ros2 run tf2_ros static_transform_publisher 0.707 0 0.707 0.653282 -0.653282 0.2705967 -0.2705967 parent_frame c4
I get the correct coordinates in rviz. However, when I am reading with tf echo or lookupTransform, I also get the inverse rotation. Can it be, that the TF is always storing the inverse transform?
Do I alsways have to invert the rotation and keep the translation. I am really confused and I think this could be done better or do I missed something? I didn't find a good explanation for that and it seems only to be the case when using quaternions instead of axes angles.