DART  6.6.2
SoftBodyNodeAspect.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_SOFTBODYNODEASPECT_HPP_
34 #define DART_DYNAMICS_DETAIL_SOFTBODYNODEASPECT_HPP_
35 
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 {
111 
113  const BodyNode::Properties& _bodyProperties = BodyNode::Properties(),
114  const SoftBodyNodeUniqueProperties& _softProperties =
116 
117  virtual ~SoftBodyNodeProperties() = default;
118 };
119 
120 //==============================================================================
123  BodyNode>;
124 
125 } // namespace detail
126 } // namespace dynamics
127 } // namespace dart
128 
129 #endif // DART_DYNAMICS_DETAIL_SOFTBODYNODEASPECT_HPP_
#define DART_DEFINE_ALIGNED_SHARED_OBJECT_CREATOR(class_name)
Definition: Memory.hpp:148
This is an alternative to EmbedStateAndProperties which allows your class to also inherit other Compo...
Definition: EmbeddedAspect.hpp:438
Definition: CompositeData.hpp:180
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:78
SoftBodyNode represent a soft body that has one deformable skin.
Definition: SoftBodyNode.hpp:46
Definition: SoftMeshShape.hpp:47
const double DART_DEFAULT_DAMPING_COEFF
Definition: SoftBodyNodeAspect.hpp:45
const double DART_DEFAULT_VERTEX_STIFFNESS
Definition: SoftBodyNodeAspect.hpp:43
const double DART_DEFAULT_EDGE_STIFNESS
Definition: SoftBodyNodeAspect.hpp:44
Definition: BulletCollisionDetector.cpp:63
Properties for each PointMass.
Definition: PointMass.hpp:83
Definition: SoftBodyNodeAspect.hpp:109
SoftBodyNodeProperties(const BodyNode::Properties &_bodyProperties=BodyNode::Properties(), const SoftBodyNodeUniqueProperties &_softProperties=SoftBodyNodeUniqueProperties())
Definition: SoftBodyNode.cpp:110
Definition: SoftBodyNodeAspect.hpp:66
void addFace(const Eigen::Vector3i &_newFace)
Add a face to this Properties struct.
Definition: SoftBodyNode.cpp:98
void addPointMass(const PointMass::Properties &_properties)
Add a PointMass to this Properties struct.
Definition: SoftBodyNode.cpp:68
double mKe
Spring stiffness for edge deformation restoring spring force of the point masses.
Definition: SoftBodyNodeAspect.hpp:73
SoftBodyNodeUniqueProperties(double _Kv=DART_DEFAULT_VERTEX_STIFFNESS, double _Ke=DART_DEFAULT_EDGE_STIFNESS, double _DampCoeff=DART_DEFAULT_DAMPING_COEFF, const std::vector< PointMass::Properties > &_points=std::vector< PointMass::Properties >(), const std::vector< Eigen::Vector3i > &_faces=std::vector< Eigen::Vector3i >())
Definition: SoftBodyNode.cpp:54
std::vector< PointMass::Properties > mPointProps
Array of Properties for PointMasses.
Definition: SoftBodyNodeAspect.hpp:79
bool connectPointMasses(std::size_t i1, std::size_t i2)
Connect two PointMasses together in this Properties struct.
Definition: SoftBodyNode.cpp:75
double mKv
Spring stiffness for vertex deformation restoring spring force of the point masses.
Definition: SoftBodyNodeAspect.hpp:69
std::vector< Eigen::Vector3i > mFaces
Tri-mesh indexes for rendering.
Definition: SoftBodyNodeAspect.hpp:83
double mDampCoeff
Damping coefficient.
Definition: SoftBodyNodeAspect.hpp:76
Definition: SoftBodyNodeAspect.hpp:57
std::vector< PointMass::State > mPointStates
Array of States for PointMasses.
Definition: SoftBodyNodeAspect.hpp:59