Sunday, September 30, 2018

Visual Robotic Arm Position Identification  using Deep Learning and CNN


    This post is looking into solutions to use Artificial Neural Networks and  Deep Learning  methods to determine the position in the XY plane of a robotic arm end pin ( effector)  using visual recognition and Deep Learning algorithms applied thru Keras and Tensorflow.

   It is a lot to describe and absorb in the above paragraph, so I will start with the target description and work back from there,
  This post will not describe the theory supporting the application but merely a practical approach based on the huge amount of free source available "out there"
   In the associated post I described an I2C robotic arm deives by using I2C IMUs  and  the associated hardware / software bundle.
    The use of the I2C sensors is driving a real messy hardware installation with the I2C network management.
   True is that the most of the complications with harness is coming from the limited range of addresses available for the MPU6050 sensors (cheap) which i use.





   Obvious the arm in the close view is the I2C one usinfg IMU sensors.
   As I was reading more about Deep Learning and AI applications I looked for me that maybe a simpler way to "measure" the parameters defining the arm end effector position.
   I could see it as an application where the "categories" defined in the image recognition process are actually well defined X,Y position of the end effector characterized by a distinct shape of the robotic arm visualized with eventually a wide angle computer connected camera.
This is what the camera would see eventually:


And images taken in different points (and arms angles) look something as :

Note: To list your cameras you can use under Python:

======================================
def list_cameras():
    import cv2
    for cnt in range(0,612,1):
        img=[]
        cap = cv2.VideoCapture(cnt) # device 1
        img=cap.read()[0]
        if img:
            print 'Video', cnt,img
        cap.release()
    return 
========================================================