Welcome to DOFBOT-Ultra repository
11. Text Large Model + YOLOv26 + Intelligent Garbage Classification
Text Large Model + YOLOv26 + Intelligent Garbage Classification
Please ensure that the web control program backend process is not running in the background. To close it, refer to the [Get Started Quickly - 2. Access the Terminal] section in [Disable the Auto-Start Web Control Backend Process]. After closing, please restart DofbotUltra!!!
The web control program backend process must be closed before starting this function.
1. Function Description
After the program starts, give a natural language command related to garbage classification to the large model. The large model will first understand whether the user wants to "sort a certain type of garbage", "keep a certain type of garbage", or "clean up all garbage on the table", then plan corresponding action steps, and finally control the robotic arm combined with YOLOv26 recognition results to sort the garbage label tag blocks on the table.
The "garbage" in this section is not real garbage, but wood blocks with garbage labels. The YOLO model is responsible for identifying the garbage category labels on the wood blocks, and the robotic arm then completes the gripping and placement according to the large model's plan.
This section supports the following three common types of tasks:
Sort a single type of garbage: e.g., "Sort toxic waste"
Keep a certain type of garbage: e.g., "Sort all garbage except recyclable waste"
Sort all garbage on the table: e.g., "Clean up the garbage on the table"
2. Startup
Enter the Docker container and input the following command:
ros2 launch largemodel largemodel_control.launch.py text_chat_mode:=False
Then use voice to input: "Sort recyclable waste"
Garbage classification has the following commands:
Sort a single type of garbage: e.g., Sort toxic waste Keep a certain type of garbage: e.g., Sort all garbage except recyclable waste Sort all garbage on the table: e.g., Clean up the garbage on the table
Below are several recommended test phrases:
Sort recyclable waste
Sort toxic waste
Sort wet waste
Sort dry waste
Sort all garbage except recyclable waste
Keep wet waste, clean up all other garbage
Clean up the garbage on the table
3. Task Plan
The key point of this section is not the robotic arm action itself, but how the large model converts natural language intent into garbage classification actions. The overall execution flow can be summarized as:
User inputs a natural language command;
The decision layer first understands the user's intent, determining which type of garbage task it belongs to;
The execution layer outputs specific action functions according to the decision layer's plan;
action_servicecalls the garbage classification related capabilities;YOLOv26 detects garbage label wood blocks on the table, and the robotic arm completes gripping and placement.
3.1. Sort a Single Type of Garbage
When the user explicitly specifies to process only one type of garbage, the decision layer maps the user's intent to a garbage category, and the execution layer directly outputs the corresponding garbage classification action.
For example:
xxxxxxxxxxSort toxic waste
The large model typically plans as:
Recognize that the internal category corresponding to "toxic waste" is
toxOutput action:
garbage_sort('tox')
The mapping relationships for other types are as follows:
Recyclable waste ->
recToxic / Hazardous waste ->
toxWet / Kitchen waste ->
wetDry waste ->
dry
3.2. Keep a Certain Type of Garbage
The essence of this type of task is "exclusionary sorting". That is, the user is not saying "I want to sort a certain type", but "keep a certain type and clean up the rest".
For example:
xxxxxxxxxxSort all garbage except recyclable waste
The decision layer first needs to understand:
The user wants to keep "recyclable waste"
Then the actual types to process in sequence are: toxic waste, wet waste, dry waste
Therefore, the execution layer does not output very complex actions all at once, but executes them one by one in order:
garbage_sort('tox')garbage_sort('wet')garbage_sort('dry')
The advantage of this approach is:
Only one type is processed at a time, the logic is clear;
Even if a certain type of garbage does not exist on the table at present, it does not affect subsequent types from continuing execution;
The robotic arm actions are more stable, and it is easier to locate problems when errors occur.
3.3. Sort All Garbage on the Table
When the user requests to clean up all garbage on the table, the decision layer recognizes the task as "full garbage sorting".
For example:
xxxxxxxxxxClean up the garbage on the table
This type of task is typically planned as:
Directly call:
garbage_sort_all()
In the code implementation, garbage_sort_all() represents a complete cleaning process for all garbage targets on the table. It is more suitable for natural expressions like "clean up the entire table" without requiring the user to manually specify a specific garbage type.
4. Core Code Analysis
4.1. Garbage Classification Action Entry
The core entry for garbage classification actions is in:
src/llm/largemodel/largemodel/action_service.py
The action function corresponding to single-type garbage sorting is garbage_sort(type_).
xdef garbage_sort(self, type_): self.pub_arm(list(OBS_JOINTS), runtime=1000) time.sleep(1.0) type_ = type_.strip("'\"") if type_ == "rec": target_type_ = float(1) elif type_ == "tox": target_type_ = float(2) elif type_ == "wet": target_type_ = float(3) elif type_ == "dry": target_type_ = float(4) else: self.action_status_pub("garbage_sort_failed", type_=type_) return
cmd1 = "ros2 run largemodel_arm grasp" cmd2 = f"ros2 run largemodel_arm yolov11_garbage --ros-args -p target_type:={target_type_:.1f}"
subprocess.Popen(cmd1, shell=True) subprocess.Popen(cmd2, shell=True)This code accomplishes two things:
Maps the large model's output
rec/tox/wet/dryto internal numeric types;Starts the
graspandyolov11_garbagenodes, entering the visual detection and gripping process.
4.2. YOLOv26 Garbage Recognition Node
Note: Considering compatibility with older products, the file name is yolov11, but it actually calls the model trained based on YOLOv26. YOLOv26 garbage recognition node source code is in:
src/llm/largemodel_arm/largemodel_arm/yolov11_garbage.py
This node pre-defines four categories of garbage label sets:
xxxxxxxxxxself.recyclable_waste = {"newspaper", "zip_top_can", "book", "old_school_bag"}self.toxic_waste = {"syringe", "expired_cosmetics", "used_batteries", "expired_tablets"}self.wet_waste = {"fish_bone", "egg_shell", "apple_core", "watermelon_rind"}self.dry_waste = {"toilet_paper", "peach_pit", "cigarette_butts", "disposable_chopsticks"}When the action layer passes in target_type, the YOLO node only focuses on this one garbage category and filters the corresponding targets in the image.
For example:
target_type = 1indicates recyclable wastetarget_type = 2indicates toxic wastetarget_type = 3indicates wet wastetarget_type = 4indicates dry waste
After detecting the target, the node publishes the identified center point and depth information for the gripping node to execute the robotic arm gripping action.
4.3. Why the Large Model Can Understand "Keep a Certain Type of Garbage"
"Keep a certain type of garbage" is not directly supported by the underlying vision node, but is completed by the large model through semantic conversion.
For example, the user says:
xxxxxxxxxxKeep wet waste, clean up all other garbage
The large model will first perform semantic equivalence conversion during the decision phase:
Keep
wetClean up
rec + tox + dry
Then the execution layer advances multiple garbage_sort() actions in sequence, rather than having the underlying YOLO node handle all complex logic at once.
So what is reflected here is:
The large model is responsible for understanding natural language intent
YOLO is responsible for recognizing garbage label targets
The robotic arm is responsible for executing gripping and sorting
When the three are combined, the system can support more natural expressions.
5. Runtime Behavior Description
After entering a garbage classification command in the terminal, the program typically runs through the following flow:
The large model first returns a natural language response, e.g., "OK, I will now start sorting the recyclable waste on the table."
The execution layer outputs an action function, e.g.,
garbage_sort('rec')The robotic arm first returns to the observation position
The YOLOv11 node starts identifying garbage label wood blocks on the table
If a target is identified, the robotic arm grips and places it in the corresponding area
If no target of the current type is detected, the system will respond with "No garbage of this type found"
If the user gives a "keep a certain type of garbage" command, the system will repeat the above process multiple times until all the types of garbage that need to be cleaned up are processed.