DART  6.10.1
WeldJointConstraint.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_WELDJOINTCONSTRAINT_HPP_
34 #define DART_CONSTRAINT_WELDJOINTCONSTRAINT_HPP_
35 
36 #include <Eigen/Dense>
37 
39 #include "dart/math/MathTypes.hpp"
40 
41 namespace dart {
42 namespace constraint {
43 
47 {
48 public:
50  explicit WeldJointConstraint(dynamics::BodyNode* _body);
51 
54 
56  void setRelativeTransform(const Eigen::Isometry3d& _tf);
57 
59  const Eigen::Isometry3d& getRelativeTransform() const;
60 
62  virtual ~WeldJointConstraint();
63 
64  // Documentation inherited
65  const std::string& getType() const override;
66 
68  static const std::string& getStaticType();
69 
70 protected:
71  //----------------------------------------------------------------------------
72  // Constraint virtual functions
73  //----------------------------------------------------------------------------
74 
75  // Documentation inherited
76  void update() override;
77 
78  // Documentation inherited
79  void getInformation(ConstraintInfo* _lcp) override;
80 
81  // Documentation inherited
82  void applyUnitImpulse(std::size_t _index) override;
83 
84  // Documentation inherited
85  void getVelocityChange(double* _vel, bool _withCfm) override;
86 
87  // Documentation inherited
88  void excite() override;
89 
90  // Documentation inherited
91  void unexcite() override;
92 
93  // Documentation inherited
94  void applyImpulse(double* _lambda) override;
95 
96  // Documentation inherited
97  bool isActive() const override;
98 
99  // Documentation inherited
100  dynamics::SkeletonPtr getRootSkeleton() const override;
101 
102  // Documentation inherited
103  void uniteSkeletons() override;
104 
105 private:
107  Eigen::Isometry3d mRelativeTransform;
108 
111 
114 
117 
119  double mOldX[6];
120 
122  std::size_t mAppliedImpulseIndex;
123 
124 public:
125  // To get byte-aligned Eigen vectors
126  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
127 };
128 
129 } // namespace constraint
130 } // namespace dart
131 
132 #endif // DART_CONSTRAINT_WELDJOINTCONSTRAINT_HPP_
class JointConstraint
Definition: JointConstraint.hpp:48
WeldJointConstraint represents weld joint constraint between a body and the world or between two bodi...
Definition: WeldJointConstraint.hpp:47
void update() override
Update constraint using updated Skeleton's states.
Definition: WeldJointConstraint.cpp:116
dynamics::SkeletonPtr getRootSkeleton() const override
Definition: WeldJointConstraint.cpp:356
void getVelocityChange(double *_vel, bool _withCfm) override
Get velocity change due to the uint impulse.
Definition: WeldJointConstraint.cpp:281
void applyUnitImpulse(std::size_t _index) override
Apply unit impulse to constraint space.
Definition: WeldJointConstraint.cpp:202
static const std::string & getStaticType()
Returns constraint type for this class.
Definition: WeldJointConstraint.cpp:109
Eigen::Matrix6d mJacobian2
Definition: WeldJointConstraint.hpp:116
const std::string & getType() const override
Returns a string representing the constraint type.
Definition: WeldJointConstraint.cpp:103
void unexcite() override
Unexcite the constraint.
Definition: WeldJointConstraint.cpp:324
void excite() override
Excite the constraint.
Definition: WeldJointConstraint.cpp:311
Eigen::Vector6d mViolation
Definition: WeldJointConstraint.hpp:110
void setRelativeTransform(const Eigen::Isometry3d &_tf)
Set the relative transform that this WeldJointConstraint will enforce.
Definition: WeldJointConstraint.cpp:85
void applyImpulse(double *_lambda) override
Apply computed constraint impulse to constrained skeletons.
Definition: WeldJointConstraint.cpp:337
std::size_t mAppliedImpulseIndex
Index of applied impulse.
Definition: WeldJointConstraint.hpp:122
void getInformation(ConstraintInfo *_lcp) override
Fill LCP variables.
Definition: WeldJointConstraint.cpp:148
virtual ~WeldJointConstraint()
Destructor.
Definition: WeldJointConstraint.cpp:97
Eigen::Isometry3d mRelativeTransform
Definition: WeldJointConstraint.hpp:107
void uniteSkeletons() override
Definition: WeldJointConstraint.cpp:381
WeldJointConstraint(dynamics::BodyNode *_body)
Constructor that takes one body.
Definition: WeldJointConstraint.cpp:44
const Eigen::Matrix6d mJacobian1
Definition: WeldJointConstraint.hpp:113
const Eigen::Isometry3d & getRelativeTransform() const
Get the relative transform that this WeldJointConstraint will enforce.
Definition: WeldJointConstraint.cpp:91
double mOldX[6]
Definition: WeldJointConstraint.hpp:119
bool isActive() const override
Return true if this constraint is active.
Definition: WeldJointConstraint.cpp:415
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
Matrix< double, 6, 6 > Matrix6d
Definition: MathTypes.hpp:50
std::shared_ptr< Skeleton > SkeletonPtr
Definition: SmartPointer.hpp:60
Definition: BulletCollisionDetector.cpp:65
ConstraintInfo.
Definition: ConstraintBase.hpp:50