Color interaction

1. Color interaction description

The snake-out-of-hole function uses the HSV color recognition function.

The path where the HSV color calibration file is saved is ~/jetcobot_ws/src/jetcobot_snake_follow/scripts/HSV_config.txt.

If the color recognition is not accurate enough, please open the ~/jetcobot_ws/src/jetcobot_snake_follow/scripts/HSV_calibration.ipynb file to calibrate the HSV value of the block color.

After the calibration operation is completed, it will be automatically saved to the HSV_config file. Rerun the program without additional code modification.

The main function of the snake-out-of-hole is to identify the selected color block and move forward and backward with the block. When it reaches the maximum distance range of the arm length, it will make the action of clamping the block.

 

2. About code

Code path:~/jetcobot_ws/src/jetcobot_snake_follow/scripts/snake_follow.ipynb

The function of controlling the forward and backward movement of the robotic arm.

The camera processes the image function, passes the image captured by the camera to the color interaction function for calculation, and drives the robot ic arm to move.

 

3. Start program

Start roscore

Start the program

Open the jupyterlab webpage and find the corresponding .ipynb program file.

Click the Run button to run the entire code.

202309010001

 

4. Experimental operation and results

After the program runs, the Jupyterlab webpage will display the control button.

Camera image on the left side, functions of the related buttons on the right side.

image-20240704211636357

The robotic arm will control the gripper to loosen the clamp at regular intervals. At this time, put the corresponding color block into the camera screen, the robot arm will identify the corresponding color, and move the block back and forth, and the robot arm can be controlled to move forward and backward.

If the robotic arm is led to the farthest distance, the robot arm will first rotate the gripper to trigger the function of gripping the block, then open the gripper, put the block into the position where the gripper can grip, and the robot arm will grip the block to the selected color position.

If you need to exit the program, please click the 【Exit】 button.