GCC Code Coverage Report


Directory: ./
File: include/hpp/pinocchio/device-data.hh
Date: 2025-05-04 12:09:19
Exec Total Coverage
Lines: 5 5 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2016 CNRS
3 // Author: NMansard from Florent Lamiraux
4 //
5 //
6
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are
9 // met:
10 //
11 // 1. Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 //
14 // 2. Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30
31 #ifndef HPP_PINOCCHIO_DEVICE_DATA_HH
32 #define HPP_PINOCCHIO_DEVICE_DATA_HH
33
34 #include <hpp/pinocchio/config.hh>
35 #include <hpp/pinocchio/fwd.hh>
36 #include <hpp/util/debug.hh>
37
38 namespace hpp {
39 namespace pinocchio {
40 enum Computation_t {
41 JOINT_POSITION = 0x1,
42 JACOBIAN = 0x2,
43 VELOCITY = 0x4,
44 ACCELERATION = 0x8,
45 COM = 0xf,
46 COMPUTE_ALL = 0Xffff
47 };
48
49 /// Struct containing the Device data.
50 /// Users normally do not need to access its attributes.
51 struct DeviceData {
52 DeviceData();
53 DeviceData(const DeviceData& other);
54
55 2181 inline void invalidate() {
56 2181 dataUpToDate_ = 0;
57 2181 frameUpToDate_ = false;
58 2181 geomUpToDate_ = false;
59 2181 }
60
61 /// \param flag to customise the computation. This should be a bitwise OR
62 /// between Computation_t values.
63 void computeForwardKinematics(const ModelPtr_t& m, int flag);
64 void computeFramesForwardKinematics(const ModelPtr_t& m);
65 void updateGeometryPlacements(const ModelPtr_t& m, const GeomModelPtr_t& gm);
66
67 // Pinocchio objects
68 DataPtr_t data_;
69 GeomDataPtr_t geomData_;
70
71 Configuration_t currentConfiguration_;
72 vector_t currentVelocity_;
73 vector_t currentAcceleration_;
74 int dataUpToDate_;
75 bool frameUpToDate_, geomUpToDate_;
76 DeviceWkPtr_t devicePtr_;
77
78 /// Temporary variable to avoid dynamic allocation
79 Configuration_t modelConf_;
80 /// Pool of joint jacobians
81 std::vector<JointJacobian_t> jointJacobians_;
82 }; // struct DeviceData
83 } // namespace pinocchio
84 } // namespace hpp
85
86 #endif // HPP_PINOCCHIO_DEVICE_DATA_HH
87