Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move arm inbound on init #184

Merged
merged 4 commits into from
Aug 23, 2021
Merged

Conversation

felixmaisonneuve
Copy link
Contributor

When the arm is turned off, it might fall and move "out of bounds" for certain joints and it will be impossible to move the arm using moveit or waypoints.

This function will move the arm within bounds when initializing the ROS driver using jointspeed commands (since waypoints are rejected)

if (m_degrees_of_freedom == 6)
{
// We add angle limitations for joints 1,2 and 4 on 6 dof
limited_joints[1] = 128.9;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a variable holding these values? instead of magic numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. I got them from the User Guide, p.86.

// Angles received by GetMeasuredJointAngles are in range [0,360], but waypoints are in range [-180, 180]
angle = m_math_util.toDeg(m_math_util.wrapRadiansFromMinusPiToPi(m_math_util.toRad(angle)));

if(limited_joints.find(i) != limited_joints.end())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find if (limited_joints.count(i) more readable but that's personal

{
float delta = m_math_util.findDeltaFromBoundaries(angle, limited_joints.at(i));

if (delta != 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be careful for float equality, should probably check for delta > epsilon

@@ -100,6 +100,18 @@ double KortexMathUtil::absolute_position_from_relative(double relative_position,
return relative_position * range + min_value;
}

double KortexMathUtil::findDeltaFromBoundaries(double value, double limit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could rename to something more verbose like findDistanceToBoundary

limited_joints[2] = 147.8;
limited_joints[4] = 120.3;
}
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if (m_degrees_of_freedom == 7) and an else to handle error case of something different?


if(limited_joints.find(i) != limited_joints.end())
{
float delta = m_math_util.findDeltaFromBoundaries(angle, limited_joints.at(i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function returns a double and you're casting to float, should be double everywhere or float everywhere

@felixmaisonneuve felixmaisonneuve merged commit eff4d3f into melodic-devel Aug 23, 2021
@felixmaisonneuve felixmaisonneuve deleted the move-arm-inbound-on-init branch August 23, 2021 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants