Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions dart/constraint/ConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "dart/constraint/ConstrainedGroup.hpp"
#include "dart/constraint/ContactConstraint.hpp"
#include "dart/constraint/ContactSurface.hpp"
#include "dart/constraint/CouplerConstraint.hpp"
#include "dart/constraint/JointConstraint.hpp"
#include "dart/constraint/JointCoulombFrictionConstraint.hpp"
#include "dart/constraint/LCPSolver.hpp"
Expand Down Expand Up @@ -493,6 +494,7 @@ void ConstraintSolver::updateConstraints()
// Destroy previous joint constraints
mJointConstraints.clear();
mMimicMotorConstraints.clear();
mCouplerConstraints.clear();
mJointCoulombFrictionConstraints.clear();

// Create new joint constraints
Expand Down Expand Up @@ -520,8 +522,14 @@ void ConstraintSolver::updateConstraints()

if (joint->getActuatorType() == dynamics::Joint::MIMIC
&& joint->getMimicJoint()) {
mMimicMotorConstraints.push_back(std::make_shared<MimicMotorConstraint>(
joint, joint->getMimicDofProperties()));
if (joint->isUsingCouplerConstraint()) {
mCouplerConstraints.push_back(std::make_shared<CouplerConstraint>(
joint, joint->getMimicDofProperties()));
} else {
mMimicMotorConstraints.push_back(
std::make_shared<MimicMotorConstraint>(
joint, joint->getMimicDofProperties()));
}
}
}
}
Expand All @@ -541,6 +549,13 @@ void ConstraintSolver::updateConstraints()
mActiveConstraints.push_back(mimicMotorConstraint);
}

for (auto& couplerConstraint : mCouplerConstraints) {
couplerConstraint->update();

if (couplerConstraint->isActive())
mActiveConstraints.push_back(couplerConstraint);
}

for (auto& jointFrictionConstraint : mJointCoulombFrictionConstraints) {
jointFrictionConstraint->update();

Expand Down
3 changes: 3 additions & 0 deletions dart/constraint/ConstraintSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ class DART_API ConstraintSolver
/// Mimic motor constraints those are automatically created
std::vector<MimicMotorConstraintPtr> mMimicMotorConstraints;

/// Coupler constraints that are automatically created
std::vector<CouplerConstraintPtr> mCouplerConstraints;

/// Joint Coulomb friction constraints those are automatically created
std::vector<JointCoulombFrictionConstraintPtr>
mJointCoulombFrictionConstraints;
Expand Down
Loading
Loading