corlab / rst-rt

Real-time Robot Control Types
GNU General Public License v3.0
0 stars 2 forks source link

Constructing a Rotation type not possible #12

Closed ndehio closed 7 years ago

ndehio commented 7 years ago

In the deployer, I am able to create a rotation by using the "quaternion" constructor: var rstrt.geometry.Rotation r = rstrt.geometry.Rotation(1,0,0,0);

Unfortunately, it is not possible for me to create a rotation by using the "euler" constructor and providing roll/pitch/yaw: var rstrt.geometry.Rotation r = rstrt.geometry.Rotation(1,1,1);

Both constructors should be available, see https://github.com/corlab/rst-rt/blob/master/src/rst-rt/geometry/Rotation.hpp

xwavex commented 7 years ago

@ndehio Should be fixed. Please check that

ndehio commented 7 years ago

works for me =) thanks!

ndehio commented 7 years ago

I realized that the current implementation is not correct... When constructing a rotation with different yaw-angles, the internal representation is filled with wrong values. Attached I provide four rotations with corresponding euler and quaternion constructor. The output should be the same, which is unfortunately not the case.

##################################################################

import("rst-rt_typekit") var rstrt.geometry.Rotation r1; var rstrt.geometry.Rotation r2; var rstrt.geometry.Rotation r3; var rstrt.geometry.Rotation r4;

wrong rotations using euler representation

r1 = rstrt.geometry.Rotation(0,0,0) r2 = rstrt.geometry.Rotation(0,0,0.785398) r3 = rstrt.geometry.Rotation(0,0,1.5708) r4 = rstrt.geometry.Rotation(0,0,2.35619)

correct rotations using quaternion representation

r1 = rstrt.geometry.Rotation(0,0,0.0) r2 = rstrt.geometry.Rotation(+0.92388,0,0,+0.382683) r3 = rstrt.geometry.Rotation(+0.707107,0,0,+0.707107) r4 = rstrt.geometry.Rotation(+0.382683,0,0,+0.92388)

ndehio commented 7 years ago

works fine now =)