DART  6.10.1
JointCoulombFrictionConstraint.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_CONSTRAINT_JOINTCOULOMBFRICTIONCONSTRAINT_HPP_
34 #define DART_CONSTRAINT_JOINTCOULOMBFRICTIONCONSTRAINT_HPP_
35 
37 
38 namespace dart {
39 
40 namespace dynamics {
41 class BodyNode;
42 class Joint;
43 } // namespace dynamics
44 
45 namespace constraint {
46 
49 {
50 public:
53 
56 
57  // Documentation inherited
58  const std::string& getType() const override;
59 
61  static const std::string& getStaticType();
62 
63  //----------------------------------------------------------------------------
64  // Property settings
65  //----------------------------------------------------------------------------
66 
68  static void setConstraintForceMixing(double _cfm);
69 
71  static double getConstraintForceMixing();
72 
73  //----------------------------------------------------------------------------
74  // Friendship
75  //----------------------------------------------------------------------------
76 
77  friend class ConstraintSolver;
78  friend class ConstrainedGroup;
79 
80 protected:
81  //----------------------------------------------------------------------------
82  // Constraint virtual functions
83  //----------------------------------------------------------------------------
84 
85  // Documentation inherited
86  void update() override;
87 
88  // Documentation inherited
89  void getInformation(ConstraintInfo* _lcp) override;
90 
91  // Documentation inherited
92  void applyUnitImpulse(std::size_t _index) override;
93 
94  // Documentation inherited
95  void getVelocityChange(double* _delVel, bool _withCfm) override;
96 
97  // Documentation inherited
98  void excite() override;
99 
100  // Documentation inherited
101  void unexcite() override;
102 
103  // Documentation inherited
104  void applyImpulse(double* _lambda) override;
105 
106  // Documentation inherited
107  dynamics::SkeletonPtr getRootSkeleton() const override;
108 
109  // Documentation inherited
110  bool isActive() const override;
111 
112 private:
115 
118 
120  std::size_t mAppliedImpulseIndex;
121 
123  std::size_t mLifeTime[6];
124 
126  bool mActive[6];
127 
129  double mNegativeVel[6];
130 
132  double mOldX[6];
133 
135  double mUpperBound[6];
136 
138  double mLowerBound[6];
139 
143  static double mConstraintForceMixing;
144 };
145 
146 } // namespace constraint
147 } // namespace dart
148 
149 #endif // DART_CONSTRAINT_JOINTCOULOMBFRICTIONCONSTRAINT_HPP_
ConstrainedGroup is a group of skeletons that interact each other with constraints.
Definition: ConstrainedGroup.hpp:58
Constraint is a base class of concrete constraints classes.
Definition: ConstraintBase.hpp:75
ConstraintSolver manages constraints and computes constraint impulses.
Definition: ConstraintSolver.hpp:57
Joint Coulomb friction constraint.
Definition: JointCoulombFrictionConstraint.hpp:49
static void setConstraintForceMixing(double _cfm)
Set global constraint force mixing parameter.
Definition: JointCoulombFrictionConstraint.cpp:94
double mUpperBound[6]
Definition: JointCoulombFrictionConstraint.hpp:135
void excite() override
Excite the constraint.
Definition: JointCoulombFrictionConstraint.cpp:248
const std::string & getType() const override
Returns a string representing the constraint type.
Definition: JointCoulombFrictionConstraint.cpp:81
std::size_t mAppliedImpulseIndex
Index of applied impulse.
Definition: JointCoulombFrictionConstraint.hpp:120
void applyUnitImpulse(std::size_t _index) override
Apply unit impulse to constraint space.
Definition: JointCoulombFrictionConstraint.cpp:187
JointCoulombFrictionConstraint(dynamics::Joint *_joint)
Constructor.
Definition: JointCoulombFrictionConstraint.cpp:50
void applyImpulse(double *_lambda) override
Apply computed constraint impulse to constrained skeletons.
Definition: JointCoulombFrictionConstraint.cpp:260
bool isActive() const override
Return true if this constraint is active.
Definition: JointCoulombFrictionConstraint.cpp:285
double mOldX[6]
Definition: JointCoulombFrictionConstraint.hpp:132
virtual ~JointCoulombFrictionConstraint()
Destructor.
Definition: JointCoulombFrictionConstraint.cpp:76
static double mConstraintForceMixing
Global constraint force mixing parameter in the range of [1e-9, 1].
Definition: JointCoulombFrictionConstraint.hpp:143
dynamics::SkeletonPtr getRootSkeleton() const override
Definition: JointCoulombFrictionConstraint.cpp:279
double mNegativeVel[6]
Definition: JointCoulombFrictionConstraint.hpp:129
void unexcite() override
Unexcite the constraint.
Definition: JointCoulombFrictionConstraint.cpp:254
bool mActive[6]
Definition: JointCoulombFrictionConstraint.hpp:126
static const std::string & getStaticType()
Returns constraint type for this class.
Definition: JointCoulombFrictionConstraint.cpp:87
static double getConstraintForceMixing()
Get global constraint force mixing parameter.
Definition: JointCoulombFrictionConstraint.cpp:109
void getVelocityChange(double *_delVel, bool _withCfm) override
Get velocity change due to the uint impulse.
Definition: JointCoulombFrictionConstraint.cpp:216
std::size_t mLifeTime[6]
Definition: JointCoulombFrictionConstraint.hpp:123
void update() override
Update constraint using updated Skeleton's states.
Definition: JointCoulombFrictionConstraint.cpp:115
dynamics::Joint * mJoint
Definition: JointCoulombFrictionConstraint.hpp:114
double mLowerBound[6]
Definition: JointCoulombFrictionConstraint.hpp:138
void getInformation(ConstraintInfo *_lcp) override
Fill LCP variables.
Definition: JointCoulombFrictionConstraint.cpp:160
dynamics::BodyNode * mBodyNode
Definition: JointCoulombFrictionConstraint.hpp:117
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
class Joint
Definition: Joint.hpp:60
std::shared_ptr< Skeleton > SkeletonPtr
Definition: SmartPointer.hpp:60
Definition: BulletCollisionDetector.cpp:65
ConstraintInfo.
Definition: ConstraintBase.hpp:50