Convert Eulers to At,Right,Up Vectors

Typically: "How do I... ", "How can I... " questions
Post Reply
cmayer777
Posts: 4
Joined: 02 Sep 2014, 04:01

Convert Eulers to At,Right,Up Vectors

Post by cmayer777 » 21 Sep 2014, 08:55

I figured out by trial and error that V-Rep uses X, Y, Z right handed for it's Euler angles.
(Is this in the docs somewhere that I missed?)
(Why don't you call it X Y Z, instead of alpha beta gamma, which is useless info.)

I want to determine if my robot is face down or face up, so I need to convert to an At, Right, Up matrix. I really only need the At vector for now, so if the Z component of the At vector is positive, he's face up. (The closer to 1.0 the better of course.)

So far, no one has posted this common and useful code. Does anyone already have this and would like to share?

Thanks!

Oh, BTW, my robot's orientation, when Euler's are (0, 0, 0), is At = (1, 0, 0), Right = (0, -1, 0), Up (0, 0, 1).


coppelia
Site Admin
Posts: 7396
Joined: 14 Dec 2012, 00:25

Re: Convert Eulers to At,Right,Up Vectors

Post by coppelia » 22 Sep 2014, 01:52

it is not called X Y Z to avoid confusion with the X Y Z coordinates.

Have a look also at simGetObjectMatrix. The you can retrieve your desired X, Y and Z vectors with:

Code: Select all

m=simGetObjectMatrix(objectHandle,-1)
xAxis={m[1],m[5],m[9]}
yAxis={m[2],m[6],m[10]}
zAxis={m[3],m[7],m[11]}
It is a right-handed system, so you will have to adjust some signs. Basically the xAxis, yAxis and zAxis represent the red, green and blue arrows of a selected object.

Cheers

Post Reply