0
$\begingroup$

I'm having a problem setting up the static transform between my base_link and my camera.

If I use rosrun tf static_transform_publisher in a different command line the camera is alligned with my axes but when I incorporate the same transform in a launch file it is out of allignment...

Here are my commands:

rosrun tf static_transform_publisher name=tracking_camera args=0.2 0 0 1.57 0 1.20  base_link camera_depth_optical_frame 100 

<node pkg="tf2_ros" type="static_transform_publisher" name="tracking_camera" args="0.2 0 0 1.57 0 1.20  base_link camera_depth_optical_frame" />

Why does this happen?

Edit: Here are the rqt_tree as requested in the comments. Using launch file method:

enter image description here

Additionally if I input param 100 in the launch file as well I get the following error when trying to generate the tree:

rosrun tf2_tools view_frames.py
[INFO] [1629904078.746465]: Listening to tf data during 5 seconds...
Error:   TF_DENORMALIZED_QUATERNION: Ignoring transform for child_frame_id "100" from authority "/tracking_camera" because of an invalid quaternion in the transform (1.570000 0.000000 1.200000 0.000000)
         at line 255 in /tmp/binarydeb/ros-noetic-tf2-0.7.5/src/buffer_core.cpp
[INFO] [1629904083.765947]: Generating graph in frames.pdf file...

enter image description here

$\endgroup$
4
  • $\begingroup$ Your arg values are different in each case. Could this be the cause? If not, can you take a look at the tf tree with each approaches? maybe that will shed some light $\endgroup$ Aug 24, 2021 at 23:54
  • $\begingroup$ Sorry I pasted the wrong args in the second function... Fixed it now and they are the same in both cases $\endgroup$
    – MMorg
    Aug 25, 2021 at 8:27
  • $\begingroup$ @MMorg your args are still different; your first line calls camera_depth_optical_frame 100 while the second just calls camera_depth_optical_frame. $\endgroup$
    – Chuck
    Aug 25, 2021 at 14:41
  • $\begingroup$ Hi Chuck. Thanks for your comment. I knew that. I removed the 100 in the launch file version because if not I get an error during launch and it doesn't even load the camera in rviz " Error: TF_DENORMALIZED_QUATERNION: Ignoring transform for child_frame_id "100" from authority "unknown_publisher" because of an invalid quaternion in the transform (1.570000 0.000000 1.200000 0.000000) at line 255 in /tmp/binarydeb/ros-noetic-tf2-0.7.5/src/buffer_core.cpp" Do you think it may be due to that? I thought that was a frequency parameter and didnt matter for allignment. $\endgroup$
    – MMorg
    Aug 25, 2021 at 14:52

1 Answer 1

0
$\begingroup$

You're using a different executable from a different package in your rosrun arguments and your launch arguments.

The static transform publisher in tf uses 9 or 10 arguments including the period. http://wiki.ros.org/tf#static_transform_publisher

Whereas the tf2_ros static_transform_publisher uses 8 or 9 arguments as it no longer needs the period as an argument http://wiki.ros.org/tf2_ros#static_transform_publisher

tf2 has a higher level concept of a static transform which is timeless. The behavior of the tf instance was not changed to avoid breaking use cases.

If you use the tf instance of static_transform_publisher in your launch file you'll get the same results instead of the tf2_ros one. However I recommend that you use the tf2_ros one as it will be more efficient and performant.

$\endgroup$
2
  • $\begingroup$ Hey man thanks for your answer! It helped a lot. Now I get the same result using both ways. However when using the launch file, the depth cloud starts appearing and then the tf crashes? The cloud freezes and i get an error about incomplete tf trees. If I run once the command line method, I can then change the tf completely (to remove the effect of the command line tf) and restarting the launch file works completely fine. So it appears to me that there is a little problem booting it from the launch file. Do you also know why? $\endgroup$
    – MMorg
    Aug 27, 2021 at 9:20
  • $\begingroup$ Glad that it's working. Please accept this answer to make it clear to others your problem is solved. My guess is that you're using the same node "name" which are required to be unique. If you launch two nodes with the same name, the new one will replace the previous one. For more help with this issue please ask a new self contained question. $\endgroup$
    – Tully
    Aug 30, 2021 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.