8 #ifndef RBDL_CONSTRAINTS_H 9 #define RBDL_CONSTRAINTS_H 294 unsigned int AddContactConstraint (
295 unsigned int body_id,
298 const char *constraint_name = NULL,
299 double normal_acceleration = 0.);
324 unsigned int AddLoopConstraint(
325 unsigned int id_predecessor,
326 unsigned int id_successor,
330 bool enable_stabilization =
false,
331 const double stabilization_param = 0.1,
332 const char *constraint_name = NULL
356 unsigned int AddCustomConstraint(
358 unsigned int id_predecessor,
359 unsigned int id_successor,
362 bool enable_stabilization =
false,
363 const double stabilization_param = 0.1,
364 const char *constraint_name = NULL
373 result.
bound =
false;
381 linear_solver = solver;
396 bool Bind (
const Model &model);
400 return acceleration.size();
420 std::vector<unsigned int>
body;
427 std::vector<Math::SpatialTransform>
X_p;
428 std::vector<Math::SpatialTransform>
X_s;
473 #ifdef RBDL_USE_SIMPLE_MATH 474 SimpleMath::HouseholderQR<Math::MatrixNd> GT_qr;
476 Eigen::HouseholderQR<Math::MatrixNd>
GT_qr;
496 std::vector<Math::SpatialVector>
f_t;
503 std::vector<Math::SpatialVector>
d_pA;
505 std::vector<Math::SpatialVector>
d_a;
509 std::vector<Math::SpatialMatrix>
d_IA;
511 std::vector<Math::SpatialVector>
d_U;
541 bool update_kinematics =
true 560 bool update_kinematics =
true 586 bool update_kinematics =
true 611 std::vector<Math::SpatialVector> *f_ext = NULL
637 double tolerance = 1e-12,
638 unsigned int max_iter = 100
721 std::vector<Math::SpatialVector> *f_ext = NULL
732 std::vector<Math::SpatialVector> *f_ext = NULL
743 std::vector<Math::SpatialVector> *f_ext = NULL
930 Math::LinearSolver &linear_solver
965 Math::LinearSolver linear_solver
1002 Math::LinearSolver &linear_solver
1056 virtual void CalcConstraintsJacobianAndConstraintAxis(
1058 unsigned int custom_constraint_id,
1062 unsigned int GrowStart,
1063 unsigned int GcolStart) = 0;
1065 virtual void CalcGamma(
Model &model,
1066 unsigned int custom_constraint_id,
1072 unsigned int gammaStartIndex) = 0;
1075 virtual void CalcPositionError(
Model &model,
1076 unsigned int custom_constraint_id,
1080 unsigned int errStartIdx) = 0;
1082 virtual void CalcVelocityError(
Model &model,
1083 unsigned int custom_constraint_id,
1089 unsigned int errStartIndex) = 0;
std::vector< std::string > name
Compact representation of spatial transformations.
Math::MatrixNd K
Workspace for the Inverse Articulated-Body Inertia.
Math::VectorNd b
Workspace for the Lagrangian right-hand-side.
Math::VectorNd a
Workspace for the accelerations of due to the test forces.
std::vector< unsigned int > mContactConstraintIndices
Math::VectorNd C
Workspace for the coriolis forces.
Math::MatrixNd GSsi
Workspace when evaluating loop/CustomConstraint Jacobians.
std::vector< ConstraintType > constraintType
Math::VectorNd x
Workspace for the Lagrangian solution.
Contains all information about the rigid body model.
std::vector< CustomConstraint *> mCustomConstraints
Math::VectorNd QDDot_0
Workspace for the default accelerations.
std::vector< unsigned int > mCustomConstraintIndices
Math::MatrixNd Gi
Workspace when evaluating contact Jacobians.
std::vector< Math::SpatialVector > d_U
Workspace when applying constraint forces.
Math::MatrixNd H
Workspace for the joint space inertia matrix.
RBDL_DLLAPI void CalcConstraintsPositionError(Model &model, const Math::VectorNd &Q, ConstraintSet &CS, Math::VectorNd &err, bool update_kinematics)
Computes the position errors for the given ConstraintSet.
std::vector< Math::SpatialVector > constraintAxis
RBDL_DLLAPI void ComputeConstraintImpulsesDirect(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Computes contact gain by constructing and solving the full lagrangian equation.
Namespace for all structures of the RigidBodyDynamics library.
CustomConstraint(unsigned int constraintCount)
RBDL_DLLAPI void ForwardDynamicsConstraintsNullSpace(Model &model, const VectorNd &Q, const VectorNd &QDot, const VectorNd &Tau, ConstraintSet &CS, VectorNd &QDDot, std::vector< Math::SpatialVector > *f_ext)
RBDL_DLLAPI void ComputeConstraintImpulsesRangeSpaceSparse(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Resolves contact gain using SolveContactSystemRangeSpaceSparse()
Math::VectorNd d_d
Workspace when applying constraint forces.
RBDL_DLLAPI void CalcConstraintsVelocityError(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, ConstraintSet &CS, Math::VectorNd &err, bool update_kinematics)
Computes the velocity errors for the given ConstraintSet.
RBDL_DLLAPI void ForwardDynamicsConstraintsDirect(Model &model, const VectorNd &Q, const VectorNd &QDot, const VectorNd &Tau, ConstraintSet &CS, VectorNd &QDDot, std::vector< Math::SpatialVector > *f_ext)
Computes forward dynamics with contact by constructing and solving the full lagrangian equation...
RBDL_DLLAPI bool CalcAssemblyQ(Model &model, Math::VectorNd QInit, ConstraintSet &cs, Math::VectorNd &Q, const Math::VectorNd &weights, double tolerance, unsigned int max_iter)
Computes a feasible initial value of the generalized joint positions.
bool bound
Whether the constraint set was bound to a model (mandatory!).
std::vector< Math::SpatialVector > f_t
Workspace for the test forces.
Math::VectorNd gamma
Workspace of the lower part of b.
void SetSolver(Math::LinearSolver solver)
Specifies which method should be used for solving undelying linear systems.
LinearSolverColPivHouseholderQR
unsigned int mConstraintCount
RBDL_DLLAPI void CalcConstraintsJacobian(Model &model, const Math::VectorNd &Q, ConstraintSet &CS, Math::MatrixNd &G, bool update_kinematics)
Computes the Jacobian for the given ConstraintSet.
Math::MatrixNd A
Workspace for the Lagrangian left-hand-side matrix.
Math::VectorNd QDDot_t
Workspace for the test accelerations.
RBDL_DLLAPI void ForwardDynamicsContactsKokkevis(Model &model, const VectorNd &Q, const VectorNd &QDot, const VectorNd &Tau, ConstraintSet &CS, VectorNd &QDDot)
Computes forward dynamics that accounts for active contacts in ConstraintSet.
RBDL_DLLAPI void SolveConstrainedSystemNullSpace(Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &Y, Math::MatrixNd &Z, Math::VectorNd &qddot_y, Math::VectorNd &qddot_z, Math::LinearSolver &linear_solver)
Solves the contact system by first solving for the joint accelerations and then for the constraint fo...
Interface to define general-purpose constraints.
Structure that contains both constraint information and workspace memory.
RBDL_DLLAPI void ForwardDynamicsConstraintsRangeSpaceSparse(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot, std::vector< Math::SpatialVector > *f_ext)
std::vector< unsigned int > mLoopConstraintIndices
std::vector< Math::SpatialTransform > X_p
std::vector< unsigned int > body_p
RBDL_DLLAPI void SolveConstrainedSystemRangeSpaceSparse(Model &model, Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &K, Math::VectorNd &a, Math::LinearSolver linear_solver)
Solves the contact system by first solving for the the joint accelerations and then the contact force...
std::vector< Math::Vector3d > point_accel_0
Workspace for the default point accelerations.
std::vector< unsigned int > body_s
Math::VectorNd acceleration
std::vector< Math::SpatialTransform > X_s
RBDL_DLLAPI void CalcAssemblyQDot(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotInit, ConstraintSet &cs, Math::VectorNd &QDot, const Math::VectorNd &weights)
Computes a feasible initial value of the generalized joint velocities.
RBDL_DLLAPI void CalcConstrainedSystemVariables(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, std::vector< Math::SpatialVector > *f_ext)
Computes the terms , , and of the constrained dynamic problem and stores them in the ConstraintSet...
std::vector< Math::SpatialVector > d_a
Workspace for the acceleration due to the test force.
virtual ~CustomConstraint()
std::vector< Math::Vector2d > baumgarteParameters
RBDL_DLLAPI void ComputeConstraintImpulsesNullSpace(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
Resolves contact gain using SolveContactSystemNullSpace()
ConstraintSet Copy()
Copies the constraints and resets its ConstraintSet::bound flag.
std::vector< Math::Vector3d > normal
std::vector< Math::Vector3d > d_multdof3_u
std::vector< Math::SpatialVector > f_ext_constraints
Workspace for the actual spatial forces.
Eigen::HouseholderQR< Math::MatrixNd > GT_qr
Workspace for the QR decomposition of the null-space method.
size_t size() const
Returns the number of constraints.
std::vector< Math::Vector3d > point
Math::LinearSolver linear_solver
Method that should be used to solve internal linear systems.
Math::MatrixNd GSpi
Workspace when evaluating loop/CustomConstraint Jacobians.
std::vector< unsigned int > body
std::vector< Math::SpatialVector > d_pA
Workspace for the bias force due to the test force.
Math::MatrixNd GSJ
Workspace when evaluating loop/CustomConstraint Jacobians.
RBDL_DLLAPI void SolveConstrainedSystemDirect(Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &A, Math::VectorNd &b, Math::VectorNd &x, Math::LinearSolver &linear_solver)
Solves the full contact system directly, i.e. simultaneously for contact forces and joint acceleratio...
std::vector< Math::SpatialMatrix > d_IA
Workspace for the inertia when applying constraint forces.