Remove unnecessary sqrt calculations#4942
Remove unnecessary sqrt calculations#4942RasmusLar wants to merge 2 commits intoros-navigation:mainfrom
Conversation
4913c4f to
7860666
Compare
Codecov ReportAttention: Patch coverage is
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
de28ad2 to
87b842f
Compare
|
|
||
| bool SimpleProgressChecker::isRobotMovedEnough(const geometry_msgs::msg::Pose2D & pose) | ||
| { | ||
| return pose_distance(pose, baseline_pose_) > radius_; |
There was a problem hiding this comment.
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.
See new commit as a suggestion to solve this, resolve if suggestion is good.
| rclcpp::Clock::SharedPtr clock_; | ||
|
|
||
| double radius_; | ||
| double radius_, radius_sqr_; |
There was a problem hiding this comment.
Depending on how negative radius_ values should be checked, this should also be removed?
There was a problem hiding this comment.
See new commit as a suggestion to solve this, resolve if suggestion is good.
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! |
-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 <rasmus.larsson@accenture.com>
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 <rasmus.larsson@accenture.com>
31f026a to
82ce1ce
Compare
Added that in separate PR: #4988 and updated this description |
|
And I think you're right, the improvement is negligible. so I will close this :) |
Basic Info
Description of contribution in a few bullet points
While writing unit tests, fixed discrepancy in goal checker orientation, which was checking for< toleranceinstead of<= tolerance, as all the other limit checks are.Reduced tolerance time for the progress checker unit tests to 0.1 seconds, to reduce test runtime from ~17 to ~7 seconds.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: