Creating face tracker ROS packages

Let's start creating a new workspace for keeping the entire ROS project files for this book. You can name the workspace chapter_12_ws and follow these steps:

  1. Download or clone the source code of this book from GitHub using the following link:
$ git clone https://github.com/PacktPublishing/ROS-Robotics-Projects-SecondEdition.git
  1. Now, you can copy two packages, named face_tracker_pkg and face_tracker_control, from the chapter_12_ws/ folder into the src folder of the chapter_12_ws workspace you created.
  2. Compile the package using catkin_make to build the two project packages.

You have now set up the face tracker packages on your system.

What if you want to create your own package for tracking? Follow these steps:

  1. First, delete the current packages that you copied to the src folder.
Note that you should be in the src folder of chapter_12_ws while creating the new packages, and there should not be any existing packages from this book's GitHub code.
  1. Switch to the src folder:
$ cd ~/chapter_12_ws/src
  1. 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 contains 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
  1. 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

You have now created the ROS packages on your own.

What's next? Before starting to code, you will have to understand some concepts of OpenCV and its interface with ROS. Also, you need to know how to publish ROS image messages. So, let's master these concepts in the next section.

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

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