Yolov11 garbage identification and sorting

Before starting this function, you need to close the process of the big program and APP. If you need to start the big program and APP again later, start the terminal,

1. Function description

After the program is started, the camera captures the image, places the garbage label code block in the image, the robot arm recognizes the category of the garbage label code block, and grabs the garbage label code block with the lower claw. According to the category of the garbage label code, it is placed in the set position. After the placement is completed, it returns to the recognized posture.

2. Start and operate

2.1. Start command

Enter the following command in the terminal to start,

Due to the performance differences of the motherboard, the time it takes to load the Yolov11 recognition program on different motherboards is different. You need to wait patiently for a while.

2.2. Operation process

After the program starts, place the wooden block with the garbage label code in the middle of the image. The wooden block needs to be straightened and the icon needs to be in the same direction as the robot arm (forward, Y axis direction). Press the space bar to start recognition. The robot arm will grasp the wooden block and place it in the corresponding position according to the type of garbage identified.

3. Program flow chart

yolov11.py

image-20250417150529387

yolov11_sortation.py

image-20250417150539231

4. Core code analysis

4.1. msgToimg.py

Code path:

Import necessary libraries,

Initialize program parameters, create publishers and subscribers,

image_sub_callback callback function,

 

4.2、yolov11.py

Code path:

Import necessary library files,

Initialize program parameters, create publishers and subscribers,

The callback function for subscribing to the image topic,

4.3、yolov11_sortation.py

Code path:

Import necessary libraries,

Open the offset parameter table,

Initialize program parameters, create publishers, subscribers, etc.

The callback function getDetectInfoCallback of the identified spam tag result,

The callback function getDepthCallback of the depth image topic,

The callback function getSortFlagCallback that starts sorting topics.

Grasp function grasp,