Note: Becasue ros1 and ros2 are both installed, each time you open a new terminal, please choose 1 (ros1) or 2(ros2)
Open a new terminal and input 2. Then click enter.
8.1 Color recognition
8.1.1 Function introduction
The idea of using OpenCV for color recognition in ROS is to use cv_bridge to convert the ROS image message into OpenCV format, and then apply color threshold filtering on the image to extract the color range of interest. Label detection results, e.g. by drawing bounding boxes, and publish the results to a new ROS topic for use by other nodes. The process includes image acquisition, color space conversion, threshold processing, and result release, allowing the robot to identify target color areas in real-time.
8.1.2 Running function
Note: Before running the command, please make sure that the programs in other terminals have been terminated. The termination command is: Ctrl+c.
Start the camera.
ros2 launch astra_camera dabai.launch.py
if this doesn't work, try:
ros2 launch orbbec_camera dabai.launch.py
Enter the command to launch the color recognition.
ros2 run limo_visions recognition
8.2 Color following
8.2.1 Function introduction
The idea of using OpenCV for color recognition in ROS is to use cv_bridge to convert the ROS image message into OpenCV format, and then apply color threshold filtering on the image to extract the color range of interest. Mark the detection results, and then determine whether it is necessary to publish data to the /cmd_vel topic based on the detection results.
8.2.2 Running Function
Note: Before running the command, please make sure that the programs in other terminals have been terminated. The termination command is: Ctrl+c.