Serial Control of Robotic Arm (2/2)

This is an extension to an earlier notebook entry. It is also part of a greater project which aims to have an autonomous robotic arm operating with a camera.

Please feel free to ask any questions regarding this project or make suggestions on how to improve it.

Writing in Progress

This entry is still being edited and some elements may not be included yet.

Updates from Last Entry

  • Arm can now operate from serial commands instead of pre-programmed behavior
  • Arm commands can be based on coordinates or angles (as opposed to percents)
  • Springs were removed since they interfered with the algorithm for converting positions to angles
  • The last "joint" was reversed to allow for greater mobility

From Coordinates to Angles

Information

Note: o1,o2,o3 correspond to theta1, theta2, theta3. The oe variable corresponds to the angle of the wrist at pickup. In our case, it was set to -90 degrees.

float* robo::calculateangle(float x1e, float y1e, float oe, float angles[]){      

float a1 = 95;//mm's from length from base to elbow;
float a2 = 110;//mm's from length from elbow to wrist;
float a3 = 45;//mm's from length from wrist to claw;

float ce = cos(oe);
float se = sin(oe);

float o2 = -acos(  ((x1e-a3*ce)*(x1e-a3*ce) + (y1e-a3*se)*(y1e-a3*se) - a1*a1 - a2*a2) / (2*a1*a2)   );

float s2 = sin(o2);
float c2 = cos(o2);

float delta = a1*a1 + a2*a2 + 2*a1*a2*c2;
float det1 = (x1e-a3*ce)*(a1+a2*c2) - (y1e-a3*se)*(-a2*s2);
                                    
float o1 = acos(det1/delta);
float o3 = oe-o1-o2;

angles[0]= o1;
angles[1]= -o2;  //Had to use negative sign to reconcile with arm configuation.
angles[2]= -o3; ////Had to use negative sign to reconcile with arm configuation.

return angles;
}

Camera Control

Import programArm_Serial_Coordinates

Takes in serial coordinates (in mm) and moves servos in Lynxmotion AL5 arm accordingly.

Next Steps

Logical next steps would include the ability for the arm to pick up objects that are not placed directly in front of it. This would involve moving the "spin" motor until alignment has been achieved.

For more information about other parts of this project please visit my project website


Please log in to post comments.