6. Voice control color tracking

6.1. Function description

By interacting with the voice recognition module on ROSMASTER, you can turn on or off ROSMASTER's red/blue/green/yellow color tracking function by voice. The R2 key on the handle can cancel/enable this function at any time.

6.2. Start

6.2.1. Function package path

6.2.2. Start

<PI5 needs to open another terminal to enter the same docker container

image-20240408144126098

After the program is started, call ROSMASTER "Hello, Xiaoya" to wake up the module. When it broadcasts "on", it means waking up the module. Taking tracking red as an example, you can then say "Start tracking red" to it, and ROSMASTER will broadcast "Okay, start tracking red". Then, we release the controller's control of ROSMASTER by pressing the R2 key of the controller, and ROSMASTER begins to track red. If there is no remote control, you can also enter the following command through the terminal,

If you want to cancel the color tracking function, say "cancel tracking" to ROSMASTER, ROSMASTER stops, and the voice will broadcast "OK, cancel tracking".

6.2.3. Color calibration

The camera is very sensitive to light, so sometimes the color recognition will be inaccurate. In this case, the red, green, yellow, and blue colors need to be recalibrated. Terminal input,

Find the colorHSV column and drag the slider to modify the HSV value.

image-20220409153531036

Open the voice_Ctrl_color_tracker.py program and find the following sections,

Modify the calibrated HSV value just recorded to the position of the corresponding color, save it, and use the calibrated value the next time you start it.

6.3. Core code analysis voice_Ctrl_color_tracker.py

6.3.1. Program flow chart

image-20220407094621425

For complete code, please refer to:

6.4. Function module communication table

Function wordsSpeech recognition module resultsVoice broadcast content
Start tracking yellow72OK, start tracking yellow
Start tracking red73OK, start tracking red
Start tracking green74OK, start tracking green
Start tracking blue75OK, start tracking blue
Cancel Tracking76OK, Cancel Tracking