Computer Vision codebase for ABU Robocon-2024 Automatic Robot | Part I: Determine Destination for Robot Navigation
For this year's theme, it was necessary to build an automatic robot that can navigate to pick up Rice Grains (representation of selecting good paddy rice among bad ones). In the Zone 3, there would be Empty Grain (Purple Color) and Rice Grain : Team Color (Red or Blue). Automatic robot needed to pick up Rice Grain and store them in vessels & the scoring was done on the basis of which team stored more grains.
This is a ROS2 humble python package. It uses depth camera (OAKD Pro-W) to get the aligned RGB and depth frame. The RGB frame is published to a topic and YOLOv8-ROS detects Empty Grain and Rice Grain. Then using the location of bounding box of Rice Grain obtains their location in gamefield using the depth-map published by OAKD camera. And, the nearest Rice Grain as per robot's position is set as target. Then, the goalpose(destination) is calculated as per proper offset considering robot's dimensions and the target location. The goalpose is continuously published continuously at 20Hz and updated depending upon the inference time of YOLOv8 model.
- OAKD Pro-W Camera
- Optional: A machine with discrete GPU (for quick model inference & real time performance)
- Ubuntu 22.04 LTS Jammy Jellyfish (as ROS2 Humble is supported here)
- ROS2 humble desktop
- colcon - to build ROS2 packages
- rosdep - to manage dependencies
- YOLOv8-ROS package
- map -> base_link transform in TF_tree
- map -> base_link transform as Odometry msg in "/odometry/filtered" topic
- An accurate estimation of base_link -> oak_rgb_cameralink_optical transform in the config file config/base2cam.yaml
- Custom ROS2 messages: oakd_msgs
- Optional: Gamefield URDF published in RVIZ2
- depthai - for interfacing OAKD camera
- opencv - for image processing
- scipy - for representing Rotation (Orientation) of robot & destination as well as easy conversion from Euler Angles to Quaternion
- numpy - for matrix operations
| Change the config files in the config directory as per necessity.
-
Put the required packages mentioned above in same workspace i.e. inside src directory. Then, install dependencies using rosdep. Dependencies can be seen in package.xml and it can be installed manually.
sudo rosdep init rosdep update
rosdep install --from-paths src -y --ignore-src
-
Using colcon build packages from the workspace directory using symlink (so that changes in codebase is directly implemented without rebuilding (not in C++))
colcon build --symlink-install
-
Source the installed files
source install/setup.bash
-
Run this high level python launch file to run all the nodes
ros2 launch oakd oakd.launch.py
If you want to run individual nodes, you can run them as per their name in setup.py. Also, you can launch individual launch file for grouped functionality as per their name in launch directory.
Guide for running nodes from CLI
Launch file tutorials