ANYbotics/kindr

Backwards assignments

Opened this issue · 1 comments

Apologies for the maybe dumb/replicated question (couldn't find a satisfying reply).

How can I assign an Eigen data structure to a kindr one?
I know I can do the opposite by calling the toImplementation() function, but since kindr data structures inherits from Eigen the compiler prevents me from assigning a super class to an inherited one.

Is it legit to do something like the following?:

kindr::Vector3D kindr_v3;
Eigen::Vector3d eigen_v3;
kindr_v3.toImplementation() = eigen_v3;
remod commented

You could use your suggested code, or something like

kindr::Vector3D kindr_v3;
Eigen::Vector3d eigen_v3;
kindr_v3 = kindr::Vector3D(eigen_v3);