Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Content

After a long journey about the Mathematics of Forward Kinematics and the geometrical details of gradient descent, we are ready to finally show a working implementation for the problem of inverse kinematics. This tutorial  will show how it can be applied to a robotic arm, like the one in the image below.

The other post in this series can be found here:

At the end of this post you can find a link to download all the assets and scenes necessary to replicate this tutorial.

Files

Previews only

Comments

James Young

Question for you, I have implemented your code on a robot that has suction cups on the end of the arm and everything works great as is but I am curious as to how I could put constraints on the joint scripts so that the suction cups will always point down regardless of the other joint positions.

Alan Zucconi

Hi James! A lot of the "out of the box" solutions implement a derivation for the "optimal" IK, which doesn't allow for any kind of customisation. This is exactly why I wrote this tutorial: because I wanted a more refined control on how to reach for the object! What you're taking is definitely implementable! If you check the tutorial about tentacles, you'll see something about the ErrorFunction. This is the function you can use to evaluate how "good"/"bad" a specific configuration is. What you need to to do is to add a cost that makes sure that when the suction cup is not pointing down, the solution should be "worse". The easiest way to do it is to do the dot product between the transform.foward of the suction cup object, and the down vector (assuming the suction cup points downwards). When the value is close to 1, it means that the cup is pointing down. You can rescale this value appropriately and add it to your error function, so that it penalises solutions which do not have the constraint you want!

Alan Zucconi

Hi Eduardo! It seems those are rather different problems. From one hand, you have the tracking problem. I do not know which type of data you are getting from the sensors. Usually IMU sensors are not very reliable and tend to "drift" over time without some proper compensation. That is something that can be done in many ways; I have a tutorial on Kalman filters, and I am working on a much larger one on the same topic which will cover this a bit more in details. This tutorial is about inverse kinematics, which sounds like a very different problem to what you are trying to do. You have the final position where the arm should go, and IK finds a way to rotate the joints to get there. If I understand correctly, you already have the joint rotation from the IMU sensors, and you want to move the arm accordingly to match those ones. Right? If that is the case, your IMU data should affect the local rotation of the joints (localEulerAngle?) but this really depends on the type of data you are getting out of the sensors.

Eduardo Cardenas

Hello, Thank you for your quick response, I will start by doing an investigation on Kalman filters, I will be aware of your tutorial I hope to see you soon. I would like you to do a tutorial on "Tracking" in Unity3d with the use of IMU, there is very little information that exists about this and it is somewhat complicated and difficult to learn as a beginner, I would be very helpful for my project. Thank you