DART 6.13.2
|
#include <BoxedLcpConstraintSolver.hpp>
Public Member Functions | |
BoxedLcpConstraintSolver (double timeStep, BoxedLcpSolverPtr boxedLcpSolver=nullptr, BoxedLcpSolverPtr secondaryBoxedLcpSolver=nullptr) | |
Constructor. | |
BoxedLcpConstraintSolver () | |
Constructos with default primary and secondary LCP solvers, which are Dantzig and PGS, respectively. | |
BoxedLcpConstraintSolver (BoxedLcpSolverPtr boxedLcpSolver) | |
Constructors with specific primary LCP solver. | |
BoxedLcpConstraintSolver (BoxedLcpSolverPtr boxedLcpSolver, BoxedLcpSolverPtr secondaryBoxedLcpSolver) | |
Constructs with specific primary and secondary LCP solvers. | |
void | setBoxedLcpSolver (BoxedLcpSolverPtr lcpSolver) |
Sets boxed LCP (BLCP) solver. | |
ConstBoxedLcpSolverPtr | getBoxedLcpSolver () const |
Returns boxed LCP (BLCP) solver. | |
void | setSecondaryBoxedLcpSolver (BoxedLcpSolverPtr lcpSolver) |
Sets boxed LCP (BLCP) solver that is used when the primary solver failed. | |
ConstBoxedLcpSolverPtr | getSecondaryBoxedLcpSolver () const |
Returns boxed LCP (BLCP) solver that is used when the primary solver failed. | |
void | addSkeleton (const dynamics::SkeletonPtr &skeleton) |
Add single skeleton. | |
void | addSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons) |
Add mutiple skeletons. | |
const std::vector< dynamics::SkeletonPtr > & | getSkeletons () const |
Returns all the skeletons added to this ConstraintSolver. | |
void | removeSkeleton (const dynamics::SkeletonPtr &skeleton) |
Remove single skeleton. | |
void | removeSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons) |
Remove multiple skeletons. | |
void | removeAllSkeletons () |
Remove all skeletons in this constraint solver. | |
void | addConstraint (const ConstraintBasePtr &constraint) |
Add a constraint. | |
void | removeConstraint (const ConstraintBasePtr &constraint) |
Remove a constraint. | |
void | removeAllConstraints () |
Remove all constraints. | |
std::size_t | getNumConstraints () const |
Returns the number of constraints that was manually added to this ConstraintSolver. | |
constraint::ConstraintBasePtr | getConstraint (std::size_t index) |
Returns a constraint by index. | |
constraint::ConstConstraintBasePtr | getConstraint (std::size_t index) const |
Returns a constraint by index. | |
std::vector< constraint::ConstraintBasePtr > | getConstraints () |
Returns all the constraints added to this ConstraintSolver. | |
std::vector< constraint::ConstConstraintBasePtr > | getConstraints () const |
Returns all the constraints added to this ConstraintSolver. | |
template<typename Func > | |
void | eachConstraint (Func func) const |
Iterates all the constraints and invokes the callback function. | |
template<typename Func > | |
void | eachConstraint (Func func) |
Iterates all the constraints and invokes the callback function. | |
void | clearLastCollisionResult () |
Clears the last collision result. | |
virtual void | setTimeStep (double _timeStep) |
Set time step. | |
double | getTimeStep () const |
Get time step. | |
void | setCollisionDetector (collision::CollisionDetector *collisionDetector) |
Set collision detector. | |
void | setCollisionDetector (const std::shared_ptr< collision::CollisionDetector > &collisionDetector) |
Set collision detector. | |
collision::CollisionDetectorPtr | getCollisionDetector () |
Get collision detector. | |
collision::ConstCollisionDetectorPtr | getCollisionDetector () const |
Get (const) collision detector. | |
collision::CollisionGroupPtr | getCollisionGroup () |
Return collision group of collision objects that are added to this ConstraintSolver. | |
collision::ConstCollisionGroupPtr | getCollisionGroup () const |
Return (const) collision group of collision objects that are added to this ConstraintSolver. | |
collision::CollisionOption & | getCollisionOption () |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. | |
const collision::CollisionOption & | getCollisionOption () const |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. | |
collision::CollisionResult & | getLastCollisionResult () |
Return the last collision checking result. | |
const collision::CollisionResult & | getLastCollisionResult () const |
Return the last collision checking result. | |
void | setLCPSolver (std::unique_ptr< LCPSolver > lcpSolver) |
Set LCP solver. | |
LCPSolver * | getLCPSolver () const |
Get LCP solver. | |
void | solve () |
Solve constraint impulses and apply them to the skeletons. | |
virtual void | setFromOtherConstraintSolver (const ConstraintSolver &other) |
Sets this constraint solver using other constraint solver. | |
ContactSurfaceHandlerPtr | getLastContactSurfaceHandler () const |
Get the handler used for computing contact surface parameters based on the contact properties of the two colliding bodies. | |
void | addContactSurfaceHandler (ContactSurfaceHandlerPtr handler) |
Set the handler used for computing contact surface parameters based on the contact properties of the two colliding bodies. | |
bool | removeContactSurfaceHandler (const ContactSurfaceHandlerPtr &handler) |
Remove the given contact surface handler. | |
Protected Types | |
using | CollisionDetector = collision::CollisionDetector |
Protected Member Functions | |
void | solveConstrainedGroup (ConstrainedGroup &group) override |
bool | containSkeleton (const dynamics::ConstSkeletonPtr &skeleton) const |
Checks if the skeleton is contained in this solver. | |
bool | hasSkeleton (const dynamics::ConstSkeletonPtr &skeleton) const |
Checks if the skeleton is contained in this solver. | |
bool | checkAndAddSkeleton (const dynamics::SkeletonPtr &skeleton) |
Add skeleton if the constraint is not contained in this solver. | |
bool | containConstraint (const ConstConstraintBasePtr &constraint) const |
Check if the constraint is contained in this solver. | |
bool | checkAndAddConstraint (const ConstraintBasePtr &constraint) |
Add constraint if the constraint is not contained in this solver. | |
void | updateConstraints () |
Update constraints. | |
void | buildConstrainedGroups () |
Build constrained groupsContact. | |
void | solveConstrainedGroups () |
Solve constrained groups. | |
bool | isSoftContact (const collision::Contact &contact) const |
Return true if at least one of colliding body is soft body. | |
Protected Attributes | |
BoxedLcpSolverPtr | mBoxedLcpSolver |
Boxed LCP solver. | |
BoxedLcpSolverPtr | mSecondaryBoxedLcpSolver |
Boxed LCP solver to be used when the primary solver failed. | |
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | mA |
Cache data for boxed LCP formulation. | |
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | mABackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mX |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mXBackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mB |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mBBackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mW |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mLo |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mLoBackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mHi |
Cache data for boxed LCP formulation. | |
Eigen::VectorXd | mHiBackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXi | mFIndex |
Cache data for boxed LCP formulation. | |
Eigen::VectorXi | mFIndexBackup |
Cache data for boxed LCP formulation. | |
Eigen::VectorXi | mOffset |
Cache data for boxed LCP formulation. | |
collision::CollisionDetectorPtr | mCollisionDetector |
Collision detector. | |
collision::CollisionGroupPtr | mCollisionGroup |
Collision group. | |
collision::CollisionOption | mCollisionOption |
Collision detection option. | |
collision::CollisionResult | mCollisionResult |
Last collision checking result. | |
double | mTimeStep |
Time step. | |
std::vector< dynamics::SkeletonPtr > | mSkeletons |
Skeleton list. | |
std::vector< ContactConstraintPtr > | mContactConstraints |
Contact constraints those are automatically created. | |
std::vector< SoftContactConstraintPtr > | mSoftContactConstraints |
Soft contact constraints those are automatically created. | |
std::vector< JointConstraintPtr > | mJointConstraints |
Joint limit constraints those are automatically created. | |
std::vector< MimicMotorConstraintPtr > | mMimicMotorConstraints |
Mimic motor constraints those are automatically created. | |
std::vector< JointCoulombFrictionConstraintPtr > | mJointCoulombFrictionConstraints |
Joint Coulomb friction constraints those are automatically created. | |
std::vector< ConstraintBasePtr > | mManualConstraints |
Constraints that manually added. | |
std::vector< ConstraintBasePtr > | mActiveConstraints |
Active constraints. | |
std::vector< ConstrainedGroup > | mConstrainedGroups |
Constraint group list. | |
ContactSurfaceHandlerPtr | mContactSurfaceHandler |
Factory for ContactSurfaceParams for each contact. | |
Private Member Functions | |
bool | isSymmetric (std::size_t n, double *A) |
Return true if the matrix is symmetric. | |
bool | isSymmetric (std::size_t n, double *A, std::size_t begin, std::size_t end) |
Return true if the diagonla block of matrix is symmetric. | |
void | print (std::size_t n, double *A, double *x, double *lo, double *hi, double *b, double *w, int *findex) |
Print debug information. | |
|
protectedinherited |
dart::constraint::BoxedLcpConstraintSolver::BoxedLcpConstraintSolver | ( | double | timeStep, |
BoxedLcpSolverPtr | boxedLcpSolver = nullptr , |
||
BoxedLcpSolverPtr | secondaryBoxedLcpSolver = nullptr |
||
) |
Constructor.
[in] | timeStep | Simulation time step |
[in] | boxedLcpSolver | The primary boxed LCP solver. When nullptr is passed, Dantzig solver will be used. |
[in] | secondaryBoxedLcpSolver | The secondary boxed-LCP solver. When nullptr is passed, PGS solver will be used. This is to make the default solver setting to be Dantzig + PGS. In order to disable use of secondary solver, call setSecondaryBoxedLcpSolver(nullptr) explicitly. |
dart::constraint::BoxedLcpConstraintSolver::BoxedLcpConstraintSolver | ( | ) |
Constructos with default primary and secondary LCP solvers, which are Dantzig and PGS, respectively.
dart::constraint::BoxedLcpConstraintSolver::BoxedLcpConstraintSolver | ( | BoxedLcpSolverPtr | boxedLcpSolver | ) |
Constructors with specific primary LCP solver.
[in] | boxedLcpSolver | The primary boxed LCP solver. When nullptr is passed, which is discouraged, Dantzig solver will be used. |
dart::constraint::BoxedLcpConstraintSolver::BoxedLcpConstraintSolver | ( | BoxedLcpSolverPtr | boxedLcpSolver, |
BoxedLcpSolverPtr | secondaryBoxedLcpSolver | ||
) |
Constructs with specific primary and secondary LCP solvers.
[in] | boxedLcpSolver | The primary boxed LCP solver. When nullptr is passed, which is discouraged, Dantzig solver will be used. |
[in] | secondaryBoxedLcpSolver | The secondary boxed-LCP solver. Pass nullptr to disable using secondary LCP solver. |
|
inherited |
Add a constraint.
|
inherited |
Set the handler used for computing contact surface parameters based on the contact properties of the two colliding bodies.
This function automatically sets the previous handler as parent of the given handler.
|
inherited |
Add single skeleton.
|
inherited |
Add mutiple skeletons.
|
protectedinherited |
Build constrained groupsContact.
|
protectedinherited |
Add constraint if the constraint is not contained in this solver.
|
protectedinherited |
Add skeleton if the constraint is not contained in this solver.
|
inherited |
Clears the last collision result.
|
protectedinherited |
Check if the constraint is contained in this solver.
|
protectedinherited |
Checks if the skeleton is contained in this solver.
|
inherited |
Iterates all the constraints and invokes the callback function.
Func | The callback function type. The function signature should be equivalent to void(ConstraintBase*) or bool(ConstraintBase*) . If you want to conditionally iterate, use bool(ConstraintBase*) and return false when to stop iterating. |
[in] | func | The callback function to be called for each ConstraintBase. |
|
inherited |
Iterates all the constraints and invokes the callback function.
Func | The callback function type. The function signature should be equivalent to void(const ConstraintBase*) or bool(const
ConstraintBase*) . If you want to conditionally iterate, use bool(const
ConstraintBase*) and return false when to stop iterating. |
[in] | func | The callback function to be called for each ConstraintBase. |
ConstBoxedLcpSolverPtr dart::constraint::BoxedLcpConstraintSolver::getBoxedLcpSolver | ( | ) | const |
Returns boxed LCP (BLCP) solver.
|
inherited |
Get collision detector.
|
inherited |
Get (const) collision detector.
|
inherited |
Return collision group of collision objects that are added to this ConstraintSolver.
|
inherited |
Return (const) collision group of collision objects that are added to this ConstraintSolver.
|
inherited |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.
|
inherited |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.
|
inherited |
Returns a constraint by index.
|
inherited |
Returns a constraint by index.
|
inherited |
Returns all the constraints added to this ConstraintSolver.
|
inherited |
Returns all the constraints added to this ConstraintSolver.
|
inherited |
Return the last collision checking result.
|
inherited |
Return the last collision checking result.
|
inherited |
Get the handler used for computing contact surface parameters based on the contact properties of the two colliding bodies.
|
inherited |
Get LCP solver.
|
inherited |
Returns the number of constraints that was manually added to this ConstraintSolver.
ConstBoxedLcpSolverPtr dart::constraint::BoxedLcpConstraintSolver::getSecondaryBoxedLcpSolver | ( | ) | const |
Returns boxed LCP (BLCP) solver that is used when the primary solver failed.
|
inherited |
Returns all the skeletons added to this ConstraintSolver.
|
inherited |
Get time step.
|
protectedinherited |
Checks if the skeleton is contained in this solver.
|
protectedinherited |
Return true if at least one of colliding body is soft body.
|
private |
Return true if the matrix is symmetric.
|
private |
Return true if the diagonla block of matrix is symmetric.
|
private |
Print debug information.
|
inherited |
Remove all constraints.
|
inherited |
Remove all skeletons in this constraint solver.
|
inherited |
Remove a constraint.
|
inherited |
Remove the given contact surface handler.
If it is not the last in the chain of handlers, the neighbor handlers are automatically connected when the given handler is removed. This function returns true when the given handler was found. It returns false when the handler is not found. The search procedure utilizes pointer equality (i.e. the shared pointers have to point to the same address to be treated equal). Take special care to make sure at least one handler is always available.
|
inherited |
Remove single skeleton.
|
inherited |
Remove multiple skeletons.
void dart::constraint::BoxedLcpConstraintSolver::setBoxedLcpSolver | ( | BoxedLcpSolverPtr | lcpSolver | ) |
Sets boxed LCP (BLCP) solver.
[in] | lcpSolver | The primary boxed LCP solver. When nullptr is passed, Dantzig solver will be used. |
|
inherited |
Set collision detector.
This function acquires ownership of the CollisionDetector passed as an argument. This method is deprecated in favor of the overload that accepts a std::shared_ptr.
|
inherited |
Set collision detector.
|
virtualinherited |
Sets this constraint solver using other constraint solver.
All the properties and registered skeletons and constraints will be copied over.
|
inherited |
Set LCP solver.
void dart::constraint::BoxedLcpConstraintSolver::setSecondaryBoxedLcpSolver | ( | BoxedLcpSolverPtr | lcpSolver | ) |
Sets boxed LCP (BLCP) solver that is used when the primary solver failed.
|
virtualinherited |
Set time step.
|
inherited |
Solve constraint impulses and apply them to the skeletons.
|
overrideprotectedvirtual |
Implements dart::constraint::ConstraintSolver.
|
protectedinherited |
Solve constrained groups.
|
protectedinherited |
Update constraints.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protectedinherited |
Active constraints.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Boxed LCP solver.
|
protectedinherited |
Collision detector.
|
protectedinherited |
Collision group.
|
protectedinherited |
Collision detection option.
|
protectedinherited |
Last collision checking result.
|
protectedinherited |
Constraint group list.
|
protectedinherited |
Contact constraints those are automatically created.
|
protectedinherited |
Factory for ContactSurfaceParams for each contact.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protectedinherited |
Joint limit constraints those are automatically created.
|
protectedinherited |
Joint Coulomb friction constraints those are automatically created.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protectedinherited |
Constraints that manually added.
|
protectedinherited |
Mimic motor constraints those are automatically created.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Boxed LCP solver to be used when the primary solver failed.
|
protectedinherited |
Skeleton list.
|
protectedinherited |
Soft contact constraints those are automatically created.
|
protectedinherited |
Time step.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.
|
protected |
Cache data for boxed LCP formulation.