-
Notifications
You must be signed in to change notification settings - Fork 164
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
Conversation
if (m_degrees_of_freedom == 6) | ||
{ | ||
// We add angle limitations for joints 1,2 and 4 on 6 dof | ||
limited_joints[1] = 128.9; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
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)