Ask Your Question
0

TF transform unknown_publisher

asked 2020-06-25 12:19:24 -0500

Chao Chen gravatar image

updated 2020-06-25 14:30:21 -0500

I want to connect base_link to two different nodes like below. image description

It works in bash or command window by entering rosrun tf static_transform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 base_link camera_link 50

rosrun tf static_transform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 base_link body 100

However, if I write these two tf command in launch file

<node pkg="tf" type="static_transform_publisher" name="to_camera_link" args="0 0 0 0 0 0 0 base_link camera_link 50"/>

<node pkg="tf" type="static_transform_publisher" name="to_body" args="0 0 0 0 0 0 0 base_link body 100"/>

The error pops up "[ERROR] [1593105389.989908901]: Ignoring transform for child_frame_id "body" from authority "unknown_publisher" because of an invalid quaternion in the transform (nan nan nan nan)" which means base_link does not exist in this case. How can I fix that

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-06-25 16:08:28 -0500

updated 2020-06-25 16:10:22 -0500

You're running the node using the Quaternion Form. You're using seven arguments before link names, so you are setting all quaternion values to zero.

If you wish to publish this way you should use:

<node pkg="tf" type="static_transform_publisher" name="to_body" args="0 0 0 0 0 0 1 base_link body 100"/>

(You can't publish with all quaternion parameters equal to zero.)

Or you can run the node using the Roll Pitch Yaw Form, which is called when you use six numbers before link names.

<node pkg="tf" type="static_transform_publisher" name="to_body" args="0 0 0 0 0 0 base_link body 100"/>

You can check more info here --> TF Static Publisher

edit flag offensive delete link more

Comments

Thank you for answering. I actually wrote a bash file and call it in the launch file to work around it. But that is helpful. I tried it . It also works.

Thank you

Chao Chen gravatar image Chao Chen  ( 2020-06-25 16:17:45 -0500 )edit

I actually wrote a bash file and call it in the launch file to work around it.

To work around what exactly?

gvdhoorn gravatar image gvdhoorn  ( 2020-06-26 02:38:59 -0500 )edit

To work around using TF in launch file, I use Bash file in launch file to do TF work

Chao Chen gravatar image Chao Chen  ( 2020-06-26 10:22:47 -0500 )edit

I don't understand why you'd have to start static_transform_publisher (STP) from a bash script. There are literally thousands of .launch files which include STP which don't have any problems with it.

I also don't understand how using a bash script to start STP and then starting that bash script from a .launch influences anything.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-26 11:32:21 -0500 )edit

When I add "

<node pkg="tf" type="static_transform_publisher" name="to_camera" args="0 0 0 0 0 0 1 base_link body 100"/>
<node pkg="tf" type="static_transform_publisher" name="to_body" args="0 0 0.4 0 0 0 1 base_link body 100"/>

instead of using bash " <node name="foo" pkg="realsense2_camera" type="rs_tf.sh"/>"

The animation of the robot keeps flashing, and all the joints move all the time. It could be due to one launch file processing RVIZ and TF. If I run bash file with separate thread, the problem solves

Chao Chen gravatar image Chao Chen  ( 2020-06-26 11:52:06 -0500 )edit
1
<node pkg="tf" type="static_transform_publisher" name="to_camera" args="0 0 0 0 0 0 1 base_link body 100"/>
<node pkg="tf" type="static_transform_publisher" name="to_body" args="0 0 0.4 0 0 0 1 base_link body 100"/>

You're publishing two different tranforms connecting the same links (ie: base_link and body).

Those will conflict, leading to the problems you describe.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-26 11:56:20 -0500 )edit

It works. Thank you, it was my bad...

Chao Chen gravatar image Chao Chen  ( 2020-06-26 12:30:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-06-25 12:19:24 -0500

Seen: 41 times

Last updated: Jun 25