Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Have you looked through the urdf tutorials?

They show you how to launch a urdf in rviz:

$ roslaunch urdf_tutorial display.launch model:='$(find urdf_tutorial)/urdf/01-myfirst.urdf'

If you don't want to use the urdf_tutorial package (I think that's what you're saying) simply copy the display.launch file from the urdf_tutorial package and paste it in your own package, then you're free to edit it if you like. You'll see there's not much in there:

<launch>

  <arg name="model" default="$(find urdf_tutorial)/urdf/r2d2.xacro"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />

  <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
  <param name="use_gui" value="$(arg gui)"/>

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

</launch>

It's just starting all the nodes you'll need to show the robot in Rviz (and move the joints if you do use_gui:=true)

Have you looked through the urdf tutorials?

They show you how to launch a urdf in rviz:

$ roslaunch urdf_tutorial display.launch model:='$(find urdf_tutorial)/urdf/01-myfirst.urdf'

If you don't want to use the urdf_tutorial package (I think that's what you're saying) simply copy the display.launch file from the urdf_tutorial package and paste it in your own package, then you're free to edit it if you like. You'll see there's not much in there:

<launch>

  <arg name="model" default="$(find urdf_tutorial)/urdf/r2d2.xacro"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />

  <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
  <param name="use_gui" value="$(arg gui)"/>

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

</launch>

It's just starting all the nodes you'll need to show the robot in Rviz (and move the joints if you do use_gui:=true)joints)