Color Tracking

1. Purpose of the experiment

This tutorial will teach you how to make the robot dog recognize red, green, blue, and yellow through a camera or color sensor, and automatically adjust its body posture to track the target. The system will calculate the target position in real time, control the robot dog to move or turn, and ensure that it always faces the recognized color object. It is suitable for visual following tasks in dynamic environments.

2. Main source code path

First, end the big program, then open the browser and enter "ip (ip is the ip of the robot dog): 8888", enter the password "yahboom" and enter

image-2024112100001

the path to ~/DOGZILLA_Lite_class/6.AI Visual Interaction Course/03.color Tracking. Open the color_Tracking.ipynb program and run it , or enter it in the terminal

3. Experimental Phenomenon

After running the source code, the body of the robot dog will follow the recognized color. Press the button on the upper right corner of the screen to switch the color. It can switch between four colors: red, yellow, blue and green.

image-2024112100002

4. Main source code analysis

Adjust the parameters of the tracking pid, which can be adjusted as needed

As long as the above source code is the tracking control part, pressing the button in the upper right corner of the screen can switch the recognition color, and the button in the lower left corner can exit the recognition.