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!!!!
Originally posted by Andromeda on ROS Answers with karma: 893 on 2014-08-15
Post score: 1