Skip to content

Commit

Permalink
[constraint] fixes joint actuator violation (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
EulalieCoevoet authored Apr 15, 2024
1 parent 8c078e5 commit d7b438d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/SoftRobots.Inverse/component/constraint/CableActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class CableActuator : public Actuator<DataTypes> , public softrobots::constraint
sofa::Data<bool> d_displayCableLimit;

sofa::type::RGBAColor m_color;

void initDatas();
void initData();
void initLimit();
void updateLimit();
void updateVisualization();
Expand Down
8 changes: 4 additions & 4 deletions src/SoftRobots.Inverse/component/constraint/CableActuator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ template<class DataTypes>
void CableActuator<DataTypes>::init()
{
softrobots::constraint::CableModel<DataTypes>::init();
initDatas();
initData();
initLimit();
}

Expand All @@ -89,19 +89,19 @@ template<class DataTypes>
void CableActuator<DataTypes>::reinit()
{
softrobots::constraint::CableModel<DataTypes>::reinit();
initDatas();
initData();
initLimit();
}

template<class DataTypes>
void CableActuator<DataTypes>::reset()
{
initDatas();
initData();
initLimit();
}

template<class DataTypes>
void CableActuator<DataTypes>::initDatas()
void CableActuator<DataTypes>::initData()
{
d_displacement.setValue(0.0);
d_force.setValue(d_initForce.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void JointActuator<DataTypes>::getConstraintViolation(const ConstraintParams* cP
if(!this->isComponentStateValid())
return ;

Real dFree = Jdx->element(0) - d_initAngle.getValue() + d_angle.getValue();
Real dFree = Jdx->element(0) - d_initAngle.getValue() + m_state->readPositions()[d_index.getValue()][0];
resV->set(m_constraintId, dFree);
}

Expand Down

0 comments on commit d7b438d

Please sign in to comment.