Robot arm inverse kinematics, finding a side length

128 Views Asked by At

I am working on firmware for a robot arm. I need to move the robot in the X direction by any given number. In this example, the arm is being moved by 10cm. Here is a diagram of it:

enter image description here

In the diagram, I only know the angles of the red line, which in this example is all 80 degrees.

The red line is the current position, and the blue line is the position that the arm will be moved to.

In the image, notice the large green arrow pointing to side 'a'. I need to solve this.

I made this sketch in Fusion 360, so I know that the answer is 111.937cm.

I tried doing 90cm plus the distance being moved (10cm). I also tried 90cm plus the X-pos. But this of course does not work.

1

There are 1 best solutions below

1
On BEST ANSWER

The robot arm has a home position, and it will be moved home every time it turns on. The home function always sets all the angles to 90 degrees:

image

The problem I face is calculating the X distance is when the Y position is not 90 degrees (and vice versa). So, I can simply save this distance in a variable called 'Xvar'.

int Xvar = 90;  // Length of arm

void MoveX() {
    newDistance = Xvar + distance;
    // Save
    Xvar = newDistance;
}

Here's the math:

image

Here's the triangle to solve:

image

In the image, you can see that you can solve side 'a' by doing:

a = Xvar + distance;

Then save side 'a' in Xvar:

Xvar = a;

From there, you can finish solving the triangle, and then the rest of the MoveX function.

I use this website to help solve triangles:

https://www.mathsisfun.com/algebra/trig-solving-triangles.html

Basically, I was overthinking this.