Skip to content

Commit

Permalink
ControlBoard: fix limits and joint names for the actuated axes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicogene committed Dec 13, 2024
1 parent 36cda99 commit 9381d0e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions plugins/controlboard/src/ControlBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ bool ControlBoard::setJointProperties(EntityComponentManager& _ecm)
// Let's initialize all the buffers/vectors
configureBuffers();


for (size_t i=0; i<m_controlBoardData.actuatedAxes.size(); i++)
{
if (m_controlBoardData.ijointcoupling) {
bool ok = m_controlBoardData.ijointcoupling->getActuatedAxisName(i, m_controlBoardData.actuatedAxes[i].commonJointProperties.name);
if (!ok) {
yError() << "Error while getting actuated axis name";
return false;
}
}
else {
m_controlBoardData.actuatedAxes[i].commonJointProperties.name = m_controlBoardData.physicalJoints[i].commonJointProperties.name;
}
}

if (!initializeJointPositionLimits(_ecm))
{
yError() << "Error while setting joint position limits";
Expand Down Expand Up @@ -769,6 +784,15 @@ bool ControlBoard::initializeJointPositionLimits(const gz::sim::EntityComponentM
}

}
else {
// If no coupling is present, the actuated axes are the same as the physical joints
for (size_t i = 0; i < m_controlBoardData.actuatedAxes.size(); ++i)
{
auto& actuatedAxis = m_controlBoardData.actuatedAxes[i];
actuatedAxis.commonJointProperties.positionLimitMin = m_controlBoardData.physicalJoints[i].commonJointProperties.positionLimitMin;
actuatedAxis.commonJointProperties.positionLimitMax = m_controlBoardData.physicalJoints[i].commonJointProperties.positionLimitMax;
}
}

return true;
}
Expand Down

0 comments on commit 9381d0e

Please sign in to comment.