dart
SoftBodyNodeAspect.hpp
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_SOFTBODYNODEASPECT_HPP_
34 #define DART_DYNAMICS_DETAIL_SOFTBODYNODEASPECT_HPP_
35 
36 #include "dart/common/RequiresAspect.hpp"
37 #include "dart/dynamics/BodyNode.hpp"
38 #include "dart/dynamics/PointMass.hpp"
39 
40 namespace dart {
41 namespace dynamics {
42 
43 const double DART_DEFAULT_VERTEX_STIFFNESS = 1.0;
44 const double DART_DEFAULT_EDGE_STIFNESS = 1.0;
45 const double DART_DEFAULT_DAMPING_COEFF = 0.01;
46 
47 class SoftBodyNode;
48 class SoftMeshShape;
49 
50 namespace detail {
51 
52 //==============================================================================
53 class SoftBodyAspect;
54 
55 //==============================================================================
57 {
59  std::vector<PointMass::State> mPointStates;
60 
61  virtual ~SoftBodyNodeUniqueState() = default;
62 };
63 
64 //==============================================================================
66 {
69  double mKv;
70 
73  double mKe;
74 
76  double mDampCoeff;
77 
79  std::vector<PointMass::Properties> mPointProps;
80 
81  // TODO(JS): Let's remove this because this is rendering part
83  std::vector<Eigen::Vector3i> mFaces;
84 
86  double _Kv = DART_DEFAULT_VERTEX_STIFFNESS,
87  double _Ke = DART_DEFAULT_EDGE_STIFNESS,
88  double _DampCoeff = DART_DEFAULT_DAMPING_COEFF,
89  const std::vector<PointMass::Properties>& _points
90  = std::vector<PointMass::Properties>(),
91  const std::vector<Eigen::Vector3i>& _faces
92  = std::vector<Eigen::Vector3i>());
93 
94  virtual ~SoftBodyNodeUniqueProperties() = default;
95 
97  void addPointMass(const PointMass::Properties& _properties);
98 
100  bool connectPointMasses(std::size_t i1, std::size_t i2);
101 
103  void addFace(const Eigen::Vector3i& _newFace);
104 };
105 
106 //==============================================================================
109 {
110  DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(SoftBodyNodeProperties)
111 
113  const BodyNode::Properties& _bodyProperties = BodyNode::Properties(),
114  const SoftBodyNodeUniqueProperties& _softProperties
116 
117  virtual ~SoftBodyNodeProperties() = default;
118 };
119 
120 //==============================================================================
122  SoftBodyNode,
125  BodyNode>;
126 
127 } // namespace detail
128 } // namespace dynamics
129 } // namespace dart
130 
131 #endif // DART_DYNAMICS_DETAIL_SOFTBODYNODEASPECT_HPP_
Definition: SoftBodyNodeAspect.hpp:65
SoftBodyNode represent a soft body that has one deformable skin.
Definition: SoftBodyNode.hpp:45
Properties for each PointMass.
Definition: PointMass.hpp:83
std::vector< PointMass::Properties > mPointProps
Array of Properties for PointMasses.
Definition: SoftBodyNodeAspect.hpp:79
This is an alternative to EmbedStateAndProperties which allows your class to also inherit other Compo...
Definition: EmbeddedAspect.hpp:431
Definition: Aspect.cpp:40
std::vector< Eigen::Vector3i > mFaces
Tri-mesh indexes for rendering.
Definition: SoftBodyNodeAspect.hpp:83
std::vector< PointMass::State > mPointStates
Array of States for PointMasses.
Definition: SoftBodyNodeAspect.hpp:59
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:74
double mKe
Spring stiffness for edge deformation restoring spring force of the point masses. ...
Definition: SoftBodyNodeAspect.hpp:73
double mDampCoeff
Damping coefficient.
Definition: SoftBodyNodeAspect.hpp:76
double mKv
Spring stiffness for vertex deformation restoring spring force of the point masses.
Definition: SoftBodyNodeAspect.hpp:69
Definition: SoftBodyNodeAspect.hpp:56
Definition: SoftBodyNodeAspect.hpp:107
Definition: CompositeData.hpp:185