GCC Code Coverage Report


Directory: ./
File: include/hpp/pinocchio/body.hh
Date: 2025-05-04 12:09:19
Exec Total Coverage
Lines: 1 1 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_BODY_HH
32 #define HPP_PINOCCHIO_BODY_HH
33
34 #include <hpp/pinocchio/config.hh>
35 #include <hpp/pinocchio/fwd.hh>
36 #include <hpp/util/pointer.hh>
37 #include <pinocchio/multibody/fwd.hpp>
38
39 namespace hpp {
40 namespace pinocchio {
41
42 /// Geometry associated to a Joint
43 ///
44 /// A body is a geometry container attached to a joint.
45 /// The body contains objects (CollisionObject) that move with the joint and
46 /// called <em>inner objects</em>.
47 ///
48 /// Collision and distance computation is performed against other objects
49 /// that can be obstacles or objects attached to other joints. These object
50 /// are called <em>outer objects</em> for the body.
51 class HPP_PINOCCHIO_DLLAPI Body {
52 public:
53 /// \name Construction and copy and destruction
54 /// @{
55 /// Constructor
56 Body(DeviceWkPtr_t device, JointIndex joint);
57
58 162 virtual ~Body() {}
59 /// @}
60
61 /// \name Name
62 /// \{
63
64 /// Get name
65 const std::string& name() const;
66 /// \}
67
68 /// Get joint holding the body
69 JointPtr_t joint() const;
70
71 /// \name Inner/outer objects
72 /// \{
73
74 /// Number of inner objects.
75 size_type nbInnerObjects() const;
76
77 /// Access to an inner object.
78 CollisionObjectPtr_t innerObjectAt(const size_type& i) const;
79
80 /// Get radius
81 ///
82 /// Radius is defined as an upper-bound to the distance of all points of
83 /// the body to the origin of the joint that holds the body.
84 value_type radius() const;
85
86 /// Number of outer objects.
87 size_type nbOuterObjects() const;
88
89 /// Access to an outer object.
90 CollisionObjectPtr_t outerObjectAt(const size_type& i) const;
91 /// \}
92
93 /// \name Inertial information
94 /// @{
95 /// Get position of center of mass in joint local reference frame.
96 const vector3_t& localCenterOfMass() const;
97 /// Get Intertia matrix expressed in joint local reference frame.
98 matrix3_t inertiaMatrix() const;
99 /// Get mass.
100 value_type mass() const;
101
102 /// @}
103 private:
104 /// Assert that the members of the struct are valid (no null pointer, etc).
105 void selfAssert() const;
106 /// If frameIndex==-1 (after init), search in pinocchio frame list the proper
107 /// index.
108 void searchFrameIndex() const;
109
110 const Model& model() const;
111 Model& model();
112 const ::pinocchio::Frame& frame() const;
113 ::pinocchio::Frame& frame();
114
115 DeviceWkPtr_t devicePtr;
116 JointIndex jointIndex;
117 mutable FrameIndex
118 frameIndex; // In pinocchio, bodies are stored as frames of type BODY.
119 mutable bool frameIndexSet;
120 }; // class Body
121 } // namespace pinocchio
122 } // namespace hpp
123 #endif // HPP_PINOCCHIO_BODY_HH
124