-
Notifications
You must be signed in to change notification settings - Fork 938
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
Fix segfault in totg #1861
Fix segfault in totg #1861
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1861 +/- ##
==========================================
+ Coverage 48.46% 50.14% +1.67%
==========================================
Files 298 313 +15
Lines 23305 24639 +1334
==========================================
+ Hits 11295 12355 +1060
- Misses 12010 12284 +274
Continue to review full report at Codecov.
|
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.
Thanks for fixing this! Shouldn't we clip the upper limit as well? Also, did you rule out that the dot product produces nan values?
The check |
@@ -110,7 +110,6 @@ class CircularPathSegment : public PathSegment | |||
const Eigen::VectorXd start_direction = (intersection - start).normalized(); |
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.
If these vectors are close to zero, normalization will result in NaNs or Infs. Not sure though, that this can happen.
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.
@rhaschke True, I suppose there is division in there. I believe the following loop, which is done before the constructor for Path
, ensures that the vectors are large enough that we do not have to worry about failure when taking the dot product. On the other hand, I think once it gets into the heart of the algorithm there are various parts that are not robust to very small values, where for example a 180 degree turn, which this prevents from throwing an exception, might still result in very small time steps between switching points, causing failure during one of the integration methods.
for (size_t j = 0; j < num_joints; j++)
{
new_point[j] = waypoint->getVariablePosition(idx[j]);
if (p > 0 && std::abs(new_point[j] - points.back()[j]) > 0.001)
diverse_point = true;
}
@rhaschke and @Dale-Koenig Any reason to not merge this? |
Ensure acos argument in valid range
Ensure acos argument in valid range
Ensure acos argument in valid range
Description
(At least partially) fixes #1805. Calls to
acos
can result in nan values if not careful due to numerical floating point errors. If there is a possibility of callingacos
on values that are approximately-1
, then it will result in nan, which leads to a segfault later in totg. Also removes an incorrect comment that implies a section would avoid this error, but it actually handles a different case.