Creating face tracker ROS packages

Let's start creating a new workspace for keeping the entire ROS project files for this section. You can name the workspace ros_robotics_projects_ws.

Download or clone the source code of the section from GitHub using the following link.

    $ git clone https://github.com/qboticslabs/ros_robotics_projects

Now, you can copy two packages named face_tracker_pkg and face_tracker_control from the chapter_2_codes folder into the src folder of ros_robotics_projects_ws.

Do a catkin_make to build the two project packages!

Yes, you have set up the face tracker packages on your system, but what if you want to create your own package for tracking? First, delete the current packages that you copied to the src folder, and use the following commands to create the packages.

Note that you should be in the src folder of ros_robotics_projects_ws while creating the new packages, and there should not be any existing packages from the section's GitHub code.

Switch to the src folder:

    $ cd ~/ros_robotics_projects_ws/src

The next command will create the face_tracker_pkg ROS package with the main dependencies, such as cv_bridge, image_transport, sensor_msgs, message_generation, and message_runtime.

We are including these packages because these packages are required for the proper working of the face tracker package. The face tracker package contain ROS nodes for detecting faces and determining the centroid of the face:

    $ catkin_create_pkg face_tracker_pkg roscpp rospy cv_bridge    image_transport sensor_msgs std_msgs message_runtime    message_generation

Next, we need to create the face_tracker_control ROS package. The important dependency of this package is dynamixel_controllers. This package is used to subscribe to the centroid from the face tracker node and control the Dynamixel in a way that the face centroid will always be in the center portion of the image:

    $ catkin_create_pkg face_tracker_pkg roscpp rospy std_msgs    dynamixel_controllers message_generation

Okay, you have created the ROS packages on your own. What's next? Before starting to code, you may have to understand some concepts of OpenCV and its interface with ROS. Also, you have to know how to publish ROS image messages. So let's master the concepts first.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.119.136