[Bug 1007] New: Rotation.GetRot returns invalid x/y/z values for 180 degree rotations

http://bugs.orocos.org/show_bug.cgi?id=1007

Summary: Rotation.GetRot returns invalid x/y/z values for 180
degree rotations
Product: KDL
Version: kdl-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P3
Component: Primitives
AssignedTo: orocos-dev [..] ...
ReportedBy: spam [dot] joh [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

When building a rotation vector from a KDL Rotation.GetRot(), there are numeric
problems when the rotation matrix is diagonal, for example 180 degree rotation
around any of the axes. In this case the vector is set to zero even if it
should be for example (0, 0, pi) for a 180 degree rotation around z axis. When
rotating a bit more or less than 180 degrees it works fine.

The problem is in frames.cpp in line 325+.

Possible solution found in a another library: generate rotation vector from
Quaternion.

Example Program:
-----
import numpy as np
import PyKDL as kdl

rot = kdl.Rotation()
rot.DoRotZ(np.pi)
print rot.GetRot()
# returns: [ -0, 0, 1.22461e-16]
# expected: [0, 0, 3.14159]

# Working example with pi+0.001 rotation
rot = kdl.Rotation()
rot.DoRotZ(np.pi + 0.001)
print rot.GetRot()
# returns[ 0, 0, -3.14059]

[Bug 1007] Rotation.GetRot returns invalid x/y/z values for 180

http://bugs.orocos.org/show_bug.cgi?id=1007

spam [dot] joh [..] ... changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID

[Bug 1007] Rotation.GetRot returns invalid x/y/z values for 180

[Bug 1007] Rotation.GetRot returns invalid x/y/z values for 180

http://bugs.orocos.org/show_bug.cgi?id=1007

Erwin Aertbelien <Erwin [dot] Aertbelien [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |Erwin [dot] Aertbelien [..] ...
| |ven.be

[Bug 1007] Rotation.GetRot returns invalid x/y/z values for 180