-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update obstacle layer usage of max ranges #5697
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
Update obstacle layer usage of max ranges #5697
Conversation
845dced to
be10620
Compare
|
@sd-kudan, your PR has failed to build. Please check CI outputs and resolve issues. |
|
Can you rebase / pull in main (we squash merge anyways) to get CI to turn over? I want to see the tests pass before I dig in. I'm going to need to really dive into code surrounding this for a full review since its a big change with subtle potential issues, so before I do that I want to make sure automated testing doesn't already flag issues that makes my time unnecessary :-) |
Signed-off-by: Simon Dathan <[email protected]>
Signed-off-by: Simon Dathan <[email protected]>
Signed-off-by: Simon Dathan <[email protected]>
Signed-off-by: Simon Dathan <[email protected]>
be10620 to
cea3222
Compare
Signed-off-by: Simon Dathan <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
SteveMacenski
left 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 think you have some functional problems here - as well as a few stylistic thing we should clean up that linters / ROS styling doesn't support
Signed-off-by: Simon Dathan <[email protected]>
Signed-off-by: Simon Dathan <[email protected]>
…acle-layer-usage-of-max-range
| // Reduce the observation distance by 1 cell so that the cell containing the | ||
| // observation is not cleared | ||
| cell_raytrace_max_range = | ||
| std::min(cell_raytrace_max_range, observation_dist - 1); |
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.
Please remove - I'm not sure this is important considering the marking observation is triggered after the clearing.
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 wanted to check - I had added this to handle the case where raytrace_max_range > obstacle_max_range. In that case the cell might not be subsequently marked. Setting raytrace_max_range > obstacle_max_range helps avoid ghost obstacles lingering in the map when an obstacle is moving away from the sensor.
If that's not the behavior you'd expect with this configuration I'll remove.
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.
That does beg a question, I agree. If the marking reading doesn't meet obstacle_max_range, then its not going to be marked no matter what. I don't think it makes sense to cull clearing when marking was set not to cover this spectrum.
I agree that I would be concerned about if they were equal and some small casting error resulted in marking being OOB but clearing was able to happen, but I think that as something in this PR we can make sure we compute the same as to make sure this doesn't happen.
We do marking after clearing, so I think there's not a validly possible case that this should cover:
- Mark after clear, so if marking is possible, it should mark even if cleared previously
- If the ranges are the same, we should ensure in this PR that there's no floating point / casting error that would result in a clearing operation that marking doesn't also cover, as a point of technical correctness
- If the obstacle range is smaller, then we know that we're going to clearing marked things 1-N cells further, so that seems like an intentional choice of settings
But, please, push back if I'm missing a key detail that you're looking out for
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 think it comes down to interpretation of what should happen when raytracing and what a "clearing observation" means. My expectation is to clear up to but excluding the cell containing the observed point, since we have no evidence that the cell is empty. So for point 3, if we have an observation beyond obstacle_max_range I wouldn't expect it to be cleared, even though we have decided not to mark it. Happy to remove if you disagree or if you think it could cause problems.
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 think we should remove in this context. I generally agree with you, but this is 10+ year old code and I'd rather not disrupt things too much in such a sensitive location in the codebase. Unless there's a bug, I'd like to avoid potentially creating one for some subset of users that use the clearing / marking in unique ways.
One way I think this could fail is when the raymarching is aliased due to the ray not being aligned with the cell axes. If we back out one full cell, that could actually be multiple cells that are hit. I think our raycasting uses full 1 cell increments so it wouldn't change, but if we did it in say 0.5 cells (or later changed it to another GPU accelerated library with finer checks), then we'd have an obstacle that should have been cleared because we didn't raycast far enough.
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.
Understood - I have removed this. I have also removed skipping raytracing the origin cell when observation_dist == 0 as it's just handling a special case of this change. See #5697 (comment)
|
Last question: casting values always truncates the number, so for |
Signed-off-by: Simon Dathan <[email protected]>
Yes - I think truncation is consistent as that's what is done in |
|
@sd-kudan, please pull in / rebase main, we had some CI issues earlier |
…acle-layer-usage-of-max-range
|
@mini-1235 see the failure now |
I'm aware, but still unable to reproduce this locally 🫠 |
SteveMacenski
left 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.
Otherwise LGTM
Sorry for these death-by-a-thousand-cuts reviews. I really do appreciate this! I promise other less low-level things will be easier in the future 😉
Signed-off-by: Simon Dathan <[email protected]>
|
See #5697 (comment) and then we can merge :-) |
Signed-off-by: Simon Dathan <[email protected]>
Signed-off-by: Simon Dathan <[email protected]>
…acle-layer-usage-of-max-range
Signed-off-by: Simon Dathan <[email protected]>
|
Merged! Again, sorry about the death by a thousand cuts. That is really not the experience I try to have with developers. I appreicate your willingness to iterate. I expect future contributions to be easier 😉 |
No problem, got there in the end 😄 |
* Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]>
|
Hi @SteveMacenski what is the process for backporting? Should I create a PR for jazzy? |
|
@sd-kudan Yes, please open a manual backport PR to Jazzy. I can see there are some conflicts when cherry-picking, so we can't use the Mergify bot for this one |
* Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]>
* Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: Decwest <[email protected]>
* Update obstacle layer usage of max ranges (#5697) * Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> * Fix tests for jazzy Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]>
* Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: Christopher Thompson <[email protected]>
* Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]>
* No need to spam the logs (#5674) Signed-off-by: Tim Clephas <[email protected]> * Conditionally call onLoop based on node status (#5700) Signed-off-by: Steve Macenski <[email protected]> * Allow for no progress checkers to be configured (#5701) Signed-off-by: SteveMacenski <[email protected]> * Fix: wait for drive_on_heading_client instead of backup_client (#5724) The basic navigator was waiting for the backup_client in the driveOnHeading function. Signed-off-by: agennart <[email protected]> Co-authored-by: agennart <[email protected]> * Fix: reset controller_server loop_rate when missed desired rate #5712 (#5723) When a single iteration takes longer than the expected period, this impacts the next iterations behavior since they will have less time to perform the control logic, thus increasing the actual controller_frequency. By resetting the loop_rate on sleep() failure, this ensures that each iteration will have a full period to exectue its logic. Signed-off-by: agennart <[email protected]> Co-authored-by: agennart <[email protected]> * temporary fix bug null pointer (#5749) * temporary fix bug null pointer Signed-off-by: suifengersan123 <[email protected]> * add return Signed-off-by: suifengersan123 <[email protected]> * remove return Signed-off-by: suifengersan123 <[email protected]> --------- Signed-off-by: suifengersan123 <[email protected]> * fix: change warning to exception when goal poses cannot be transformed (#5759) - Replace RCLCPP_WARN with std::runtime_error exception in onPreempt method - Remove bt_action_server_->terminatePendingGoal() call after accepting goal - Add required stdexcept include for exception handling Fixes issue where navigators accept pending goal but are not properly terminated if rejected during goal pose transformation. Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Update obstacle layer usage of max ranges (#5697) * Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> * [mppi] Don't reset zone-based speed limits (#5768) * [mppi] Don't reset zone-based speed limits Signed-off-by: Adi Vardi <[email protected]> * [mppi] update motion model params from speed_limit Signed-off-by: Adi Vardi <[email protected]> * fix linting issue Signed-off-by: Adi Vardi <[email protected]> * Revert: reset speed limits after param change Signed-off-by: Adi Vardi <[email protected]> --------- Signed-off-by: Adi Vardi <[email protected]> * Bugfix inactive publishers (#5748) * Do not publish costmap unless active Signed-off-by: Christopher Thompson <[email protected]> * Fix style Signed-off-by: Christopher Thompson <[email protected]> * Fix typo Signed-off-by: Christopher Thompson <[email protected]> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <[email protected]> * Fix style Signed-off-by: Christopher Thompson <[email protected]> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <[email protected]> * Remove extra scoping Signed-off-by: Christopher Thompson <[email protected]> --------- Signed-off-by: Christopher Thompson <[email protected]> Co-authored-by: Christopher Thompson <[email protected]> * Fix MAX_NON_OBSTACLE_COST in theta star planner (#5865) Signed-off-by: mini-1235 <[email protected]> * Bump jazzy to 1.3.11 for release Signed-off-by: SteveMacenski <[email protected]> --------- Signed-off-by: Tim Clephas <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: SteveMacenski <[email protected]> Signed-off-by: agennart <[email protected]> Signed-off-by: suifengersan123 <[email protected]> Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: Adi Vardi <[email protected]> Signed-off-by: Christopher Thompson <[email protected]> Signed-off-by: mini-1235 <[email protected]> Co-authored-by: Tim Clephas <[email protected]> Co-authored-by: Saitama <[email protected]> Co-authored-by: agennart <[email protected]> Co-authored-by: suifengersan123 <[email protected]> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Simon Dathan <[email protected]> Co-authored-by: Adi Vardi <[email protected]> Co-authored-by: Christopher Thompson <[email protected]> Co-authored-by: Christopher Thompson <[email protected]> Co-authored-by: Maurice Alexander Purnawan <[email protected]>
…ion#5775) * Update obstacle layer usage of max ranges (ros-navigation#5697) * Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> * Fix tests for jazzy Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: mini-1235 <[email protected]>
) * Backport jazzy: Update obstacle layer usage of max range (#5775) * Update obstacle layer usage of max ranges (#5697) * Use cell distance for obstacle marking max range Signed-off-by: Simon Dathan <[email protected]> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <[email protected]> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <[email protected]> * Fix cpplint failures Signed-off-by: Simon Dathan <[email protected]> * Fix distance calculation Signed-off-by: Simon Dathan <[email protected]> * fix casting, formatting Signed-off-by: Simon Dathan <[email protected]> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <[email protected]> * use hypot instead of squared dist Signed-off-by: Simon Dathan <[email protected]> * Move origin calc out of loop Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <[email protected]> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <[email protected]> * Remove new line Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> * Fix tests for jazzy Signed-off-by: Simon Dathan <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: mini-1235 <[email protected]> * Remove unrelated changes Signed-off-by: mini-1235 <[email protected]> * Lint Signed-off-by: mini-1235 <[email protected]> --------- Signed-off-by: Simon Dathan <[email protected]> Signed-off-by: mini-1235 <[email protected]> Co-authored-by: Simon Dathan <[email protected]>
Basic Info
Description of contribution in a few bullet points
To address issue reported in #5476 of obstacles being cleared when reversing away from them, the following changes are made:
obstacle_max_rangeis done in grid cell space for consistency with the ray tracing free space check againstraytrace_max_rangeraytrace_max_range > obstacle_max_rangeDescription of documentation updates required from your changes
Description of how this change was tested
Demo
Before:
obstacle_layer_clearing.mp4
After:
obstacle_layer.mp4
Future work that may be required in bullet points
For Maintainers:
backport-*.