Controlling joints in Gazebo
Hi everyone
I am new to ROS and Gazebo and I got problems into using the joint_state_publisher package. I have a robot with multiple non-fixed joints. I created 2 launch files : one to display the robot in rviz, the other to display in Gazebo.
RVIZ :
<launch>
<arg name="model" />
<arg name="gui" default="False" />
<param name="robot_description" textfile="$(arg model)" />
<param name="use_gui" value="$(arg gui)"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" ></node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.vcg" />
</launch>
Gazebo:
<launch>
<include file="$(find gazebo_worlds)/launch/empty_world.launch"/>
<arg name="model"/>
<arg name="gui" default="False" />
<param name="robot_description" textfile="$(arg model)" />
<node name="spawn_emox" pkg="gazebo" type="spawn_model" args="-urdf -param robot_description -z 5 -model emox" respawn="false" output="screen"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
<param name="use_gui" value="$(arg gui)"/>
</node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
</launch>
By setting the "gui" argument to "true", I can control the joints on rviz via the joint_state_publisher, but this doesn't work on Gazebo.
Using rxgraph, I see something like that :
/joint_state_publisher---> /robot_state_publisher ---> /rviz ---> /rosout
/gazebo ---> /joint_state_publisher---> /robot_state_publisher ---> /rosout
Actually, /gazebo publishes a /clock topic to both joint_state_publisher and robot_state_publisher, whereas /rviz subscribes to the /tf topic (as expected).
Does anyone know if gazebo can be set as a /tf subscriber? Or any other solution to control the robot in gazebo? Would the pr2_mechanism stack be adapted?
Sorry about the beginner question and the poor english.
thanks!
Thank you very much for the quick clear answer!