ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

About robot_state_publisher + URDF

asked 2014-08-15 10:40:49 -0500

Andromeda gravatar image

Hi everybody, As stated in this post (see answer of Ahendrix) one should load the urdf model using the param tag in the launch file. This is exact what happens in this tutorial, where the author wrote in his launch file the following line of code:

<param name="robot_description" command="cat $(find r2d2)/model.xml" />

That’s ok, but taking a look into the tutorial above I cannot figure out how the robot_state_publisher receives informations about joints defined in the URDF file.

My guess: I suppose that the joint_state variable, defined in the tutorial as:

  20     sensor_msgs::JointState joint_state;

  29         joint_state.name[0] ="swivel";

  31         joint_state.name[1] ="tilt";

  33         joint_state.name[2] ="periscope";

identifies the joint by name (as defined also in the URDF file). I m right? One possibility is that names in the model correspond to the joint_state.name[k] in the broadcasted variable.

I can imagine that joint’names are loaded in the memory of the system by the launch command:

<param name="my_robot" command="cat $(find my_pkg_robot)/my_urdf_model.xml" />

and later recognised by the robot_state_publisher:

<node name="state_publisher" pkg=" my_pkg_robot " type="state_publisher" />

By doing that and publishing datas on joint_state I can move my robot. Is it like that, or I m wrong?

More: i really don t understand why he launched a second node with the command:

<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />

Why does he need 2 nodes? Was the first not enough to load the URDF model of the robot and to publish joint_state position every 1/30th seconds? Which is the relation between both nodes?

<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="state_publisher" pkg="r2d2" type="state_publisher" />

I think the tutorial is not clear, it doesn’t explain well enough how the package works, it just publishes an example. This is the most importa keypoint that should be understood in the tutorial.

Thanks!!!!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-08-15 13:11:43 -0500

David Lu gravatar image

The state publisher publishes joint state messages that specifies the positions (state) of the joints in the robot.

The robot state publisher subscribes to the joint state messages and uses that and the info in the URDF to publish transforms to all of the links.

edit flag offensive delete link more

Comments

Thankx David, But am I right about the concept that the urdf file is going to be parsed so the name of the joint must be the same as in the code?

Andromeda gravatar image Andromeda  ( 2014-08-16 00:39:39 -0500 )edit

Yes. That is correct.

David Lu gravatar image David Lu  ( 2014-08-16 17:33:31 -0500 )edit

Sorry again David. But in this tutorial it explain that the /joint_states is going to be publish but later 2.1.1 it is under Subscribed Topics. Is the wiki page wrong?!!?

Andromeda gravatar image Andromeda  ( 2014-08-25 14:49:27 -0500 )edit

The robot_state_publisher subscribes to the joint_state messages, which is what that page and I said before.

David Lu gravatar image David Lu  ( 2014-08-25 16:41:37 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-15 10:40:49 -0500

Seen: 989 times

Last updated: Aug 15 '14