Welcome to ROSMASTER X3 Plus repository
14.Recognizes color block and handling
14、Recognizes color block and handling
14、Recognizes color block and handling14.1. Using14.1.1. The first step14.1.2.The second step14.1.3.The third step14.2. Node graph14.3. Flowchart
14.1. Using
Note: [R2] of the remote controller has the function of [pause/on] for this gameplay. The first time you use it, you first perform color calibration.
The premise of using this function is that there is an already built map, and the Astra camera is activated by default.
Start command (robot side)
x#You need to enter docker first, perform this step more#If running the script to enter docker fails, please refer to 07.Docker-orin/05, Enter the robot's docker container~/run_docker.shroslaunch arm_color_transport transport_base.launch map:=my_map img_show:=false # Robotsroslaunch arm_color_transport transport_rviz.launch # virtual machine- Parameters map: The name of the loaded map.
- Parameter img_show: whether to open the image window separately.

The system identifies the topic name of the color block [/Transport/rgb].
14.1.1. The first step
Location
- The [2D Pose Estimate] on the left in [rviz] locates the pose of the robot on the map, which is the same as general navigation.
- The [2D Nav Goal] on the left in [rviz] is generally not used, and is the same as general navigation.
- The [2D Pose Estimate] on the right side of [rviz] sets the pose that the robot returns after completing the handling.
- [2D Nav Goal] on the right side of [rviz], set the target pose that the robot needs to carry after identifying the color block, and can set [red, green, blue, yellow] cyclically.
- [Publish Point] in [rviz], clear the target pose and return pose set by the robot.

14.1.2.The second step
If the settings image window is open it can be controlled using the keyboard keys.
Startup function (choose 1 from 2)
- Select the image window and hit the keyboard space bar.
- Within 0.5 seconds, click the handle【R1】button twice in a row.
Keyboard other key control (select the image window)
- Click the [Space] key: start recognition.
- Click the [r] key: the parameters are restored to their default settings.
- Click【q】key: Cancel the navigation and exit the program.
14.1.3.The third step
- Put the color block in the recognition frame in front of the camera, fill the recognition frame completely.
- The system automatically recognizes the color of the color block, and whistles to indicate that it is ready to be clamped.
- When the gripper is opened, put the color block into the gripper.
- The robotic arm clamps the color block and autonomously moves to the corresponding color target pose set in advance.
14.2. Node graph
xxxxxxxxxxrqt_graph

14.3. Flowchart
