Visualizing the 3D robot model in RViz
After designing the 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 the mastering_ros_robot_description_pkg/launch
directory for the 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" /> </launch>
We can launch the model using the following command:
$ roslaunch mastering_ros_robot_description_pkg view_demo.launch
If everything works fine, we will get a pan-and-tilt mechanism...