# Inverse kinematics for 4-DOF Articualted manipluator

Robotics Asked by Oualid on October 3, 2021

I am trying to find out the math formulas for Inverse Kinematics for a 4-DOF articulated manipulator.

By Googling I found information about inverse kinematics for 3-DOF, 4-DOF and 6-DOF articulated manipulator, but very few information for 4-DOF robot arm.

But what I found is a paper explaining how to calculate FK and IK for a 4-DOF robot arm:

Kinematics Modeling of a 4-DOF Robotic Arm

I tried to implement the math formula in C code but the calculation doesn’t seem to work.

I believe that the formulas are wrong.

The math formula algebraically is the as follow:

dx, dy and dz are the global en effector coordinates.

Angle phi is the end effector orientation.

The C-code looks like this:

#include <stdio.h>
#include <math.h>

#define M_PI   3.14159265358979323846264338327950288

#define deg2Rad(angleInDegrees) ((angleInDegrees) * M_PI / 180.0)

int main()
{

float l1, l2, l3, l4;   // Links mm
float dx, dy, dz;       // EE position
float phi;              // EE orientation
float theta1, theta2, theta3, theta4;   // Joint variables that will be calculated
float A, B, C;

l1 = 170.0;
l2 = 45.0;
l3 = 85.0;
l4 = 130.0;
phi = 0.4;

dx = 30.0;
dy = 15.0;
dz = 20.0;

theta1 = atan(dy/dx);

A = (dx - l4 * cos(theta1) * cos(phi));
B = (dy - l4 * sin(theta1) * cos(phi));
C = (dz - l1 - l4 * sin(phi));

theta3 = acos(((A*A+B*B+C*C)-(l2*l2)-(l3*l3))/(2*l2*l3));

printf("theta1: %fn", theta1);
printf("A: %fn", A);
printf("B: %fn", B);
printf("C: %fn", C);

printf("theta3: %fn", theta3);

return 0;
}


When I calculate theta3 I get nand because what is inside acos is greater than 1 and acos can’t have a value greater than 1. The conclusion is that something is wrong with the formulas.

Any suggestion?

Answered by Oualid on October 3, 2021

If your image is correct, it appears that you have a "planar 3 link arm" mounted on a turn-table. If so, I would suggest that you decompose the problem into yaw (joint 1), and X/Y in the plane (joints 2-4). It will probably be easiest to use polar coordinates.

You should be able to find many solutions online for a planar 3 link arm.

Answered by Ben on October 3, 2021

## Related Questions

### How to design a robot chassis so as to avoid bending issues?

1  Asked on October 3, 2021 by jash

### Can I use a breadboard to power multiple SG90 servos?

0  Asked on October 3, 2021

### Moment of Inertia of a Dumbbell

2  Asked on October 3, 2021 by kucar

### Are there any tutorials for OMPL in Python?

1  Asked on October 3, 2021 by batini

### Arduino and stepper motor

2  Asked on February 19, 2021

### Is it OK to apply too many volts to Actobotics HD motors?

1  Asked on February 9, 2021

### Is the covariance matrix in the extended Kalman filter guaranteed to be positive definite (ignoring numerical errors)?

1  Asked on January 20, 2021

### Pictures coordinates to robot coordinates

1  Asked on January 14, 2021 by dairon

### Not able to communicate with Roomba with serial port

1  Asked on January 9, 2021 by aalian-khan

### Directly tapping Create2 battery through vacuum brush

2  Asked on January 6, 2021 by xabigarde

### How to obtain the state space representation of a computed torque control system?

3  Asked on December 27, 2020 by james_erikson

### Is it compulsary to learn Arduino programming in order to use Udoo Neo as an IOT device?

1  Asked on December 24, 2020 by farhan-ahmed

### Path planning algorithm better than RRT* and Artificial Potential Field

2  Asked on December 21, 2020 by nikthebrick

### How can I allow for this code to switch from remote control to autonomous?

1  Asked on December 15, 2020 by stackcode12

### Not getting expected performance from kalman filter+mahalanobis distance

1  Asked on December 14, 2020

### A Delivery Drone

1  Asked on December 6, 2020 by will

### How to convert vertical motion to horizontal?

5  Asked on December 4, 2020 by boardbite

### What should be the required operating voltage for Servo motors in my 5 DOF robotic arm, with 50 kg payload

0  Asked on November 18, 2020 by muzammil-ibrahim

### Monobrick Communication Library-reading nxt sensors

2  Asked on October 31, 2020 by jpcreeper13

### Res-Scaling method beats PID controller. How?

1  Asked on October 26, 2020 by pe-dro

### Ask a Question

Get help from others!