sample-models.cpp 2.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//
// Copyright (c) 2015-2018 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.

#include <iostream>
#include <fstream>
#include <streambuf>

#include "pinocchio/multibody/model.hpp"
#include "pinocchio/algorithm/joint-configuration.hpp"
#include "pinocchio/algorithm/kinematics.hpp"
25
#include "pinocchio/algorithm/geometry.hpp"
26
27
28
29
30
31
32
33
#include "pinocchio/parsers/sample-models.hpp"

#include <boost/test/unit_test.hpp>



BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE )

34
BOOST_AUTO_TEST_CASE ( build_model_sample_humanoid_random )
35
36
{
  se3::Model model;
37
  se3::buildModels::humanoidRandom(model,true);
38
39
40
41
42

  BOOST_CHECK(model.nq == 33);
  BOOST_CHECK(model.nv == 32);

  se3::Model modelff;
43
  se3::buildModels::humanoidRandom(modelff,false);
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

  BOOST_CHECK(modelff.nq == 32);
  BOOST_CHECK(modelff.nv == 32);
}

BOOST_AUTO_TEST_CASE ( build_model_sample_manipulator )
{
  se3::Model model;
  se3::buildModels::manipulator(model);

  BOOST_CHECK(model.nq == 6);
  BOOST_CHECK(model.nv == 6);

  se3::Data data(model);
  se3::GeometryModel geom;
  se3::buildModels::manipulatorGeometries(model,geom);
60
61
62
63
64
65
66
67
68
69
70
71
72
73
}

BOOST_AUTO_TEST_CASE ( build_model_sample_humanoid )
{
  se3::Model model;
  se3::buildModels::humanoid(model);
  se3::Data data(model);

  BOOST_CHECK(model.nq == 35);
  BOOST_CHECK(model.nv == 34);

  se3::GeometryModel geom;
  se3::buildModels::humanoidGeometries(model,geom);
  se3::GeometryData geomdata(geom);
74
  
75
  Eigen::VectorXd q = se3::neutral(model);
76
77
78
79
80
  se3::forwardKinematics(model,data,q);
  se3::updateGeometryPlacements(model,data,geom,geomdata,q);

  /* We might want to check here the joint namings, and validate the 
   * direct geometry with respect to reference values. */
81
82
83
84
85
}



BOOST_AUTO_TEST_SUITE_END()