With Python & Opencv
In this project we have built a simple robot capable of retreving lego blocks. We have implemented Pyhton and Opencv to design the localization system. This is done by placing an IP camrea overhead the robots workstation and then using Python to detect and track objects that are in view of the camera. The robot is equiped with a gripper which lets us pickup and dropoff the lego blocks. Both the gripper and wheels are operated using an Arduino Due 32-bit microcontroller to control the servo motor, L293D motor shield and encoders.
Here's a short run down of the mechanical design. We used Siemens NX to produce the CAD model of the robot shown below along with the mechanical gripper. Then we used a 3D printer to produce the parts of the robots body and gripper. We used the 2 Pololu wheels as the back wheels and 2 casters at as the front wheels, we originally designed and built it with 1 caster as the back wheel but we found that there was too much error when driving. The top platform stores the Aruco marker, this marker will be at the center of the localization system. We'll use the overhead camera, Python and OpenCV to track this marker.
As said before we're using Python and OpenCV to track an Aruco marker, this marker is placed on top the robot which lets us track the robot. We use blob detection to find the lego pieces on the work area, we find and sort objects based on size and color. The Python program will detect the objects and robot then it will send commands to the Arduino port to move towards blocks and activate the gripper, this is done by creating move commands stored within a letter variable such as 'f' to move foward, Python will send this 'f' key to the Arduino via bluetooth to move foward when it finds an object. But first it must turn to the oppropriate angle relative to the lego, so we also include a calculation to find the angle of each object then create a turn command to send to the Arduino. When the robot gets into an offset distance from the lego when send a command to the Arduino to turn on the gripper. Below shows the detection of the lego pieces. For code Visit: Block-Detection-With-Python-For-Arduino
I'd love your feedback!