ABB robotic quaternion euler calculation

Hello,

I am developing my own abb invert kinematic robotic plugin for a specific project.
However I need understand all the calculation to feed the rapid code.
Someone can quickly explain how to calculate the number needed (Please have a look to the red rectangle on the image below) acording to the oriented planes.

Best,

Amaury

They are quaternions (euler would be 3 numbers). You can check my robots plugin: http://www.github.com/visose/robots

1 Like

I just recently heard about “Quaternion Rotation” from @Michael_Pryor - sounds fascinating:

More here:

1 Like

If you just want to convert planes to quaternions, this is the code I use:

public static double[] PlaneToQuaternion(Plane plane)
{
var q = Quaternion.Rotation(Plane.WorldXY, plane);
return new double[] { plane.OriginX, plane.OriginY, plane.OriginZ, q.A, q.B, q.C, q.D };
}

Or you want to interpolate 3d rotations? That’s more tricky and theres no “best” way, but a usual way is using axis angle, this is the code I use:

public Plane CartesianLerp(Plane a, Plane b, double t, double min, double max)
{
t = (t - min) / (max - min);
if (double.IsNaN(t)) t = 0;
var newOrigin = a.Origin * (1 - t) + b.Origin * t;
Quaternion q = Quaternion.Rotation(a, b);
q.GetRotation(out var angle, out var axis);
angle = (angle > PI) ? angle - 2 * PI : angle;
a.Rotate(t * angle, axis, a.Origin);
a.Origin = newOrigin;
return a;
}

4 Likes

Hi Vicente, have you seen these ones from Daniel?

1 Like

Not that one, but an older one, which I reference in the github repository:

    /// <summary>
    /// Quaternion interpolation based on: http://www.grasshopper3d.com/group/lobster/forum/topics/lobster-reloaded
    /// </summary>

Slight advantage of my code is a bit less newing and follows c sharp conventions rather than Daniel’s weird pascal case on parameters and local variables :stuck_out_tongue:

1 Like

:smiley: then I am sure you will love his QuaternionSpline.gh Obfuscation

1 Like

thanks a lot for your help, I will look at this carefully !!!

Very creative. I was learning a bit of JavaScript recently and my first thought was that I opened the minified version.

Here’s a very special application where quaternions can help - Avoid Gimbal Lock or you are going to Burn! (you are still going to get smoked, but anyway) :slight_smile:

https://twitter.com/VergaraLautaro/status/977215144509034497

// Rolf

2 Likes

Thanks a lot, I had time to have a look to your code, it was very helpful !!! now I need to create the socket the send the rapid code !!!