GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
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/trajectories/trajectory-se3.hpp> |
||
25 |
#include <tsid/trajectories/trajectory-euclidian.hpp> |
||
26 |
|||
27 |
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE) |
||
28 |
|||
29 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
4 |
BOOST_AUTO_TEST_CASE(test_trajectory_se3) { |
30 |
using namespace tsid; |
||
31 |
using namespace trajectories; |
||
32 |
using namespace math; |
||
33 |
using namespace std; |
||
34 |
using namespace Eigen; |
||
35 |
using namespace pinocchio; |
||
36 |
|||
37 |
✓✗ | 2 |
SE3 M_ref = SE3::Identity(); |
38 |
✓✗ | 4 |
VectorXd M_vec(12); |
39 |
✓✗✓✗ |
2 |
SE3ToVector(M_ref, M_vec); |
40 |
✓✗✓✗ |
4 |
VectorXd zero = VectorXd::Zero(6); |
41 |
|||
42 |
✓✗✓✗ ✓✗ |
2 |
TrajectoryBase *traj = new TrajectorySE3Constant("traj_se3", M_ref); |
43 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(traj->has_trajectory_ended()); |
44 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✗✓ |
2 |
BOOST_CHECK(traj->computeNext().getValue().isApprox(M_vec)); |
45 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✗✓ |
2 |
BOOST_CHECK(traj->operator()(0.0).getValue().isApprox(M_vec)); |
46 |
|||
47 |
✓✗ | 4 |
TrajectorySample sample(12, 6); |
48 |
✓✗ | 2 |
traj->getLastSample(sample); |
49 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getValue().isApprox(M_vec)); |
50 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getDerivative().isApprox(zero)); |
51 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getSecondDerivative().isApprox(zero)); |
52 |
2 |
} |
|
53 |
|||
54 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
4 |
BOOST_AUTO_TEST_CASE(test_trajectory_euclidian) { |
55 |
using namespace tsid; |
||
56 |
using namespace trajectories; |
||
57 |
using namespace std; |
||
58 |
using namespace Eigen; |
||
59 |
|||
60 |
2 |
const unsigned int n = 5; |
|
61 |
✓✗✓✗ |
4 |
VectorXd q_ref = VectorXd::Ones(n); |
62 |
✓✗✓✗ |
4 |
VectorXd zero = VectorXd::Zero(n); |
63 |
✓✗✓✗ ✓✗✓✗ |
2 |
TrajectoryBase *traj = new TrajectoryEuclidianConstant("traj_eucl", q_ref); |
64 |
|||
65 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(traj->has_trajectory_ended()); |
66 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✗✓ |
2 |
BOOST_CHECK(traj->computeNext().getValue().isApprox(q_ref)); |
67 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✗✓ |
2 |
BOOST_CHECK(traj->operator()(0.0).getValue().isApprox(q_ref)); |
68 |
|||
69 |
✓✗ | 4 |
TrajectorySample sample(n); |
70 |
✓✗ | 2 |
traj->getLastSample(sample); |
71 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getValue().isApprox(q_ref)); |
72 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getDerivative().isApprox(zero)); |
73 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✗✓ |
2 |
BOOST_CHECK(sample.getSecondDerivative().isApprox(zero)); |
74 |
2 |
} |
|
75 |
|||
76 |
BOOST_AUTO_TEST_SUITE_END() |
Generated by: GCOVR (Version 4.2) |