Visualizing the robot 3D model in RViz

After designing URDF, we can view it on RViz. We can create a view_demo.launch launch file and put the following code into the launch folder. Navigate to chapter_2_code/mastering_ros_robot_description_pkg/launch for the same code:

<launch> <arg name="model" /> <param name="robot_description" textfile="$(find mastering_ros_robot_description_pkg)/urdf/pan_tilt.urdf" /> <param name="use_gui" value="true"/> <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 $(find mastering_ros_robot_description_pkg)/urdf.rviz" required="true" /> ...

Get Mastering ROS for Robotics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.