GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tests/set_gravity.cpp Lines: 12 12 100.0 %
Date: 2024-02-02 08:47:34 Branches: 52 104 50.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2017 CNRS
3
//
4
// This file is part of tsid
5
// tsid is free software: you can redistribute it
6
// and/or modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation, either version
8
// 3 of the License, or (at your option) any later version.
9
// tsid is distributed in the hope that it will be
10
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// General Lesser Public License for more details. You should have
13
// received a copy of the GNU Lesser General Public License along with
14
// tsid If not, see
15
// <http://www.gnu.org/licenses/>.
16
//
17
18
#include <iostream>
19
20
#include <boost/test/unit_test.hpp>
21
#include <boost/utility/binary.hpp>
22
23
#include <tsid/math/utils.hpp>
24
#include "tsid/robots/robot-wrapper.hpp"
25
26
using namespace tsid;
27
using namespace tsid::robots;
28
using namespace std;
29
using namespace pinocchio;
30
31
typedef pinocchio::Motion Motion;
32
33
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
34
35
















4
BOOST_AUTO_TEST_CASE(test_set_gravity) {
36
4
  const string romeo_model_path = TSID_SOURCE_DIR "/models/romeo";
37
38
4
  vector<string> package_dirs;
39
2
  package_dirs.push_back(romeo_model_path);
40
4
  string urdfFileName = package_dirs[0] + "/urdf/romeo.urdf";
41
  RobotWrapper robot(urdfFileName, package_dirs,
42

4
                     pinocchio::JointModelFreeFlyer(), false);
43
44
2
  Motion g = pinocchio::Motion::Zero();
45

2
  Motion init_gravity = robot.model().gravity;
46
47
2
  robot.setGravity(g);
48
49

2
  Motion no_gravity = robot.model().gravity;
50
51



2
  BOOST_CHECK(no_gravity != init_gravity);
52
2
}
53
54
BOOST_AUTO_TEST_SUITE_END()