5 #include "pinocchio/codegen/cppadcg.hpp" 6 #include "pinocchio/algorithm/crba.hpp" 8 #include "pinocchio/parsers/urdf.hpp" 9 #include "pinocchio/algorithm/joint-configuration.hpp" 10 #include "pinocchio/codegen/code-generator-algo.hpp" 14 int main(
int argc,
const char ** argv)
17 using namespace Eigen;
19 std::string filename =
PINOCCHIO_MODEL_DIR + std::string(
"/others/robots/ur_description/urdf/ur5_robot.urdf");
20 if(argc>1) filename = argv[1];
22 std::cout <<
"Opening file: " << filename << std::endl;
38 MatrixXd &
M = crba_code_gen.
M;
41 M.template triangularView<Eigen::StrictlyLower>() = M.transpose().template triangularView<Eigen::StrictlyLower>();
44 Data data_check(model);
45 crba(model,data_check,q);
47 data_check.M.triangularView<Eigen::StrictlyLower>() = data_check.M.transpose().triangularView<Eigen::StrictlyLower>();
49 const MatrixXd & M_check = data_check.M;
50 if(M_check.isApprox(M)) {
51 std::cout <<
"Super! The two results are the same." << std::endl;
55 std::cout <<
"Not Super! The results do not match." << std::endl;
int main(int argc, const char **argv)
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & crba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the upper triangular part of the joint space inertia matrix M by using the Composite Rigid B...
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
#define PINOCCHIO_MODEL_DIR
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
void loadLib(const bool generate_if_not_exist=true)
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false)
Build the model from a URDF file with a particular joint as root of the model tree inside the model g...
Main pinocchio namespace.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q)
JointCollectionTpl & model