ANYbotics/kindr

std container for kindr::QuaternionsD

depardo opened this issue · 1 comments

Hi guys,

I'm porting my projects from Eigen to Kindr. I use std containers in some places, for example a map between strings and quaternions:

typedef std::map<std::string,Eigen::Quaternion<double>,std::less<std::string>, Eigen::aligned_allocator<std::pair<const std::string,Eigen::Quaternion<double>>>> QuaternionMap_t

I'm trying to do something similar with Kindr rotations :

typedef std::map<std::string,kindr::RotationQuaternion<double>,std::less<std::string>, std::allocator<std::pair<const std::string,kindr::RotationQuaternion<double>>>> QuaternionMap_t;

but when I try to use the map,

QuaternionMap_t Tn; kindr::RotationQuaternionD Tn_i; Tn["link_name"] = Tn_i;

it doesn't compile:

no match for ‘operator=’ (operand types are ‘std::map<std::basic_string, kindr::RotationQuaternion, std::less<std::basic_string >, std::allocator<std::pair<const std::basic_string, kindr::RotationQuaternion > > >::mapped_type {aka kindr::RotationQuaternion}’ and ‘kindr::RotationQuaternion::Scalar {aka double}’)

/kindr/rotations/RotationQuaternion.hpp:55:7: note: no known conversion for argument 1 from ‘kindr::RotationQuaternion::Scalar {aka double}’ to ‘kindr::RotationQuaternion&&’

I'll appreciate if you can give me some hint about this!

thanks,

Diego

Hi Diego,

I couldn't reproduce the compilation error with gcc 5.4.0 / Eigen 3.2.92/ latest kindr.

‘kindr::RotationQuaternion::Scalar {aka double}’ to ‘kindr::RotationQuaternion&&’

I can not see where you would need that conversion in your code snippet. It looks like you try to assign a Scalar type to the map somewhere (e.g. Tn_i.z()).

Is it exactly this snippet that you try to compile?

Cheers,
Gabriel