 # HELP!! INVERSE KINEMATICS CODE FOR SCARA ROBOT

I'm working on a project that draws whatever user draws. So i need inverse kinematics for the scara robot arm that moves to desired x and y position received from the user input device. Im an computer science engineering student im not that much good at robotics and im a beginner in electronics, this is for my academics project. can someone help me with this.

Im an computer science engineering student ... this is for my academics project.

Excellent project, but it sounds like you are missing [u]some really important course prerequisites[/u].

Ask your professor which those might be; take the courses, and then you will be in a great position to write the code yourself.

That way you can actually make a contribution to society, rather than ask forum members to do your work for you.

Actually im at the end of the semester so i cant take courses right now. in my department they dont offer robotics or electronics courses for my department. I searched a lot in the internet and tried my things but nothing works and my teachers dont have much knwoledge in this field. I came here for the last try. Im not asking for the whole project just the IK part.

I wrote the below code.

#include<Math.h>
int l1=15,l2=15,x,y;
float teta1,teta2;
void calc_IK(int x_ip,int y_ip);
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
calc_IK(0.45,0.52);
}

void loop()
{
// put your main code here, to run repeatedly:
}
void calc_IK(int x_ip,int y_ip)
{
x=x_ip;
y=y_ip;
teta2=acos(((xx)+(xx)-(l1l1)-(l2l2))/(2l1l2));
teta1=-((l2*sin(teta2)x+(l1+l2cos(teta2))y)/((l2sin(teta2)y+(l1+l2cos(teta2))*y)));
Serial.println(degrees(teta1));
Serial.println(degrees(teta2));
}

Please use code tags </> to present code.

I didn’t check your formulas, just two hints:

Use “const” with constant values, i.e. for I1 and I2 if these are constants.

calc_IK should accept floating point values, not integers. I’d drop the global x and y variables, and declare

``````void calc_IK(float x, float y);
``````

And I’d add code to transform the calculated angles into the resulting positions of the robot arm, just to find out whether your calculations are correct.