Rigid Body Dynamics Library
Constraint_Loop.h
Go to the documentation of this file.
1/*
2 * RBDL - Rigid Body Dynamics Library
3 * Copyright (c) 2019 Matthew Millard <millard.matthew@gmail.com>
4 * Licensed under the zlib license. See LICENSE for more details.
5 */
6
7#ifndef RBDL_LOOP_CONSTRAINT_H
8#define RBDL_LOOP_CONSTRAINT_H
9
10#include <rbdl/rbdl_math.h>
11#include <rbdl/rbdl_mathutils.h>
12#include <rbdl/Kinematics.h>
13#include <rbdl/Constraint.h>
14#include <assert.h>
15
16namespace RigidBodyDynamics {
17
18
19
20
72class RBDL_DLLAPI LoopConstraint : public Constraint {
73
74public:
75
76
78
141 const unsigned int bodyIdPredecessor,
142 const unsigned int bodyIdSuccessor,
143 const Math::SpatialTransform &XPredecessor,
144 const Math::SpatialTransform &XSuccessor,
145 const Math::SpatialVector &constraintAxisInPredessor,
146 bool enableBaumgarteStabilization = false,
147 double stabilizationTimeConstant = 0.1,
148 const char *loopConstraintName = NULL,
149 unsigned int userDefinedId = std::numeric_limits<unsigned int>::max(),
150 bool positionLevelConstraint=true,
151 bool velocityLevelConstraint=true);
152
153
154
155 void bind( const Model &model) override;
156
157
158 void calcConstraintJacobian( Model &model,
159 const double time,
160 const Math::VectorNd &Q,
161 const Math::VectorNd &QDot,
162 Math::MatrixNd &GSysUpd,
163 ConstraintCache &cache,
164 bool updateKinematics=false) override;
165
166
167 void calcGamma( Model &model,
168 const double time,
169 const Math::VectorNd &Q,
170 const Math::VectorNd &QDot,
171 const Math::MatrixNd &GSys,
172 Math::VectorNd &gammaSysUpd,
173 ConstraintCache &cache,
174 bool updateKinematics=false) override;
175
176
177 void calcPositionError( Model &model,
178 const double time,
179 const Math::VectorNd &Q,
180 Math::VectorNd &errSysUpd,
181 ConstraintCache &cache,
182 bool updateKinematics=false) override;
183
184
185 void calcVelocityError( Model &model,
186 const double time,
187 const Math::VectorNd &Q,
188 const Math::VectorNd &QDot,
189 const Math::MatrixNd &GSys,
190 Math::VectorNd &derrSysUpd,
191 ConstraintCache &cache,
192 bool updateKinematics=false) override;
193
194
195 void calcConstraintForces(
196 Model &model,
197 const double time,
198 const Math::VectorNd &Q,
199 const Math::VectorNd &QDot,
200 const Math::MatrixNd &GSys,
201 const Math::VectorNd &lagrangeMultipliersSys,
202 std::vector< unsigned int > &constraintBodiesUpd,
203 std::vector< Math::SpatialTransform > &constraintBodyFramesUpd,
204 std::vector< Math::SpatialVector > &constraintForcesUpd,
205 ConstraintCache &cache,
206 bool resolveAllInRootFrame = false,
207 bool updateKinematics=false) override;
208
209
210
215 const std::vector< Math::SpatialVector >& getConstraintAxes(){
216 return T;
217 }
218
227 void appendConstraintAxis(const Math::SpatialVector &constraintAxis,
228 bool positionLevelConstraint = true,
229 bool velocityLevelConstraint = true);
230
231
232private:
234 std::vector< Math::SpatialVector > T;
236 double dblA;
237};
238
239}
240
241/* RBDL_LOOP_CONSTRAINT_H */
242#endif
Interface to define general-purpose constraints.
Definition: Constraint.h:139
Implements a rigid kinematic loop (or body-to-body) constraints as described in Ch....
const std::vector< Math::SpatialVector > & getConstraintAxes()
double dblA
A local working double.
std::vector< Math::SpatialVector > T
Vector of constraint axis resolved in the predecessor frame.
Compact representation of spatial transformations.