Launch files in ROS can do multiple tasks in a single file. Launch files have an extension of .launch. The following code shows the definition of start_usb_cam.launch, which starts the usb_cam node for publishing the camera image as an ROS topic:
<launch> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" > <param name="video_device" value="/dev/video0" /> <param name="image_width" value="640" /> <param name="image_height" value="480" /> <param name="pixel_format" value="yuyv" /> <param name="camera_frame_id" value="usb_cam" /> <param name="auto_focus" value="false" /> <param name="io_method" value="mmap"/> </node> </launch>
Within the <node>...</node> tags, there are camera parameters that can be changed by the user. For example, if you have multiple cameras, you can change the video_device value from /dev/video0 to /dev/video1 to get the second camera's frames.
The next important launch file is start_tracking.launch, which will launch the face-tracker node. Here is the definition of this launch file:
<launch> <!-- Launching USB CAM launch files and Dynamixel controllers --> <include file="$(find face_tracker_pkg)/launch/start_usb_cam.launch"/> <!-- Starting face tracker node --> <rosparam file="$(find face_tracker_pkg)/config/track.yaml" command="load"/> <node name="face_tracker" pkg="face_tracker_pkg" type="face_tracker_node" output="screen" /> </launch>
It will first start the start_usb_cam.launch file to get ROS image topics, then load track.yaml to get the necessary ROS parameters, and then load face_tracker_node to start tracking.
The final launch file is start_dynamixel_tracking.launch; this is the launch file we have to execute for tracking and Dynamixel control. We will discuss this launch file at the end of this chapter, after discussing the face_tracker_control package. Let's now learn how to run the face tracker node.