Skip to content

Commit

Permalink
fix(joint_locker): fix joint locker unlock bug (#212)
Browse files Browse the repository at this point in the history
This commit ensures that the joint limits are not set to 0.0 when the
unlock feature is called before the lock feature.
  • Loading branch information
rickstaa authored Jan 3, 2024
1 parent d819045 commit 3251cb3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions panda_gazebo/src/panda_joint_locker_world_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ class PandaJointLockerPlugin : public WorldPlugin
}
else
{
// Unlock the joint by restoring the old joint limits.
joint->SetLowerLimit(JOINT_AXIS_INDEX, this->oldLowerLimit[joint_name]);
joint->SetUpperLimit(JOINT_AXIS_INDEX, this->oldUpperLimit[joint_name]);
// Unlock the joint by restoring the old joint limits if they exist.
if (this->oldLowerLimit.find(joint_name) != this->oldLowerLimit.end() &&
this->oldUpperLimit.find(joint_name) != this->oldUpperLimit.end())
{
joint->SetLowerLimit(JOINT_AXIS_INDEX, this->oldLowerLimit[joint_name]);
joint->SetUpperLimit(JOINT_AXIS_INDEX, this->oldUpperLimit[joint_name]);
}
}
}

res.success = true;
res.message = "Joints updated successfully";
res.message = "Joint " + (req.lock ? "locking" : "unlocking") + " successful";
return true;
}
};
Expand Down

0 comments on commit 3251cb3

Please sign in to comment.