This project was developed as part of the ROBOgames competition organized by the Computer Science Engineering Department of the University of Moratuwa in collaboration with SLT Mobitel. The competition consisted of three stages:
- Elimination Stage: Participants designed a robot using the Webots simulator to pick red and blue balls and place them in a basket in a specific pattern.
- Final Competition: Participants used a Kobuki robot equipped with an Xbox Kinect camera to identify red and blue balls and push them into corresponding holes. This stage involved the first approach to machine vision for many participants.
- Ball Detection: Using computer vision techniques to identify and distinguish between red and blue balls.
- Blob Detection: Implementing blob detection to locate the balls in the frame.
- Kobuki Robot Control: Interfacing with the Kobuki robot to maneuver and interact with the environment.
- Kinect Camera Integration: Utilizing the Kinect camera for depth and RGB data acquisition.
- Automated Ball Handling: Programming the robot to pick up balls and place them in specific locations based on their color.
The code for the project is located in the following directory:
/Final codes/TO upload/final_code.py
- Python 3.x
- OpenCV
- NumPy
- Freenect
- KobukiDriver
The code consists of several functions for various tasks:
-
Depth and RGB Acquisition:
- The
get_depth_and_rgb()
function retrieves depth and RGB frames from the Kinect camera.
- The
-
Blob Detection:
- The
blob_detect()
function detects blobs (balls) in the image within the specified HSV range.
- The
-
Drawing and Visualization:
- Functions like
draw_keypoints()
,draw_window()
, anddraw_frame()
are used for drawing keypoints, search windows, and frames, respectively.
- Functions like
-
Robot Control:
- Functions such as
push()
,grab_ball()
,carry_ball()
, andsearch()
control the Kobuki robot's movements to manipulate the balls.
- Functions such as
The code is well-commented and organized. Here's a brief explanation of key functions:
get_depth_and_rgb()
: Retrieves depth and RGB frames.blob_detect()
: Detects blobs (balls) in the image using HSV thresholding and blob detection.- Drawing Functions:
draw_keypoints()
,draw_window()
, anddraw_frame()
are used for visualization. - Robot Control Functions:
push()
,grab_ball()
,carry_ball()
, andsearch()
control the Kobuki robot's movements.
Feel free to fork this repository and contribute by submitting a pull request. For major changes, please open an issue first to discuss what you would like to change.