-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove unnecessary sqrt calculations #4942
base: main
Are you sure you want to change the base?
Remove unnecessary sqrt calculations #4942
Conversation
4913c4f
to
7860666
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
7860666
to
de28ad2
Compare
-To improve performance of the progress and goal checkers, the sqrt calculations were removed. -Fixed discrepancy in goal checker orientation, which was checking for < limit instead of <= limit, as all the other limit checks are. -Reduced sleep time for the progress checker to 0.1 seconds, to reduce test time from ~17 to ~7 seconds. Signed-off-by: Rasmus Larsson <[email protected]>
de28ad2
to
87b842f
Compare
@@ -80,17 +81,17 @@ void SimpleProgressChecker::resetBaselinePose(const geometry_msgs::msg::Pose2D & | |||
|
|||
bool SimpleProgressChecker::isRobotMovedEnough(const geometry_msgs::msg::Pose2D & pose) | |||
{ | |||
return pose_distance(pose, baseline_pose_) > radius_; |
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 just thought of an edge case, if radius_
was negative before, this would always return true.
This is no longer the case, should that be checked?
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.
See new commit as a suggestion to solve this, resolve if suggestion is good.
const geometry_msgs::msg::Pose2D &, | ||
const geometry_msgs::msg::Pose2D &); | ||
|
||
rclcpp::Clock::SharedPtr clock_; | ||
|
||
double radius_; | ||
double radius_, radius_sqr_; |
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.
Depending on how negative radius_
values should be checked, this should also be removed?
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.
See new commit as a suggestion to solve this, resolve if suggestion is good.
After changing to using square values for the radius in the simple progress checker, there was a need to check for negative values, aswell as unit tests for that edge case. Signed-off-by: Rasmus Larsson <[email protected]>
I'm all for performance improvements, but can you highlight what the runtime metrics are for these improvements? Most of these operations are small and infrequent, so it kind of surprises me if this improves the performance in a measurable way. If there's not a measurable change, I'd prefer to not merge in additional complexity
I'm a huge fan of this though! Our Ci times are high and small improvements like this really add up quickly. -- Thanks for the contribution! Sorry for the delay, I was on a trip to India and then I fell sick due to said trip 😆 |
I guess the improvements are minor in the whole context of Nav2, but also I thought the complexity increase was minor. I guess the biggest issue would be readability.
I can separate the tests out into a different PR also when I get time
Ouch, the one downside about traveling, hope you're better! 😄 |
Please! That's easy for me to merge
OK! |
Basic Info
Description of contribution in a few bullet points
< tolerance
instead of<= tolerance
, as all the other limit checks are.Description of documentation updates required from your changes
Description of how this change was tested
Future work that may be required in bullet points
For Maintainers: