As a semester project for a university course, I built and programmed a robot capable of detecting an object with machine vision, picking it up, and placing it at another location. The robot consists of two servo motors and a rack-and-pinion linear actuator equipped with an electromagnet for picking up items. This specific type of robot is also known as a 3 degree-of-freedom SCARA pick-and-place machine.
The hardware is interfaced with a programmable-system-on-a-chip (PSOC) by Cypress. In terms of software, the robot was programmed in C alongside Python for its machine vision capability through the OpenCV library.
The robot works using the following process: first, object detection by webcam is achieved by performing a machine vision procedure known as background subtraction. Next, the pixel location of the object is calculated through an algorithm similar to the calculation of the center of mass that instead finds the “center of brightness” of the processed image. Then, the pixel location is converted to a physical location using knowledge of the webcam’s field of view. The object location data is propagated to the PSOC using serial communication. Next, the trajectory of the servos are calculated using inverse kinematics and the motion of the linear actuator is controlled with a proportional-derivative (PD) control algorithm. Finally, the robotic manipulator moves toward the object, lowers the electromagnet, picks the object up and places it at another location. See the robot in action in the video below.