-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yarp] Added failing test on KDLtoYarp_twist and KDLtoYarp_wrench met…
…hods
- Loading branch information
1 parent
1f6171b
commit cd248c6
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2016 Fondazione Istituto Italiano di Tecnologia | ||
* Author: Silvio Traversaro <silvio.traversaro@iit.it> | ||
* | ||
* CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT | ||
*/ | ||
|
||
#include <iDynTree/Core/MatrixFixSize.h> | ||
|
||
#include <iDynTree/Core/TestUtils.h> | ||
#include <iDynTree/Core/EigenHelpers.h> | ||
|
||
#include <kdl_codyco/KDLConversions.h> | ||
#include <kdl_codyco/regressor_utils.hpp> | ||
|
||
#include <iCub/iDynTree/yarp_kdl.h> | ||
|
||
#include <iDynTree/Core/Transform.h> | ||
|
||
#include <yarp/sig/Matrix.h> | ||
|
||
using namespace iDynTree; | ||
|
||
int main() | ||
{ | ||
// Create a random iDynTree frame | ||
Transform trans = getRandomTransform(); | ||
|
||
Matrix6x6 adj_idyntree = trans.asAdjointTransform(); | ||
yarp::sig::Matrix adj_yarp_kdl_inyarp = KDLtoYarp_twist(ToKDL(trans)); | ||
Matrix6x6 adj_yarp_kdl; | ||
toEigen(adj_yarp_kdl) = Eigen::Map<Eigen::Matrix<double,6,6,Eigen::RowMajor> >(adj_yarp_kdl_inyarp.data()); | ||
Matrix6x6 adj_eigen_kdl; | ||
toEigen(adj_eigen_kdl) = KDL::CoDyCo::TwistTransformationMatrix(ToKDL(trans)); | ||
|
||
std::cerr << "Adjoint matrix: "<< std::endl; | ||
std::cerr << "iDynTree : \n" << adj_idyntree.toString() << std::endl; | ||
std::cerr << "YARP : \n" << adj_yarp_kdl.toString() << std::endl; | ||
std::cerr << "Eigen : \n" << adj_eigen_kdl.toString() << std::endl; | ||
|
||
Matrix6x6 adj_wrench_idyntree = trans.asAdjointTransformWrench(); | ||
yarp::sig::Matrix adj_wrench_yarp_kdl_inyarp = KDLtoYarp_wrench(ToKDL(trans)); | ||
Matrix6x6 adj_wrench_yarp_kdl; | ||
toEigen(adj_wrench_yarp_kdl) = Eigen::Map<Eigen::Matrix<double,6,6,Eigen::RowMajor> >(adj_wrench_yarp_kdl_inyarp.data()); | ||
|
||
Matrix6x6 adj_wrench_eigen_kdl; | ||
toEigen(adj_wrench_eigen_kdl) = KDL::CoDyCo::WrenchTransformationMatrix(ToKDL(trans)); | ||
|
||
std::cerr << "Wrench Adjoint matrix: "<< std::endl; | ||
std::cerr << "iDynTree : \n" << adj_wrench_idyntree.toString() << std::endl; | ||
std::cerr << "YARP : \n" << adj_wrench_yarp_kdl.toString() << std::endl; | ||
std::cerr << "Eigen : \n" << adj_wrench_eigen_kdl.toString() << std::endl; | ||
|
||
ASSERT_EQUAL_MATRIX(adj_idyntree,adj_yarp_kdl); | ||
ASSERT_EQUAL_MATRIX(adj_idyntree,adj_eigen_kdl); | ||
|
||
ASSERT_EQUAL_MATRIX(adj_wrench_idyntree,adj_wrench_yarp_kdl); | ||
ASSERT_EQUAL_MATRIX(adj_wrench_idyntree,adj_wrench_eigen_kdl); | ||
|
||
return EXIT_SUCCESS; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters