GCC Code Coverage Report


Directory: ./
File: examples/overview-lie.cpp
Date: 2025-02-12 21:03:38
Exec Total Coverage
Lines: 20 20 100.0%
Branches: 28 56 50.0%

Line Branch Exec Source
1 #include <iostream>
2 #include "pinocchio/multibody/liegroup/liegroup.hpp"
3
4 using namespace pinocchio;
5
6 1 int main()
7 {
8 typedef double Scalar;
9 enum
10 {
11 Options = 0
12 };
13
14 typedef SpecialEuclideanOperationTpl<2, Scalar, Options> SE2Operation;
15
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 SE2Operation aSE2;
16
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 SE2Operation::ConfigVector_t pose_s, pose_g;
17
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 SE2Operation::TangentVector_t delta_u;
18
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 delta_u.setZero();
19
20 // Starting configuration
21
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_s(0) = 1.0;
22
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_s(1) = 1.0;
23
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_s(2) = cos(M_PI / 4.0);
24
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_s(3) = sin(M_PI / 4.0);
25
26 // Goal configuration
27
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_g(0) = 3.0;
28
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_g(1) = -1.0;
29
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_g(2) = cos(-M_PI / 2.0);
30
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pose_g(3) = sin(-M_PI / 2.0);
31
32 // Computes the differences (expressed in the tangent space of the configuration space) between
33 // the starting and the goal configuration
34
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 aSE2.difference(pose_s, pose_g, delta_u);
35
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 std::cout << "difference: " << delta_u.transpose() << std::endl;
36
37 // Check that the composition of the starting configuration and the difference vector gives the
38 // goal configuration
39
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 SE2Operation::ConfigVector_t pose_check;
40
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 aSE2.integrate(pose_s, delta_u, pose_check);
41
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 std::cout << "goal configuration (from composition): " << pose_check.transpose() << std::endl;
42
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
1 std::cout << "goal configuration: " << pose_g.transpose() << std::endl;
43 1 }
44