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

Revision history [back]

To visualize a URDF file in rviz, it's not enough to just load it in gazebo. You have to load it on the parameter server and you need to publish tf frames for each link in the urdf.

The following launch file loads the urdf and starts the robot_state_publisher to publish the TF frames of the urdf based on the data coming in over the joint_states topic.

<launch>
  <param name="robot_description" textfile="$(find learning_urdf)/tx60l.urdf" />
  <node name="robot_state_published" pkg="robot_state_publisher" type="state_publisher" />
</launch>

Now you need a node to publish joint states. If you want to use gazebo, you will have to use a plugin that reads the state of the joints in the physics simulation. On the real robot the node that communicates with your hardware needs to publish joint states.

For just testing your model in rviz, you can use the joint_state_publisher which provides a nice GUI to move the joints of your model. Don't forget that you have to add 'Robot Model' in rviz and your reference frame needs to be the root of your robot, i.e. base_link.

To visualize a URDF file in rviz, it's not enough to just load it in gazebo. You have to load it on the parameter server and you need to publish tf frames for each link in the urdf.

The following launch file loads the urdf and starts the robot_state_publisher to publish the TF frames of the urdf based on the data coming in over the joint_states topic.

<launch>
  <param name="robot_description" textfile="$(find learning_urdf)/tx60l.urdf" />
  <node name="robot_state_published" pkg="robot_state_publisher" type="state_publisher" />
</launch>

Now you need a node to publish joint states. If you want to use gazebo, you will have to use a plugin that reads the state of the joints in the physics simulation. On the real robot the node that communicates with your hardware needs to publish joint states.

For just testing your model in rviz, you can use the joint_state_publisher which provides a nice GUI to move the joints of your model. Don't forget that you have to add 'Robot Model' in rviz and your reference frame needs to be the root of your robot, i.e. base_link.

Edit: Just another guess what could go wrong: How is the scale of your stl files? 1 corresponds to 1mm, the meshes will be really big and you might not see anything. Make sure 1 corresponds to exactly 1 meter.