# Static transform difference between command line and launch file

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.

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...


• 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 Aug 24 '21 at 23:54
• Sorry I pasted the wrong args in the second function... Fixed it now and they are the same in both cases Aug 25 '21 at 8:27
• @MMorg your args are still different; your first line calls camera_depth_optical_frame 100 while the second just calls camera_depth_optical_frame. Aug 25 '21 at 14:41
• 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. Aug 25 '21 at 14:52

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.