control-toolbox icon indicating copy to clipboard operation
control-toolbox copied to clipboard

JIT is partially incompatible with 'kindr' and 'Eigen3'

Open markusgft opened this issue 5 years ago • 0 comments

Problem 1: kindr assert-macros in kindr/common. Affected are both assert_macros and assert_macros_eigen. Proposed short-term solution: the assert macros are subject to the "NDEBUG"-flag , which can for example be set by compiling in Release mode (-DCMAKE_BUILD_TYPE=Release)

Problem 2: many rotation types in kindr feature a so-called "fix()" method, for example to normalize a RotationMatrix or a RotationQuaternion. This fix() method may break JIT. Proposed long-term solution: introduce a flag into kindr which allows to skip all fix() methods.

Problem 3: conditionals and methods in Eigen3 that behave undeterministically at JIT compile-time. Example: constructing an Eigen::Quaternion from a rotation matrix, e.g. when doing something like Eigen::Quaternion<SC> q (Eigen::Matrix<SC, 3, 3>) . Potential long-term solution: specialize these conversions for CppAD.

In other words:

large range of methods available in kindr and Eigen rotation types are currently not JIT compatible. Note that they are still compatible with normal CppAD automatic differentiation, which is a strong argument for also bringing back the normal CppAD procedures into CT.

the current implementation of the TaskSpaceCost functions avoids Quaternions. A limitation is that RobCoGen only produces Homogenous transforms, therefore we are currently limited to using rotation matrices in there.

Examples for failures:

all Task-Space cost functions will fail when not built in Release-Mode

a number of unit tests will fail when not built in release mode, see rbdJITtests in ct_rbd

the following kindr and Eigen JIT tests fail in any case (see kindrJITtest.h) :

KindrJitTest.EigenRotationMatrixToEigenEulerAnglesTest

KindrJitTest.EigenRotationMatrixToAngleAxisTest

KindrJitTest.RotationMatrixToKindrRotationQuatTest

KindrJitTest.KindrRotationMatrixToEigenRotationQuatTest

KindrJitTest.KindrRotationMatrixToEulerAnglesXyzTest

KindrJitTest.EigenRotationMatrixToEigenEulerAnglesTest

KindrJitTest.EigenRotationMatrixToAngleAxisTest

KindrJitTest.RotationMatrixToKindrRotationQuatTest

KindrJitTest.KindrRotationMatrixToEigenRotationQuatTest They are currently _DISABLED

markusgft avatar May 18 '19 06:05 markusgft