File Exchange

## Inverse Kinematic for 6DOF arm

version 1.0.0.0 (1.74 KB) by Andrea Cirillo

### Andrea Cirillo (view profile)

It calculates Inverse Kinematic for 6DOF anthropomorphic arm with spherical wrist.

Updated 31 Jan 2011

% Anthropomorphic arm with 6 DOF and spherical wrist
% It calculates the Inverse Kinematic of an Anthropomorphic arm with 6 DOF.
% 'q' is the solutions in radiant and K is the direct Kinematic matrix.
%
% K = [ n s a p;
% 0 0 0 1]
% where n, s, a are three vectors fo 3 elements that represents the
% end-effector's orientation, and p is the desired end-effector position.

### Cite As

Andrea Cirillo (2020). Inverse Kinematic for 6DOF arm (https://www.mathworks.com/matlabcentral/fileexchange/30243-inverse-kinematic-for-6dof-arm), MATLAB Central File Exchange. Retrieved .

BlueEyes

### BlueEyes (view profile)

A control structure should be provided, as follows
----------
c3=(pw_x^2+pw_y^2+pw_z^2-a2^2-a3^2)/(2*a2*a3); % cos(teta3)
if c3 > 1.0
fprintf('\n\n cos(angle) > 1 \n (the problem is ill defined) \n\n');
exit
end
----------
to avoid
Error in ik6dof (line 38)
teta3=atan2(s3,c3)
which happens when c3>1

Michael Blas

Rahul Jain

### Rahul Jain (view profile)

is anyone have cpp code for solving inverse kinematics?

Roman Werhowod

### Roman Werhowod (view profile)

I'm trying to write your code in c#, because of my master thesis and I have some problems with the input argument. How can i calculate the inverse kinematics when all i have is the DH-Matrix and a vektor with position and orientation of my desired endeffector position?

Roman Werhowod

### Roman Werhowod (view profile)

I'm trying to write your code in c#, because of my master thesis and I have some problems with the input argument. How can I calculate the inverse kinematics when all I have is the DH-Matrix and a vector with position and orientation of my desired end-effector position?

Coralie Belhaj

### Coralie Belhaj (view profile)

Hello Andrea ! I have the same question as the others. Can you give us an example of the input arguments please ?

ilya bonder

### ilya bonder (view profile)

i have a project in invers kinematiks to do and I need help
pls anyone

Uede Max

### Uede Max (view profile)

Can someone explain, why c2 and s2 are defined but actually not in use for the code? Apart from that, code runs smoothly.

Luis Hernandez

### Luis Hernandez (view profile)

hi andrea, i am taking your code as base to 3D simulation using matlab, can you show an example of how you define your variable input (direct Kinematic matrix) i have the error in line 22 of input arguments, i know n,s,a are the end effectors orientation and p is just the position how i make that input?

Aakash Kamalapur

### Aakash Kamalapur (view profile)

andrea...the script works fine ...however, the solution which the script returns if run through the forward kinematics algorithm of 6 dof anthropomorphic arm doesnt return the rotation and orientation matrix which was entered in the argument section of your script? have you ckecked the validity of the solution against forward kinematics algorithms.

@Andrea I understand from the code that we have to enter the input parameters which define the end-effector position and orientation. Just for reference, can you give an example of these input parameters? Values that are 100% certain to work with this code? I tried to input my own parameters but the code didn't run. Thanks!!

### Amira Nadjah KOUNTAR (view profile)

I got this error when I run the program
Not enough input arguments.

Error in ik (line 22)
dk=K; % Position and orientation of end-effector

Dorian Buksz

### Dorian Buksz (view profile)

I have changed the DH parameters and provided the right forward kinematics matrix, but I get this:

Error using atan2
Inputs must be real.

Error in ik6dof (line 38)
teta3=atan2(s3,c3)

Ahmed El Hussieny

Andrea Cirillo

### Andrea Cirillo (view profile)

The script work fine. You have to specify as input variable the homogeneous matrix that express the end effector frame with respect to the base frame of the robot. Please, refer to the Description reported in the script file.

The script doesn't work:
Error using ik6dof (line 22)
Not enough input arguments.

Andrea Cirillo

### Andrea Cirillo (view profile)

@Massimo
- It consider only a set of coordinate in order to avoid singularity conditions, which are not managed in the script
- The use of the EE coordinate is a choise of the author and it is not an error

Massimo

### Massimo (view profile)

This script doesn't work:
- it considers only a set of coordinate
- you are using the EE coordinate instead of the wrist coordinate.

kapse@coep swapnil

### kapse@coep swapnil (view profile)

How run this file???

mail me :kapse.s.s@gmail.com

##### MATLAB Release Compatibility
Created with R2010b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux