5. Voice control color tracking

Before running this program, it is necessary to bind the port number of the voice board and the port number of the ROS extension board on the host computer; When entering the docker, you need to mount the voice board to recognize the voice board in the docker.

5.1. Function description

Voice control robot open and close tracking red/blue/green/yellow color function. The R2 button on the handle can cancel/enable this function at any time.

5.2. Steps

5.2.1. Function package path

Enter the docker, The location of the function source code is located

5.2.2. Start

Enter the docker, according to the actual vehicle type and radar type, terminal input

(Take tracking red for example)

  1. After the above program is run, we say "Hi Yahboom" to wake up the voice module, until it replies "Hi, i'm here", indicating that the module has been woken up.

  2. We can say "red following" and it will reply "OK, I found the red ".

  1. Next, we press the R2 key on handle, then ROSMASTER starts following red object.

  2. If you want to cancel this color tracking function, say "stop following", it replies "OK, it has been stoped". ROSMASTER will cancel this function.

  3. When the robot is moving, you can pause the robot by pressing the R2 key on handle again.

5.2.3. Topic graph

Docker terminal input

Dynamic parameter adjusters are also available

Modified parameter:

colorHSVcolorTraker
Hminlinear_Kp
Sminlinear_Ki
Vminlinear_Kd
Hmaxangular_Kp
Smaxangular_Ki
Vmaxangular_Kd
refreshminDistance

Notes: The camera is very sensitive to light, and if it is in a different lighting environment, it will cause inaccurate color recognition. So we need to re-calibrate the colors for red, green, yellow, and blue according to the current lighting environment.

5.3. Code analysis

5.3.1. colorHSV

This part mainly analyzes voice instructions, as well as image processing, and finally publishes the center coordinates

5.3.2. colorTracker

This part receives the topic data and depth data of the center coordinates, then calculate the speed and publish it to the rosmaster

5.4. Voice module communication protocol

function wordSpeech Recognition Module ResultsVoice broadcast content
yellow following72OK, I found the yellow
red following73OK, I found the red
green following74OK, I found the green
follow this color75OK, I found this color
stop following76OK, it has been stoped