DART  6.6.2
BodyNodeAspect.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2018, 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 
36 #include "dart/dynamics/Entity.hpp"
38 #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 
80 
83 
86 
89  const std::string& name = "BodyNode",
90  const Inertia& _inertia = Inertia(),
91  bool _isCollidable = true,
92  double _frictionCoeff = DART_DEFAULT_FRICTION_COEFF,
93  double _restitutionCoeff = DART_DEFAULT_RESTITUTION_COEFF,
94  bool _gravityMode = true);
95 
96  virtual ~BodyNodeAspectProperties() = default;
97 };
98 
99 //==============================================================================
101 using NodeStateMap = std::map< std::type_index, std::unique_ptr<NodeTypeStateVector> >;
103 
104 //==============================================================================
106 using NodePropertiesMap = std::map< std::type_index, std::unique_ptr<NodeTypePropertiesVector> >;
108 
109 //==============================================================================
110 void setAllNodeStates(BodyNode* bodyNode, const AllNodeStates& states);
111 
112 //==============================================================================
113 AllNodeStates getAllNodeStates(const BodyNode* bodyNode);
114 
115 //==============================================================================
117  BodyNode* bodyNode, const AllNodeProperties& properties);
118 
119 //==============================================================================
121 
122 //==============================================================================
126 
127 //==============================================================================
131 
132 //==============================================================================
135 
136 //==============================================================================
140 
141 } // namespace detail
142 } // namespace dynamics
143 } // namespace dart
144 
145 #endif // DART_DYNAMICS_DETAIL_BODYNODEASPECT_HPP_
BodyPropPtr properties
Definition: SdfParser.cpp:80
std::string * name
Definition: SkelParser.cpp:1642
If your Aspect has Properties, then that Properties class should inherit this Aspect::Properties clas...
Definition: Aspect.hpp:83
If your Aspect has a State, then that State class should inherit this Aspect::State class.
Definition: Aspect.hpp:64
MapHolder is a templated wrapper class that is used to allow maps of Aspect::State and Aspect::Proper...
Definition: Cloneable.hpp:224
The CloneableVector type wraps a std::vector of an Cloneable type allowing it to be handled by an Clo...
Definition: Cloneable.hpp:293
This is an alternative to EmbedStateAndProperties which allows your class to also inherit other Compo...
Definition: EmbeddedAspect.hpp:438
Definition: Cloneable.hpp:140
Definition: ProxyAspect.hpp:57
RequiresAspect allows classes that inherit Composite to know which Aspects are required for their ope...
Definition: RequiresAspect.hpp:48
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:78
Definition: Inertia.hpp:44
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
AllNodeProperties getAllNodeProperties(const BodyNode *bodyNode)
Definition: BodyNode.cpp:204
common::ProxyCloneable< common::Aspect::State, BodyNode, AllNodeStates, &setAllNodeStates, &getAllNodeStates > NodeVectorProxyAspectState
Definition: BodyNodeAspect.hpp:125
AllNodeStates getAllNodeStates(const BodyNode *bodyNode)
Definition: BodyNode.cpp:191
void setAllNodeProperties(BodyNode *bodyNode, const AllNodeProperties &properties)
Definition: BodyNode.cpp:197
void setAllNodeStates(BodyNode *bodyNode, const AllNodeStates &states)
Definition: BodyNode.cpp:185
std::map< std::type_index, std::unique_ptr< NodeTypeStateVector > > NodeStateMap
Definition: BodyNodeAspect.hpp:101
std::map< std::type_index, std::unique_ptr< NodeTypePropertiesVector > > NodePropertiesMap
Definition: BodyNodeAspect.hpp:106
common::CloneableMap< NodePropertiesMap > AllNodeProperties
Definition: BodyNodeAspect.hpp:107
common::CloneableMap< NodeStateMap > AllNodeStates
Definition: BodyNodeAspect.hpp:102
const double DART_DEFAULT_FRICTION_COEFF
Definition: BodyNodeAspect.hpp:47
const double DART_DEFAULT_RESTITUTION_COEFF
Definition: BodyNodeAspect.hpp:48
Eigen::Matrix6d Inertia
Definition: MathTypes.hpp:105
Definition: BulletCollisionDetector.cpp:63
Definition: BodyNodeAspect.hpp:68
double mFrictionCoeff
Coefficient of friction.
Definition: BodyNodeAspect.hpp:79
double mRestitutionCoeff
Coefficient of restitution.
Definition: BodyNodeAspect.hpp:82
bool mGravityMode
Gravity will be applied if true.
Definition: BodyNodeAspect.hpp:85
std::string mName
Name of the Entity.
Definition: BodyNodeAspect.hpp:70
BodyNodeAspectProperties(const std::string &name="BodyNode", const Inertia &_inertia=Inertia(), bool _isCollidable=true, double _frictionCoeff=DART_DEFAULT_FRICTION_COEFF, double _restitutionCoeff=DART_DEFAULT_RESTITUTION_COEFF, bool _gravityMode=true)
Constructor.
Definition: BodyNode.cpp:217
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:210
Eigen::Vector6d mFext
External spatial force.
Definition: BodyNodeAspect.hpp:56