DART  6.10.1
BodyNodeAspect.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_DYNAMICS_DETAIL_BODYNODEASPECT_HPP_
34 #define DART_DYNAMICS_DETAIL_BODYNODEASPECT_HPP_
35 
38 #include "dart/dynamics/Entity.hpp"
40 #include "dart/dynamics/Node.hpp"
41 
42 namespace dart {
43 namespace dynamics {
44 
45 class Skeleton;
46 
47 const double DART_DEFAULT_FRICTION_COEFF = 1.0;
48 const double DART_DEFAULT_RESTITUTION_COEFF = 0.0;
49 
50 namespace detail {
51 
52 //==============================================================================
54 {
57 
58  BodyNodeState(const Eigen::Vector6d& Fext = Eigen::Vector6d::Zero());
59 
60  virtual ~BodyNodeState() = default;
61 
62  // To get byte-aligned Eigen vectors
63  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
64 };
65 
66 //==============================================================================
68 {
70  std::string mName;
71 
74 
77 
83 
89 
92 
97  DART_DEPRECATED(6.10)
99  const std::string& name,
100  const Inertia& _inertia,
101  bool _isCollidable,
102  double _frictionCoeff,
103  double _restitutionCoeff,
104  bool _gravityMode);
105 
108  const std::string& name = "BodyNode",
109  const Inertia& inertia = Inertia(),
110  bool isCollidable = true,
111  bool gravityMode = true);
112 
113  virtual ~BodyNodeAspectProperties() = default;
114 };
115 
116 //==============================================================================
118  = common::CloneableVector<std::unique_ptr<Node::State> >;
120  = std::map<std::type_index, std::unique_ptr<NodeTypeStateVector> >;
121 using AllNodeStates = common::CloneableMap<NodeStateMap>;
122 
123 //==============================================================================
125  = common::CloneableVector<std::unique_ptr<Node::Properties> >;
127  = std::map<std::type_index, std::unique_ptr<NodeTypePropertiesVector> >;
128 using AllNodeProperties = common::CloneableMap<NodePropertiesMap>;
129 
130 //==============================================================================
131 void setAllNodeStates(BodyNode* bodyNode, const AllNodeStates& states);
132 
133 //==============================================================================
134 AllNodeStates getAllNodeStates(const BodyNode* bodyNode);
135 
136 //==============================================================================
138  BodyNode* bodyNode, const AllNodeProperties& properties);
139 
140 //==============================================================================
142 
143 //==============================================================================
144 using NodeVectorProxyAspectState = common::ProxyCloneable<
145  common::Aspect::State,
146  BodyNode,
150 
151 //==============================================================================
152 using NodeVectorProxyAspectProperties = common::ProxyCloneable<
153  common::Aspect::Properties,
154  BodyNode,
158 
159 //==============================================================================
160 using NodeVectorProxyAspect = common::ProxyStateAndPropertiesAspect<
161  BodyNode,
164 
165 //==============================================================================
166 using BodyNodeCompositeBase = common::EmbedStateAndPropertiesOnTopOf<
167  BodyNode,
170  common::RequiresAspect<NodeVectorProxyAspect> >;
171 
172 } // namespace detail
173 } // namespace dynamics
174 } // namespace dart
175 
176 #endif // DART_DYNAMICS_DETAIL_BODYNODEASPECT_HPP_
#define DART_DEPRECATED(version)
Definition: Deprecated.hpp:51
BodyPropPtr properties
Definition: SdfParser.cpp:80
std::string * name
Definition: SkelParser.cpp:1697
MapHolder is a templated wrapper class that is used to allow maps of Aspect::State and Aspect::Proper...
Definition: Cloneable.hpp:221
The CloneableVector type wraps a std::vector of an Cloneable type allowing it to be handled by an Clo...
Definition: Cloneable.hpp:288
This is an alternative to EmbedStateAndProperties which allows your class to also inherit other Compo...
Definition: EmbeddedAspect.hpp:435
Definition: Cloneable.hpp:140
Definition: ProxyAspect.hpp:61
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
Definition: Inertia.hpp:44
The Node class is a base class for BodyNode and any object that attaches to a BodyNode.
Definition: Node.hpp:81
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
std::map< std::type_index, std::unique_ptr< NodeTypePropertiesVector > > NodePropertiesMap
Definition: BodyNodeAspect.hpp:127
AllNodeProperties getAllNodeProperties(const BodyNode *bodyNode)
Definition: BodyNode.cpp:214
AllNodeStates getAllNodeStates(const BodyNode *bodyNode)
Definition: BodyNode.cpp:201
void setAllNodeProperties(BodyNode *bodyNode, const AllNodeProperties &properties)
Definition: BodyNode.cpp:207
void setAllNodeStates(BodyNode *bodyNode, const AllNodeStates &states)
Definition: BodyNode.cpp:195
std::map< std::type_index, std::unique_ptr< NodeTypeStateVector > > NodeStateMap
Definition: BodyNodeAspect.hpp:120
const double DART_DEFAULT_FRICTION_COEFF
Definition: BodyNodeAspect.hpp:47
const double DART_DEFAULT_RESTITUTION_COEFF
Definition: BodyNodeAspect.hpp:48
Definition: BulletCollisionDetector.cpp:65
Definition: SharedLibraryManager.hpp:46
Definition: BodyNodeAspect.hpp:68
double mFrictionCoeff
Coefficient of friction.
Definition: BodyNodeAspect.hpp:82
double mRestitutionCoeff
Coefficient of restitution.
Definition: BodyNodeAspect.hpp:88
bool mGravityMode
Gravity will be applied if true.
Definition: BodyNodeAspect.hpp:91
std::string mName
Name of the Entity.
Definition: BodyNodeAspect.hpp:70
Inertia mInertia
Inertia information for the BodyNode.
Definition: BodyNodeAspect.hpp:73
bool mIsCollidable
Indicates whether this node is collidable;.
Definition: BodyNodeAspect.hpp:76
Definition: BodyNodeAspect.hpp:54
BodyNodeState(const Eigen::Vector6d &Fext=Eigen::Vector6d::Zero())
Definition: BodyNode.cpp:220
Eigen::Vector6d mFext
External spatial force.
Definition: BodyNodeAspect.hpp:56