-
Notifications
You must be signed in to change notification settings - Fork 30
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
Avoid invalid argument exceptions in computeJointVelocityFromTwist #262
Conversation
((velocityUpperLimits[i] - _padding) - position) / _timestep); | ||
velocityUpperLimit, | ||
((positionUpperLimit - _padding) - position) / _timestep); | ||
initialGuess[i] = std::min(velocityUpperLimits[i], initialGuess[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.
Maybe we can use std::clamp
instead?
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.
std::clamp
seems a feature since c++17
.
{ | ||
std::rethrow_exception(terminationError); | ||
return convertToSpline(knots, cacheIndex, _stateSpace); | ||
} | ||
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.
Does this ever happen? We need to make sure to avoid throwing exceptions from these planning methods. I think we should be printing some warning and returning nullptr
instead.
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.
It is possible but not currently reproducible in current test cases.
It is a good idea to throw warning instead. I think all this part of code will be changed in a new version VFP.
@@ -196,29 +198,24 @@ std::unique_ptr<aikido::trajectory::Spline> planPathByVectorField( | |||
&& terminationStatus | |||
!= VectorFieldPlannerStatus::CACHE_AND_TERMINATE); | |||
|
|||
if (cacheIndex >= 0) | |||
// Print the termination condition. |
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 this refactor actually correct? This was a somewhat hasty change to stop throwing exceptions.
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.
Yes. I think the logic is the same with previous one. The difference is that no exception will be thrown as long as a planned trajectory is returned.
Codecov Report
@@ Coverage Diff @@
## master #262 +/- ##
==========================================
+ Coverage 70.39% 70.43% +0.04%
==========================================
Files 181 182 +1
Lines 5394 5399 +5
Branches 847 847
==========================================
+ Hits 3797 3803 +6
+ Misses 1077 1076 -1
Partials 520 520
|
and try to improve the readability of computeJointVelocityFromTwist()
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.
Looks good to me.
I added clamp()
function and tried to improve the readability of computeJointVelocityFromTwist()
.
@@ -127,11 +127,13 @@ std::unique_ptr<aikido::trajectory::Spline> planPathByVectorField( | |||
{ | |||
if (!_vectorFiledCb(_stateSpace, t, dq)) | |||
{ | |||
dtwarn << "Failed evaluating VectorField." << std::endl; |
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.
Why do we need additional warning message when we throw with the same message?
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.
Good catch. This part will be rewritten in the new vector field planner. Let's fix that in the new one?
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.
Can we simply remove this in this PR then?
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.
Yes. It is moved now.
Add initial guess (using current MetaSkeleton velocities) to
NloptSolver
inaikido::planner::vectorfield::computeJointVelocityFromTwist
.Update initial guess according to velocity bounds to avoid
invalid argument
thrown fromnlopt
.This is a fix to #257 .
Before creating a pull request
make format
Before merging a pull request
CHANGELOG.md