Directory: | ./ |
---|---|
File: | src/addition-visitor.hh |
Date: | 2025-05-04 12:09:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 8 | 8 | 100.0% |
Branches: | 5 | 13 | 38.5% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2017, CNRS | ||
2 | // Authors: Florent Lamiraux | ||
3 | // | ||
4 | |||
5 | // Redistribution and use in source and binary forms, with or without | ||
6 | // modification, are permitted provided that the following conditions are | ||
7 | // met: | ||
8 | // | ||
9 | // 1. Redistributions of source code must retain the above copyright | ||
10 | // notice, this list of conditions and the following disclaimer. | ||
11 | // | ||
12 | // 2. Redistributions in binary form must reproduce the above copyright | ||
13 | // notice, this list of conditions and the following disclaimer in the | ||
14 | // documentation and/or other materials provided with the distribution. | ||
15 | // | ||
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
20 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
27 | // DAMAGE. | ||
28 | |||
29 | #ifndef HPP_PINOCCHIO_SRC_ADDITION_VISITOR_HH | ||
30 | #define HPP_PINOCCHIO_SRC_ADDITION_VISITOR_HH | ||
31 | |||
32 | #include <Eigen/Geometry> | ||
33 | |||
34 | namespace hpp { | ||
35 | namespace pinocchio { | ||
36 | namespace liegroupType { | ||
37 | |||
38 | typedef Eigen::Quaternion<value_type> quaternion_t; | ||
39 | |||
40 | /// Addition visitor | ||
41 | template <typename vector_type> | ||
42 | struct AdditionVisitor : public boost::static_visitor<> { | ||
43 | 1204 | AdditionVisitor(vector_type& e, const vectorIn_t& v) | |
44 | 1204 | : e_(e), v_(v), iq_(0), iv_(0) {} | |
45 | template <typename LiegroupType> | ||
46 | 1204 | void operator()(LiegroupType& op) { | |
47 |
3/8✓ Branch 1 taken 602 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 602 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 602 times.
✗ Branch 8 not taken.
|
1204 | op.integrate(e_.template segment<LiegroupType::NQ>(iq_, op.nq()), |
48 |
2/5✓ Branch 1 taken 602 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 602 times.
✗ Branch 5 not taken.
|
1204 | v_.segment<LiegroupType::NV>(iv_, op.nv()), |
49 | 1204 | e_.template segment<LiegroupType::NQ>(iq_, op.nq())); | |
50 | |||
51 | 1204 | iq_ += op.nq(); | |
52 | 1204 | iv_ += op.nv(); | |
53 | } | ||
54 | vector_type& e_; | ||
55 | const vectorIn_t& v_; | ||
56 | size_type iq_, iv_; | ||
57 | }; // struct AdditionVisitor | ||
58 | |||
59 | } // namespace liegroupType | ||
60 | } // namespace pinocchio | ||
61 | } // namespace hpp | ||
62 | |||
63 | #endif // HPP_PINOCCHIO_SRC_ADDITION_VISITOR_HH | ||
64 |