Skip to content
Open
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
34 changes: 18 additions & 16 deletions src/SoftRobots/component/behavior/SoftRobotsConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ class SoftRobotsConstraint : public softrobots::behavior::SoftRobotsBaseConstrai
///< if false, the constraint does nothing
virtual bool isActive() const;

/// Construct the constraint violations vector of each constraint
///
/// \param resV is the result vector that contains the whole constraint violations
/// \param cParams defines the state vectors to use for positions and velocities. Also defines the order of the constraint (POS, VEL, ACC)
void getConstraintViolation(const sofa::core::ConstraintParams* cParams,
BaseVector *resV) override;


/// Construct the constraint violations vector of each constraint
///
Expand All @@ -90,16 +85,6 @@ class SoftRobotsConstraint : public softrobots::behavior::SoftRobotsBaseConstrai
BaseVector *resV,
const BaseVector *Jdx) = 0;

/// Construct the Jacobian Matrix
///
/// \param cId is the result constraint sparse matrix Id
/// \param cIndex is the index of the next constraint equation: when building the constraint matrix, you have to use this index, and then update it
/// \param cParams defines the state vectors to use for positions and velocities. Also defines the order of the constraint (POS, VEL, ACC)
///
/// Warning: is constraint matrix is built with the current position. Free configuration available in cParams
void buildConstraintMatrix(const sofa::core::ConstraintParams* cParams,
sofa::core::MultiMatrixDerivId cId,
unsigned int &cIndex) override;

/// Construct the Jacobian Matrix
///
Expand All @@ -126,6 +111,23 @@ class SoftRobotsConstraint : public softrobots::behavior::SoftRobotsBaseConstrai

sofa::core::behavior::MechanicalState<DataTypes> *m_state { nullptr }; ///< Associated mechanical state

/// Construct the constraint violations vector of each constraint
///
/// \param resV is the result vector that contains the whole constraint violations
/// \param cParams defines the state vectors to use for positions and velocities. Also defines the order of the constraint (POS, VEL, ACC)
void doGetConstraintViolation(const sofa::core::ConstraintParams* cParams,
BaseVector *resV) override;

/// Construct the Jacobian Matrix
///
/// \param cId is the result constraint sparse matrix Id
/// \param cIndex is the index of the next constraint equation: when building the constraint matrix, you have to use this index, and then update it
/// \param cParams defines the state vectors to use for positions and velocities. Also defines the order of the constraint (POS, VEL, ACC)
///
/// Warning: is constraint matrix is built with the current position. Free configuration available in cParams
void doBuildConstraintMatrix(const sofa::core::ConstraintParams* cParams,
sofa::core::MultiMatrixDerivId cId,
unsigned int &cIndex) override;
private:
void storeLambda(const sofa::core::ConstraintParams* cParams, sofa::Data<VecDeriv>& resId, const sofa::Data<MatrixDeriv>& jacobian, const sofa::linearalgebra::BaseVector* lambda);
};
Expand Down
4 changes: 2 additions & 2 deletions src/SoftRobots/component/behavior/SoftRobotsConstraint.inl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void SoftRobotsConstraint<DataTypes>::init()


template<class DataTypes>
void SoftRobotsConstraint<DataTypes>::getConstraintViolation(const sofa::core::ConstraintParams* cParams,
void SoftRobotsConstraint<DataTypes>::doGetConstraintViolation(const sofa::core::ConstraintParams* cParams,
BaseVector *resV)
{
if (cParams)
Expand Down Expand Up @@ -107,7 +107,7 @@ void SoftRobotsConstraint<DataTypes>::getConstraintViolation(const sofa::core::C


template<class DataTypes>
void SoftRobotsConstraint<DataTypes>::buildConstraintMatrix(const sofa::core::ConstraintParams* cParams,
void SoftRobotsConstraint<DataTypes>::doBuildConstraintMatrix(const sofa::core::ConstraintParams* cParams,
sofa::core::MultiMatrixDerivId cId,
unsigned int &cIndex)
{
Expand Down
Loading