Color interaction

1. Introduction to gameplay

After entering the Raspberry Pi 5 desktop, open a terminal and run the following command to start the container corresponding to Dofbot:

Access Jupyter Lab within Docker:

(1) Start the code block and display the interface as shown in the figure. Click the color button to select a color at will. The selected color is displayed in the middle above the image.

(2) When the selected color appears in the field of view, the robot arm will estimate the location of the block based on its area in the image.

(3) When the area becomes smaller, the robotic arm drives forward until the front end completes the grasping action. When the area becomes larger, it retreats and shakes its head in fear.

(4) If the color that appears on the screen is not the selected color, the robot arm moves back and shakes its head.

Note: Use the color block here to control the robotic arm back and forth, and then slowly move away to trigger it. This case requires multiple attempts

2. Code design

When we are playing the game of luring the snake out of the hole, we need to control the end posture of the robotic arm and always face the front. When obtaining the inverse solution, we can just write the end posture of the robotic arm.

For detailed codes, please view snake_ctrl.py;snake_move.py;snake_target.py in the /root/dofbot_ws/src/dofbot_snake_follow/scripts directory