Packages for common geometric calculations including the ROS transform library, "tf". Also includes ROS bindings for "bullet" physics engine and "kdl" kinematics/dynamics package.
172
stars
274
forks
source link
Using `tf::twistKDLToEigen` leads to compilation errors #228
tf::twistKDLToEigen has a signature void twistKDLToEigen(const KDL::Twist &k, Eigen::Matrix<double, 6, 1> &e).
So, I have two variables that I passed into this function in my code: one the input (twist) and the other one the output (eigen_matrix) that is passed by reference as follows:
// I already have the object `twist` of type `KDL::Twist` with some value assigned to it
Eigen::Matrix<double, 6, 1> eigen_matrix;
tf::twistKDLToEigen(twist, eigen_matrix);
I'm seeing the following error at this place during compilation:
error: cannot bind non-const lvalue reference of type ‘Eigen::Matrix<double, 6, 1>&’ to an rvalue of type ‘Eigen::Matrix<double, 6, 1>’
tf::twistKDLToEigen(twist, eigen_matrix)
^
/usr/include/eigen3/Eigen/src/Core/Matrix.h:378:25: note: after user-defined conversion: Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<double, 1, 6>; _Scalar = double; int _Rows = 6; int _Cols = 1; int _Options = 0; int _MaxRows = 6; int _MaxCols = 1]
EIGEN_STRONG_INLINE Matrix(const EigenBase<OtherDerived> &other)
^~~~~~
In order to narrow down the issue, I wrote a test function with just the Eigen::Matrix<double, 6, 1> &e as an argument and saw the same error:
void test_twistKDLToEigen(Eigen::Matrix<double, 6, 1> &e){
// do nothing
return;
}
int main(){
Eigen::Matrix<double, 6, 1> test_eigen_matrix;
test_twistKDLToEigen(test_eigen_matrix);
}
Apparently, this error disappears as soon as the argument is Eigen::Matrix<double, 6, 1> ei.e, pass by value or const Eigen::Matrix<double, 6, 1> &e. Is there something I'm missing or is it a bug?
tf::twistKDLToEigen
has a signaturevoid twistKDLToEigen(const KDL::Twist &k, Eigen::Matrix<double, 6, 1> &e)
.So, I have two variables that I passed into this function in my code: one the input (
twist
) and the other one the output (eigen_matrix
) that is passed by reference as follows:I'm seeing the following error at this place during compilation:
In order to narrow down the issue, I wrote a test function with just the
Eigen::Matrix<double, 6, 1> &e
as an argument and saw the same error:Apparently, this error disappears as soon as the argument is
Eigen::Matrix<double, 6, 1> e
i.e, pass by value orconst Eigen::Matrix<double, 6, 1> &e
. Is there something I'm missing or is it a bug?