## bebo323 3 years ago I am trying to use my inverse kinematics m file from Hw 12 problem 2b to finish the inverse kinematics code in the lynx6.m file for the demo. I have been adjusting my code all evening to get my results to match the ones in Hw 12 solution. I have 3 of the 5 angles correct but I can not get the other 2 correct. The thing about it is the angles that are correct depend on the angles that are wrong. I get wrong values for alpha2 and alpha3. Alpha3 is the first angle I calculated in the program. I think the problem is in the creation of Pw = g*inv(g6). I use Pw to get my x, y and z values.

1. bebo323

Can you help?

2. bebo323

I am using the linklen values 80, 155, 155, 30 and 70 and the gi configuration from Hw 12 problem 2 as inputs to my function file that contains the inverse kinematics

3. bebo323

Are the solutions to hw 12 problem 2b correct?

4. Chipper10

You could try doing the gf inverse kinematics. I'm sure at least one of them is correct. Aside from that, I would just do some print statements to see if things look the way they're supposed to look. For instance do you get a pure rotation matrix when you do gw^-1*ge*g6^-1? That kind of thing. Also it may be useful for your partners to take a look at it. They may notice a mistake that you don't.

5. bebo323

Correy and I have been working on this since Thursday. I have reduced the code down to just getting alpha3 correct with no luck using gi or gf. I figured if I can get the first and easiest angle correct there is no since correcting the rest of the code. I have not tried the gw^-1*ge*g6^-1 yet. I will try that and see what I get.

6. Chipper10

Yeah just start with the simplest thing - see if you are getting the position of the wrist correct. For instance if you set all joint angles equal to 0 except the last 2, you should get pack a wrist position of (0,0,z) because the wrist wouldn't have moved in the x or y.

7. bebo323

I do get a pure rotation when I do gw^-1*ge*g6^-1

8. Chipper10

Ok well it sounds like you're getting the first three angles right then.

9. bebo323

If I set alpha1, 2, 3 and 4 = 0 and alpha5 and alpha6 not = to 0 I should get (0, 0, z) as a position?

10. Chipper10

Does the position of the wrist change in the case you described?

11. bebo323

It will take me time to code the program to accept individual angles (alpha1, 2, 3, 4, 5, 6) as opposed to an end effector and give position

12. Chipper10

I'm sure you know how to make an end effector configuration given some joint angles. In fact you have a function that does that.

13. bebo323

I can easily make the program

14. Chipper10

You don't need to make any program. Just calculate the end effector configuration that you want to input.

15. bebo323

I have a program that gives me an end effector given angles. I entered the end effector into my inverse kinematics program to give me back the same angles. The angles I entered where [0 0 0 30 55] in degrees, the angles I got back were [ 0 -0.0031 0.0062 -2.9976 -1.5508].

16. Chipper10

Ok so the first 3 look right. Now you just need to get the last 2

17. bebo323

Is linklen 1 and 2 combined or linklen 4 and 5? In our manipulator linklen 1 and 2 are combined.

18. Chipper10

It's up to you how you want to do it as long as it makes sense in your forward kinematics

19. bebo323

I just wanted to get this inverse kinematics working but I can not even get it to give me the first angle correct. I did not think of creating my own end effector with know angles to test the inverse that was a help. I will keep working on it and hope I figure it out.

20. Chipper10

Why do you think your first angle is incorrect? Seems to be correct to me

21. bebo323

My first angle has been 'correct' so far in all of my tests. The first angle as I calculate it is based on alpha3 as well as alpha2. Since alpha3 is not correct that implies everything based on alpha3 is incorrect.

22. Chipper10

I don't understand that. Alpha1 only depends on xw and yw right?

23. Chipper10

Also why do you think your alpha3 is wrong?

24. bebo323

I do not get the answer on Hw 12 problem 2b when I enter in the gi or gf as my end effector.

25. Chipper10

Well remember that there are a few different solutions if you gw^-1*ge*g6^-1 gives you a pure rotation that's a pretty good sign that your alpha1,2,3 are right.

26. bebo323

I do get a pure rotation when I calculate gw^-1*ge*g6^-1

27. Chipper10

Ok then most likely your 1,2,3 are right. gotta go

28. bebo323

thanks later

29. bebo323

I have all my alphas correct but only if I chose the correct options. Option one: the inverse cos of alpha3 can be plus or minus from that I use the quadratic equation and get more possible answers. If I make a choice of +cos^1 or -cos^-1 and which omega to use, run the program, see the answers do not apply, I can make different selections and rerun the program until I do get all 5 angles correct. Am I making this harder than it needs to be? Do I need to put in conditional statements to avoid incorrect answers? How do I deal with the opnning and closing of the gripper?

30. Chipper10

Last question first: an input to your function should be w, the width of the object which I will input at the demo. Yes you need to figure out automatically which angles are the correct ones. You can check the first angle you find to see if it is within alphalims. If it is, continue down that line. If not, try the other one. Etc.

31. bebo323

I was thinking of having the inversekin m file recreate all 16 end effector possibilities using the 16 vectors of alphas it calculated. Then comparing each reconstructed end effector to the inputted end effector. Once a match is found the inversekin would select that vector of alphas as the correct alphas.

32. Chipper10

That still ignores the possibility that one of the commanded angles is outside the alphalims right?

33. bebo323

Yes but since I do not actually know the correct alphas (in a real life setting), I do not see a way to correct that problem. Unless I place a condition on the inversekin m file to ignore angles outside a range of approved angles.

34. Chipper10

When you're testing your possible angles to see if they match the given end effector, throw out any vectors that include angles outside your range. I mean at the end of the day you actually have to pick something up and put something down. It's your job to make sure that actually happens.

35. bebo323

My range is between -90 to 90 on all angles. The hw12 problem 2b end effector configuration had an angle of 2*pi/3 = 120. A simple < or > conditional statement is incomplete when I encounter these angles.

36. Chipper10

I don't understand what you mean. You cannot determine if a given angle is between -90 and 90?

37. bebo323

No. I am working on what you said. One moment

38. bebo323

I did not think of dismissing vectors of angles because one angle in that vector is out of range.

39. bebo323

That would not dismiss all but correct answer but that should reduce the number of end effectors I need to calculate.

40. Chipper10

Yeah there will still be a few correct answers. Just pick one

41. bebo323

Ok if you have time can we go over this gripper part? I have not gotten into it but can you discuss the idea of where it gets inputted to. I mean if I have the gi and gf end effectors so I am oly entering two things in and I now know I will have a gripper open and close value Where and how will the program know when to execute it?

42. Chipper10

So there is some kind of routine that your manipulator should go through as defined in the homework. At some point it closes the gripper to some value. Instead of hardcoding that value, leave it as a variable which I can input into the function.

43. bebo323

I am getting complex numbers in my rotation matrix. atan can not deal with complex numbers. If the quadratic formula gives a comlpex number can I disregard that number as an option for creating alphas?

44. Jaynator495

Welcome To OpenStudy! Here you will find great helpers and friends, a community of students that help students! We hope you enjoy the experience!