Closed GiulioRomualdi closed 4 years ago
Is this really a problem? I mean, now that KinDynComputations will support MatrixView, I don't see a lot of reasons for using iDynTree Matrices over regular Eigen matrices, so it is not clear to me where you need to have an iDynTree matrix in blf and then pass it to a function that takes in input Eigen::Ref .
Unfortunately, this does not solve our problem since
void foo(Eigen::Ref<Eigen::MatrixXd> m) { return; } foo( Map<MatrixXd, 0, Stride<Dynamic,Dynamic>>(array1, 2, 3, Stride<Dynamic,Dynamic>(1, 3)));
does not compile and give us the following error:
What if you use
void foo(Eigen::Ref<Eigen::MatrixXd, 0, Stride<Dynamic,Dynamic>> m)
{
return;
}
foo( Map<MatrixXd, 0, Stride<Dynamic,Dynamic>>(array1, 2, 3, Stride<Dynamic,Dynamic>(1, 3)));
?
I mean, now that KinDynComputations will support MatrixViex
I hope it will happen soon but I've several problems with the implementation.
@S-Dafarra https://github.com/dic-iit/bipedal-locomotion-framework/issues/100#issuecomment-688913457 seems to solve the problem.
I try to focus on the MatrixView
https://github.com/robotology/idyntree/pull/730 even if I think we will have a similar problem
@GiulioRomualdi probably we can close this right?
@GiulioRomualdi probably we can close this right?
yes exactly.
Just a small recap. As @traversaro wrote in https://github.com/dic-iit/bipedal-locomotion-framework/issues/100#issuecomment-688907687 is not really necessary. Furthermore now thanks to https://github.com/robotology/idyntree/pull/734 and https://github.com/robotology/idyntree/pull/736 the usage of iDynTree
objects in the repo can be sensitively reduced
As written in the Eigen documentation, the default storage order of matrices is
ColMajor
, however iniDynTree
the matrices are stored asRowMajor
.This raises a problem when we try to use the
Eigen::Ref
. Right now, in all the interfaces we useEigen::Ref<Eigen::MatrixXd>
for passing matrices, thanks to this we can write:The same applies also with maps
Unfortunately
iDynTree
store the matrices inRowMajor
and the following lines of code will not compileThis is a huge problem because we cannot call the functions we implemented so far with
Map
ofRowMajor
object (we cannot useiDynTree
easily).Discussing with @S-Dafarra we noticed that it is possible to play with the
Eigen::Stride
for viewing anRowMajor
matrix to aColMajor
one. For instance:gives the following output
Unfortunately, this does not solve our problem since
does not compile and give us the following error:
So far I found two possible solutions:
We start using only the
RowMajor
matrices inblf
pros
:iDynTree
cons
:manif
still working?We templatize everything
pros
:cons
:@traversaro @prashanth @s-dafarra