DART 6.7.3
Loading...
Searching...
No Matches
MimicMotorConstraint.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2019, 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_MIMICMOTORCONSTRAINT_HPP_
34#define DART_CONSTRAINT_MIMICMOTORCONSTRAINT_HPP_
35
37
38namespace dart {
39
40namespace dynamics {
41class BodyNode;
42class Joint;
43} // namespace dynamics
44
45namespace constraint {
46
49{
50public:
52 explicit MimicMotorConstraint(
53 dynamics::Joint* joint,
54 const dynamics::Joint* mimicJoint,
55 double multiplier = 1.0,
56 double offset = 0.0);
57
59 ~MimicMotorConstraint() override;
60
61 //----------------------------------------------------------------------------
62 // Property settings
63 //----------------------------------------------------------------------------
64
66 static void setConstraintForceMixing(double cfm);
67
69 static double getConstraintForceMixing();
70
71 //----------------------------------------------------------------------------
72 // Friendship
73 //----------------------------------------------------------------------------
74
75 friend class ConstraintSolver;
76 friend class ConstrainedGroup;
77
78protected:
79 //----------------------------------------------------------------------------
80 // Constraint virtual functions
81 //----------------------------------------------------------------------------
82
83 // Documentation inherited
84 void update() override;
85
86 // Documentation inherited
87 void getInformation(ConstraintInfo* lcp) override;
88
89 // Documentation inherited
90 void applyUnitImpulse(std::size_t index) override;
91
92 // Documentation inherited
93 void getVelocityChange(double* delVel, bool withCfm) override;
94
95 // Documentation inherited
96 void excite() override;
97
98 // Documentation inherited
99 void unexcite() override;
100
101 // Documentation inherited
102 void applyImpulse(double* lambda) override;
103
104 // Documentation inherited
105 dynamics::SkeletonPtr getRootSkeleton() const override;
106
107 // Documentation inherited
108 bool isActive() const override;
109
110private:
113
116
119
122
125
127 std::size_t mLifeTime[6];
128 // TODO(JS): Lifetime should be considered only when we use iterative lcp
129 // solver
130
132 bool mActive[6];
133
136
138 double mOldX[6];
139
141 double mUpperBound[6];
142
144 double mLowerBound[6];
145
150};
151
152} // namespace constraint
153} // namespace dart
154
155#endif // DART_CONSTRAINT_MIMICMOTORCONSTRAINT_HPP_
std::size_t index
Definition SkelParser.cpp:1617
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:56
Servo motor constraint.
Definition MimicMotorConstraint.hpp:49
std::size_t mLifeTime[6]
Definition MimicMotorConstraint.hpp:127
double mUpperBound[6]
Definition MimicMotorConstraint.hpp:141
dynamics::BodyNode * mBodyNode
Definition MimicMotorConstraint.hpp:121
~MimicMotorConstraint() override
Destructor.
Definition MimicMotorConstraint.cpp:86
bool isActive() const override
Return true if this constraint is active.
Definition MimicMotorConstraint.cpp:291
static double getConstraintForceMixing()
Get global constraint force mixing parameter.
Definition MimicMotorConstraint.cpp:116
void getVelocityChange(double *delVel, bool withCfm) override
Get velocity change due to the uint impulse.
Definition MimicMotorConstraint.cpp:222
double mOldX[6]
Definition MimicMotorConstraint.hpp:138
std::size_t mAppliedImpulseIndex
Index of applied impulse.
Definition MimicMotorConstraint.hpp:124
const dynamics::Joint * mMimicJoint
Definition MimicMotorConstraint.hpp:115
double mMultiplier
Definition MimicMotorConstraint.hpp:118
double mNegativeVelocityError[6]
Definition MimicMotorConstraint.hpp:135
double mLowerBound[6]
Definition MimicMotorConstraint.hpp:144
dynamics::Joint * mJoint
Definition MimicMotorConstraint.hpp:112
static void setConstraintForceMixing(double cfm)
Set global constraint force mixing parameter.
Definition MimicMotorConstraint.cpp:92
void update() override
Update constraint using updated Skeleton's states.
Definition MimicMotorConstraint.cpp:122
void unexcite() override
Unexcite the constraint.
Definition MimicMotorConstraint.cpp:259
static double mConstraintForceMixing
Global constraint force mixing parameter in the range of [1e-9, 1].
Definition MimicMotorConstraint.hpp:149
bool mActive[6]
Definition MimicMotorConstraint.hpp:132
void getInformation(ConstraintInfo *lcp) override
Fill LCP variables.
Definition MimicMotorConstraint.cpp:166
void applyImpulse(double *lambda) override
Apply computed constraint impulse to constrained skeletons.
Definition MimicMotorConstraint.cpp:265
void applyUnitImpulse(std::size_t index) override
Apply unit impulse to constraint space.
Definition MimicMotorConstraint.cpp:193
dynamics::SkeletonPtr getRootSkeleton() const override
Definition MimicMotorConstraint.cpp:285
void excite() override
Excite the constraint.
Definition MimicMotorConstraint.cpp:253
double mOffset
Definition MimicMotorConstraint.hpp:118
BodyNode class represents a single node of the skeleton.
Definition BodyNode.hpp:78
class Joint
Definition Joint.hpp:59
std::shared_ptr< Skeleton > SkeletonPtr
Definition SmartPointer.hpp:60
Definition BulletCollisionDetector.cpp:63
ConstraintInfo.
Definition ConstraintBase.hpp:50