unittest/sample-models.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2018 CNRS
3 //
4 
5 #include <iostream>
6 
7 #include "pinocchio/multibody/model.hpp"
8 #include "pinocchio/algorithm/joint-configuration.hpp"
9 #include "pinocchio/algorithm/kinematics.hpp"
10 #include "pinocchio/algorithm/geometry.hpp"
11 #include "pinocchio/parsers/sample-models.hpp"
12 
13 #include <boost/test/unit_test.hpp>
14 
15 BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE )
16 
17 BOOST_AUTO_TEST_CASE ( build_model_sample_humanoid_random )
18 {
21 
22  BOOST_CHECK(model.nq == 33);
23  BOOST_CHECK(model.nv == 32);
24 
25  pinocchio::Model modelff;
27 
28  BOOST_CHECK(modelff.nq == 32);
29  BOOST_CHECK(modelff.nv == 32);
30 }
31 
32 BOOST_AUTO_TEST_CASE ( build_model_sample_manipulator )
33 {
36 
37  BOOST_CHECK(model.nq == 6);
38  BOOST_CHECK(model.nv == 6);
39 
40 #ifdef PINOCCHIO_WITH_HPP_FCL
41  pinocchio::Data data(model);
43  pinocchio::buildModels::manipulatorGeometries(model,geom);
44 #endif
45 }
46 
47 BOOST_AUTO_TEST_CASE ( build_model_sample_humanoid )
48 {
51  pinocchio::Data data(model);
52 
53  BOOST_CHECK(model.nq == 35);
54  BOOST_CHECK(model.nv == 34);
55 
56 #ifdef PINOCCHIO_WITH_HPP_FCL
58  pinocchio::buildModels::humanoidGeometries(model,geom);
59  pinocchio::GeometryData geomdata(geom);
60 
62  pinocchio::forwardKinematics(model,data,q);
63  pinocchio::updateGeometryPlacements(model,data,geom,geomdata,q);
64 #endif
65 
66  /* We might want to check here the joint namings, and validate the
67  * direct geometry with respect to reference values. */
68 }
69 
70 BOOST_AUTO_TEST_SUITE_END()
q
void humanoid(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a 28-DOF kinematic chain of a floating humanoid robot.
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Update the joint placements according to the current joint configuration.
BOOST_AUTO_TEST_CASE(build_model_sample_humanoid_random)
void neutral(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ReturnType > &qout)
Return the neutral configuration element related to the model configuration space.
int nv
Dimension of the velocity vector space.
void updateGeometryPlacements(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const GeometryModel &geom_model, GeometryData &geom_data, const Eigen::MatrixBase< ConfigVectorType > &q)
Apply a forward kinematics and update the placement of the geometry objects.
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
Definition: conversions.cpp:14
int nq
Dimension of the configuration vector representation.
void manipulator(ModelTpl< Scalar, Options, JointCollectionTpl > &model)
Create a 6-DOF kinematic chain shoulder-elbow-wrist.


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:32