-
Notifications
You must be signed in to change notification settings - Fork 946
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
chomp: fix potential calculation #1651
Conversation
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 looking into this, I am surprised the GSoC project didn't encounter it
Also big thanks for converting this function to an early return style, one step closer to a cleaner moveit codebase!
double gradient_magnitude = diff * clearence; // (diff / clearance) | ||
potential = 0.5 * gradient_magnitude * diff; | ||
double gradient_magnitude = diff / clearence; | ||
return 0.5 * gradient_magnitude * diff; // 0.5 * (d - clearance)^2 / clearance |
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 may be worth referencing the formula here, I don't remember by heart if the CHOMP papers have it.
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.
Which formula do you want to reference? I already added the formula as a comment.
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 saw the comment. I meant if there's a good reference an interested reader could go to.
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.
Ah. Ok. No idea, where to find such a reference.
I just verified the formula using my mathematical common sense 😉
Fix #1650. The potential is a piecewise function as follows:
To have a smooth transition at zero, we need
double gradient_magnitude = diff / clearance;
as was stated in the comment.