Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup size and indices attributes, return values and arguments #767

Merged
merged 3 commits into from
Nov 18, 2020

Conversation

traversaro
Copy link
Member

@traversaro traversaro commented Nov 18, 2020

It just started for solving some warnings:

C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(116,49): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<const double>::index_type' to 'int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(116,27): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<const double>::index_type' to 'const int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(117,49): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<const double>::index_type' to 'int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(117,27): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<const double>::index_type' to 'const int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(165,49): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<double>::index_type' to 'int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(165,27): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<double>::index_type' to 'const int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(166,49): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<double>::index_type' to 'int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(166,27): warning C4244: 'initializing': conversion from 'iDynTree::MatrixView<double>::index_type' to 'const int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]
C:\src\idyntree\src\core\include\iDynTree/Core/EigenHelpers.h(374,14): warning C4244: 'argument': conversion from 'const ptrdiff_t' to 'const unsigned int', possible loss of data [C:\src\idyntree\build\src\core\idyntree-core.vcxproj]

And as usual it escalated to a large scale change. However, it is better to do this before the iDynTree 2 releases as it changes (slightly) the API and the ABI.

For consistency with std and Eigen, all sizes and indices have been changed to use std::size_t for unsigned quantities and std::ptrdiff_t for signed quantities. The only exception is the index stored in the triplets of the iDynTree::SparseMatrix data structure, that have been left defined to int for compatibility with Eigen.

@traversaro
Copy link
Member Author

In 4e23a1e I restored the template parameter of MatrixFixSize and VectorFixSize to be again unsigned int as switching them to std::size_t resulted on Ubuntu in endless ambigous overload problems:

2020-11-18T10:55:49.5559097Z Scanning dependencies of target idyntree-core
2020-11-18T10:55:49.5837879Z [  0%] Building CXX object src/core/CMakeFiles/idyntree-core.dir/src/Axis.cpp.o
2020-11-18T10:55:50.7743886Z [  1%] Building CXX object src/core/CMakeFiles/idyntree-core.dir/src/ArticulatedBodyInertia.cpp.o
2020-11-18T10:55:51.6825650Z In file included from /home/runner/work/idyntree/idyntree/src/core/src/ArticulatedBodyInertia.cpp:17:0:
2020-11-18T10:55:51.6830579Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h: In function ‘const Eigen::Matrix<double, 6, 1> iDynTree::toEigen(const iDynTree::SpatialMotionVector&)’:
2020-11-18T10:55:51.6835569Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:226:52: error: call of overloaded ‘toEigen(const LinearVector3T&)’ is ambiguous
2020-11-18T10:55:51.6837182Z      ret.segment<3>(0) = toEigen(vec.getLinearVec3());
2020-11-18T10:55:51.6837802Z                                                     ^
2020-11-18T10:55:51.6839716Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6841111Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6841760Z                                           ^~~~~~~
2020-11-18T10:55:51.6843393Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6844742Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6845379Z                                     ^~~~~~~
2020-11-18T10:55:51.6849494Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6857029Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6857925Z  ^~~~~~~
2020-11-18T10:55:51.6863502Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:227:53: error: call of overloaded ‘toEigen(const AngularVector3T&)’ is ambiguous
2020-11-18T10:55:51.6864817Z      ret.segment<3>(3) = toEigen(vec.getAngularVec3());
2020-11-18T10:55:51.6865551Z                                                      ^
2020-11-18T10:55:51.6867733Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6869126Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6869792Z                                           ^~~~~~~
2020-11-18T10:55:51.6871509Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6872889Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6873540Z                                     ^~~~~~~
2020-11-18T10:55:51.6875411Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6876805Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6877329Z  ^~~~~~~
2020-11-18T10:55:51.6879047Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h: In function ‘const Eigen::Matrix<double, 6, 1> iDynTree::toEigen(const iDynTree::SpatialForceVector&)’:
2020-11-18T10:55:51.6881249Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:236:52: error: call of overloaded ‘toEigen(const LinearVector3T&)’ is ambiguous
2020-11-18T10:55:51.6882531Z      ret.segment<3>(0) = toEigen(vec.getLinearVec3());
2020-11-18T10:55:51.6883125Z                                                     ^
2020-11-18T10:55:51.6884905Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6886295Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6886944Z                                           ^~~~~~~
2020-11-18T10:55:51.6889207Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6890775Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6891432Z                                     ^~~~~~~
2020-11-18T10:55:51.6893364Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6894789Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6895319Z  ^~~~~~~
2020-11-18T10:55:51.6896657Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:237:53: error: call of overloaded ‘toEigen(const AngularVector3T&)’ is ambiguous
2020-11-18T10:55:51.6897947Z      ret.segment<3>(3) = toEigen(vec.getAngularVec3());
2020-11-18T10:55:51.6898556Z                                                      ^
2020-11-18T10:55:51.6900321Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6901719Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6902347Z                                           ^~~~~~~
2020-11-18T10:55:51.6904025Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6905609Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6906280Z                                     ^~~~~~~
2020-11-18T10:55:51.6908353Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6909751Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6910288Z  ^~~~~~~
2020-11-18T10:55:51.6912168Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h: In function ‘void iDynTree::fromEigen(iDynTree::SpatialMotionVector&, const Eigen::Matrix<double, 6, 1>&)’:
2020-11-18T10:55:51.6914904Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:245:32: error: call of overloaded ‘toEigen(iDynTree::SpatialVector<iDynTree::SpatialMotionVector>::LinearVector3T&)’ is ambiguous
2020-11-18T10:55:51.6916495Z      toEigen(vec.getLinearVec3()) = eigVec.segment<3>(0);
2020-11-18T10:55:51.6917129Z                                 ^
2020-11-18T10:55:51.6918832Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6920219Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6920878Z                                           ^~~~~~~
2020-11-18T10:55:51.6922523Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6923861Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6924477Z                                     ^~~~~~~
2020-11-18T10:55:51.6926334Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6927737Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6928231Z  ^~~~~~~
2020-11-18T10:55:51.6930105Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.6931538Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.6932039Z  ^~~~~~~
2020-11-18T10:55:51.6970708Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:246:33: error: call of overloaded ‘toEigen(iDynTree::SpatialVector<iDynTree::SpatialMotionVector>::AngularVector3T&)’ is ambiguous
2020-11-18T10:55:51.6975281Z      toEigen(vec.getAngularVec3()) = eigVec.segment<3>(3);
2020-11-18T10:55:51.6975934Z                                  ^
2020-11-18T10:55:51.6977686Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.6979090Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.6979735Z                                           ^~~~~~~
2020-11-18T10:55:51.6981365Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.6985473Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.6986106Z                                     ^~~~~~~
2020-11-18T10:55:51.6988029Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.6989440Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.6989927Z  ^~~~~~~
2020-11-18T10:55:51.6991967Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.6993288Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.6993789Z  ^~~~~~~
2020-11-18T10:55:51.6995583Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h: In function ‘void iDynTree::fromEigen(iDynTree::SpatialForceVector&, const Eigen::Matrix<double, 6, 1>&)’:
2020-11-18T10:55:51.6998240Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:251:32: error: call of overloaded ‘toEigen(iDynTree::SpatialVector<iDynTree::SpatialForceVector>::LinearVector3T&)’ is ambiguous
2020-11-18T10:55:51.6999810Z      toEigen(vec.getLinearVec3()) = eigVec.segment<3>(0);
2020-11-18T10:55:51.7000416Z                                 ^
2020-11-18T10:55:51.7002117Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.7003499Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.7004126Z                                           ^~~~~~~
2020-11-18T10:55:51.7005765Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.7007079Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.7007720Z                                     ^~~~~~~
2020-11-18T10:55:51.7009570Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.7010934Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.7011444Z  ^~~~~~~
2020-11-18T10:55:51.7013195Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.7014656Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.7015159Z  ^~~~~~~
2020-11-18T10:55:51.7017048Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:252:33: error: call of overloaded ‘toEigen(iDynTree::SpatialVector<iDynTree::SpatialForceVector>::AngularVector3T&)’ is ambiguous
2020-11-18T10:55:51.7018630Z      toEigen(vec.getAngularVec3()) = eigVec.segment<3>(3);
2020-11-18T10:55:51.7019249Z                                  ^
2020-11-18T10:55:51.7020936Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.7022311Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.7022934Z                                           ^~~~~~~
2020-11-18T10:55:51.7024591Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.7026014Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.7026656Z                                     ^~~~~~~
2020-11-18T10:55:51.7028502Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.7029891Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.7030411Z  ^~~~~~~
2020-11-18T10:55:51.7032254Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.7033595Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.7034096Z  ^~~~~~~
2020-11-18T10:55:51.7035601Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h: In function ‘void iDynTree::fromEigen(iDynTree::Transform&, const Matrix4d&)’:
2020-11-18T10:55:51.7037772Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:260:16: error: call of overloaded ‘toEigen(iDynTree::Rotation&)’ is ambiguous
2020-11-18T10:55:51.7038858Z      toEigen(rot) = eigMat.block<3,3>(0,0);
2020-11-18T10:55:51.7039380Z                 ^
2020-11-18T10:55:51.7041189Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.7042576Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.7043087Z  ^~~~~~~
2020-11-18T10:55:51.7046894Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.7048249Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.7048729Z  ^~~~~~~
2020-11-18T10:55:51.7196778Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:261:16: error: call of overloaded ‘toEigen(iDynTree::Position&)’ is ambiguous
2020-11-18T10:55:51.7198411Z      toEigen(pos) = eigMat.block<3,1>(0,3);
2020-11-18T10:55:51.7199061Z                 ^
2020-11-18T10:55:51.7202305Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:69:42: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<const double>)
2020-11-18T10:55:51.7208156Z  inline Eigen::Map<const Eigen::VectorXd> toEigen(Span<const double> vec)
2020-11-18T10:55:51.7211687Z                                           ^~~~~~~
2020-11-18T10:55:51.7213734Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:74:36: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, 1> > iDynTree::toEigen(iDynTree::Span<double>)
2020-11-18T10:55:51.7215254Z  inline Eigen::Map<Eigen::VectorXd> toEigen(iDynTree::Span<double> vec)
2020-11-18T10:55:51.7216664Z                                     ^~~~~~~
2020-11-18T10:55:51.7219235Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.7220639Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.7221140Z  ^~~~~~~
2020-11-18T10:55:51.7223003Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.7224353Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.7224831Z  ^~~~~~~
2020-11-18T10:55:51.7727764Z /home/runner/work/idyntree/idyntree/src/core/src/ArticulatedBodyInertia.cpp: In constructor ‘iDynTree::ArticulatedBodyInertia::ArticulatedBodyInertia(const iDynTree::SpatialInertia&)’:
2020-11-18T10:55:51.7730563Z /home/runner/work/idyntree/idyntree/src/core/src/ArticulatedBodyInertia.cpp:56:25: error: call of overloaded ‘toEigen(iDynTree::Matrix3x3&)’ is ambiguous
2020-11-18T10:55:51.7731829Z      toEigen(linearLinear)  = rbiEigen.block<3,3>(0,0);
2020-11-18T10:55:51.7732410Z                          ^
2020-11-18T10:55:51.7733278Z In file included from /home/runner/work/idyntree/idyntree/src/core/src/ArticulatedBodyInertia.cpp:17:0:
2020-11-18T10:55:51.7735992Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:82:1: note: candidate: Eigen::Map<const Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<const double>&)
2020-11-18T10:55:51.7737503Z  toEigen(const MatrixView<const double>& mat)
2020-11-18T10:55:51.7738004Z  ^~~~~~~
2020-11-18T10:55:51.7739833Z /home/runner/work/idyntree/idyntree/src/core/include/iDynTree/Core/EigenHelpers.h:131:1: note: candidate: Eigen::Map<Eigen::Matrix<double, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > iDynTree::toEigen(const iDynTree::MatrixView<double>&)
2020-11-18T10:55:51.7741147Z  toEigen(const MatrixView<double>& mat)
2020-11-18T10:55:51.7741657Z  ^~~~~~~
2020-11-18T10:55:51.7832428Z /home/runner/work/idyntree/idyntree/src/core/src/ArticulatedBodyInertia.cpp:57:26: error: call of overloaded ‘toEigen(iDynTree::Matrix3x3&)’ is ambiguous
2020-11-18T10:55:51.7833770Z      toEigen(linearAngular) = rbiEigen.block<3,3>(0,3);
2020-11-18T10:55:51.7834399Z                           ^

While this is probably an indication of some underlying issue in all the default define constructors (probably on how they handle const-correctness), handling this is way out of the scope of the issue, and so I will track this in a separate issue.

@traversaro
Copy link
Member Author

The PR should be finally ready. The real change is 87f73db, that is basically a lot of /unsigned int/size_t and /int/ptrdiff_t substitution.
e31930b is instead the usual MATLAB bindings regeneration.

Comment on lines +77 to +79
std::stringstream ss;
ss << inInt;
return ss.str();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be std::to_string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to always avoid the use of std::to_string, as on integers it works fine, but for floating points create critical problems. However this is just adding a function that already existed for a different type, we can cleanup the function all together.

src/sensors/src/Sensors.cpp Show resolved Hide resolved
@S-Dafarra
Copy link
Contributor

While this is probably an indication of some underlying issue in all the default define constructors (probably on how they handle const-correctness), handling this is way out of the scope of the issue, and so I will track this in a separate issue.

Since they are related to Eigen, isn't it because of the maps? Eigen uses a signed integer for the Rows and Cols at compile time (Eigen::Dynamic is -1).

Copy link
Contributor

@S-Dafarra S-Dafarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of my comments is blocking

@traversaro
Copy link
Member Author

While this is probably an indication of some underlying issue in all the default define constructors (probably on how they handle const-correctness), handling this is way out of the scope of the issue, and so I will track this in a separate issue.

Since they are related to Eigen, isn't it because of the maps? Eigen uses a signed integer for the Rows and Cols at compile time (Eigen::Dynamic is -1).

It could be related, but rows and columns in iDynTree were unsigned before, and now they are std::size_t (so always unsigned). Similarly, the template parameters were updated from unsigned to std::size_t, so always unsigned. I do not know why changing the template parameter from unsigned to std::size_t triggers that problems, and probably it is indeed related to Eigen::Map, but I don't know immediately if it is related to the fact that rows and columns use signed return values.

@traversaro traversaro merged commit bab0865 into devel Nov 18, 2020
@traversaro traversaro deleted the cleanupSizeAndIndeces branch November 18, 2020 16:50
francesco-romano added a commit to francesco-romano/idyntree that referenced this pull request Nov 24, 2020
robotology#767 changed the index type but did
not update the bindings code accordingly.
francesco-romano added a commit to francesco-romano/idyntree that referenced this pull request Nov 24, 2020
robotology#767 changed the index type but did
not update the bindings code accordingly.
traversaro added a commit that referenced this pull request Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants