Move the AL5D-Arm under his platform level

Hi!

I require your help regarding a problem I’m encountering.

Description:
For a small project at our university my fellow students and I are using the AL5D-Robotic-Arm Kit in connection with the PS2-Controller and the botboarduino.

We mounted the arm on platform. So far everything worked fine except that we could not move the arm below the platform level.

Is there a kind of limitation programmed in the code?

How could we change the code so that we can reach lower levels?

Hardware concerned:

  • AL5D-Robotic Arm
  • Botboarduino
  • Lynxmotion PS2 Controller

Software concerned:

  • PS2_Control

Troubleshooting steps already taken:
We read the code but we are not very experienced in arduino-programming, so we couldn’t solve our problem.

Additional information:

Thank you so much in advance for your help!

1 Like

Hello @Simon_HM!

Welcome to the RobotShop community!

First, my apologies in getting back to you. I was assigned your post and erroneously thought I had already answered it (was still in draft!).

Yes, the default example for 2D IK (inverse kinematic) has that limitation based on how it does its calculations.
I assume when the example code was developed the arm was attached to a flat platform (i.e.: table-like surface) and therefore could not physically dip below the base.

The 2D IK code is in the Arm function:

int Arm(float x, float y, float z, int g, float wa, int wr) //Here's all the Inverse Kinematics to control the arm
{
  float M = sqrt((y*y)+(x*x)); // radial length between the base axis and the gripper axis
  if(M <= 0) // if the angle is less than 0, do not attempt to move there
    return 1;
  float A1 = atan(y/x); // The calculation above determines the angle between the horizontal and the angle formed between the shoulder axis and the wrist axis. 
  if(x <= 0) // if the angle is less than 0, do not attempt to move there
    return 1;
  float A2 = acos((A*A-B*B+M*M)/((A*2)*M)); // This is the angle between the line formed between the shoulder axis and the wrist axis and the line formed between the shoulder and elbow
  float Elbow = acos((A*A+B*B-M*M)/((A*2)*B)); // This is the angle between the line formed between the elbow axis and the shoulder axis and the line formed between the elbow axis and the wrist axis
  float Shoulder = A1 + A2; // This is the angle between the horizontal and the line formed between the shoulder axis and the elbow axis
  Elbow = Elbow * rtod;
  Shoulder = Shoulder * rtod;  
  while((int)Elbow <= 0 || (int)Shoulder <= 0) // if the angle is less than 0, do not attempt to move there
    return 1;
  float Wrist = abs(wa - Elbow - Shoulder) + 7.50; // the wrist is not included in the above calculations and is set at a predetermined angle w.r.t. the horizontal.
#ifdef DIGITAL_RANGE
  Elbow = map((180 - Elbow) * atop, 500, 2500, 900, 2100); // convert the angle to pulse for the elbow
  Shoulder = map(Shoulder*atop + 500, 500, 2500, 900, 2100); //convert the angle to pulse for the shoulder
#else
  Elbow = (180 - Elbow) * atop;
  Shoulder = Shoulder * atop + 500;
#endif
  Wrist = (180 - Wrist) * atop + 500;

For more details on the 2D IK example code you can read more about it here:
AL5D finding xyz position (the entire thing might be a useful read, but detailed explanations start here)
Inverse kinematics 3 dimensions pi

Sincerely,

1 Like