-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Bugfix inactive publishers #5748
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
Bugfix inactive publishers #5748
Conversation
|
Updated against main branch instead of jazzy |
|
|
||
| void Costmap2DPublisher::publishCostmap() | ||
| { | ||
| if(!active_) { |
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.
| if(!active_) { | |
| if (!active_) { |
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.
Where is active_ ever set to true?
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 is a good question. I naively thought it was already used and working. Will look into this.
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.
Where is
active_ever set to true?
Ok, looking at the active_ variable, it is definitely never set. The doxy says it's based on the update frequency, but that's not a property of the costmap it's a property of the Costmap2DROS object. I don't know if this was a property that was moved at some point in time and active_ is just leftover cruft or if it's some unimplemented feature.
I see there are 2 options:
- Just yank
active_andactive()from theCostmap2DPublisher - Add a setter to so
Costmap2DPublishercan setactive_. This could be directly (void set_active(bool active)) or indirectly (void set_publish_rate (double rate)). The former seems to make more sense given there is no concept of a rate in theCostmap2DPublisher
I'm inclined to think this is just cruft, so should go with option 1. Up to you guys.
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 guess there is a 3rd option where the Costmap2DROS or Costmap2DPublisher integrate the actual enabled param for each layer into the decision to publish. I need to look into how that param gets plumbed through to see if it's available to use in the Costmap2DROS
Edit: I don't think this will work. I worked up a stub change where the Costmap2DROS simply doesn't create the publishers if the plugin isn't enabled; but that happens in on_configure stage and would be fine except most layers allow dynamic params which would mean the layer could get an updated "enable" value but the Costmap2DROS would have no way (without additional plumbing) to suddenly create a publisher for it.
Putting the check lower in Costmap2DROS::mapUpdateLoop there isn't any association with the layer Publisher and layer itself; and the latter is what has the isEnabled() flag.
The only way I can see to implement this functionality is to
- Remove
activeas a concept from theCostmap2DPublisher - Pass a weak_pointer of the
Layerto theCostmap2DPublisherso it can check on eachpublishCostmapcall whether the layer is enabled or not.
|
@pele1410 any update? |
|
@pele1410 hey any updates? We'd love this in before the holiday season to knock this out |
|
Sorry, got busy at work and haven't had a chance to circle back to this. Hoping to look into it over the Christmas break |
|
Figured out that I could use the |
bab0d31 to
53714fc
Compare
Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com>
53714fc to
036e198
Compare
Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
mini-1235
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.
LGTM functionally, just remove the extra scope
Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com>
|
Do I need to specifically request for this to be backported to Kilted? Or should I do it myself? |
* Do not publish costmap unless active Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix typo Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Remove extra scoping Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> --------- Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com> (cherry picked from commit b766611)
* Do not publish costmap unless active Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix typo Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Remove extra scoping Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> --------- Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com> (cherry picked from commit b766611)
|
Hmm, I believe this would break the ABI since the active_ member variable is being removed. We’d be happy to accept the PR if you could backport just the following logic manually instead: |
Can do. Is there a deprecation marking you would like added to |
No, at least for now we don't do that in Nav2. It's something we might consider in the future |
* Do not publish costmap unless active Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix typo Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Remove extra scoping Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> --------- Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com>
* Do not publish costmap unless active Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix typo Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Remove extra scoping Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> --------- Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com>
* No need to spam the logs (#5674) Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl> * Conditionally call onLoop based on node status (#5700) Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> * Allow for no progress checkers to be configured (#5701) Signed-off-by: SteveMacenski <stevenmacenski@gmail.com> * 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 <antoine.gennart@quimesis.be> Co-authored-by: agennart <antoine.gennart@quimesis.be> * 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 <antoine.gennart@quimesis.be> Co-authored-by: agennart <antoine.gennart@quimesis.be> * temporary fix bug null pointer (#5749) * temporary fix bug null pointer Signed-off-by: suifengersan123 <yangabc810@gmail.com> * add return Signed-off-by: suifengersan123 <yangabc810@gmail.com> * remove return Signed-off-by: suifengersan123 <yangabc810@gmail.com> --------- Signed-off-by: suifengersan123 <yangabc810@gmail.com> * 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 <simon.dathan@kudan.eu> * Don't raytrace clear the cell containing the current observation Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Add tests for max marking and clearing ranges Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Fix cpplint failures Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Fix distance calculation Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * fix casting, formatting Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * check origin is in map, update CMakeLists Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * use hypot instead of squared dist Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Move origin calc out of loop Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Revert don't raytrace observation cell Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Revert don't raytrace origin if it is observation cell Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * Remove new line Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> --------- Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> * [mppi] Don't reset zone-based speed limits (#5768) * [mppi] Don't reset zone-based speed limits Signed-off-by: Adi Vardi <adi.vardi@enway.ai> * [mppi] update motion model params from speed_limit Signed-off-by: Adi Vardi <adi.vardi@enway.ai> * fix linting issue Signed-off-by: Adi Vardi <adi.vardi@enway.ai> * Revert: reset speed limits after param change Signed-off-by: Adi Vardi <adi.vardi@enway.ai> --------- Signed-off-by: Adi Vardi <adi.vardi@enway.ai> * Bugfix inactive publishers (#5748) * Do not publish costmap unless active Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix typo Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Use layers isEnabled() to prevent publishing Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix style Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Add missing include for CostmapLayer type Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> * Remove extra scoping Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> --------- Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com> * Fix MAX_NON_OBSTACLE_COST in theta star planner (#5865) Signed-off-by: mini-1235 <mauricepurnawan@gmail.com> * Bump jazzy to 1.3.11 for release Signed-off-by: SteveMacenski <stevenmacenski@gmail.com> --------- Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl> Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> Signed-off-by: SteveMacenski <stevenmacenski@gmail.com> Signed-off-by: agennart <antoine.gennart@quimesis.be> Signed-off-by: suifengersan123 <yangabc810@gmail.com> Signed-off-by: Simon Dathan <simon.dathan@kudan.eu> Signed-off-by: Adi Vardi <adi.vardi@enway.ai> Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com> Signed-off-by: mini-1235 <mauricepurnawan@gmail.com> Co-authored-by: Tim Clephas <tim.clephas@nobleo.nl> Co-authored-by: Saitama <gennartan@users.noreply.github.com> Co-authored-by: agennart <antoine.gennart@quimesis.be> Co-authored-by: suifengersan123 <136066397+suifengersan123@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Simon Dathan <simon.dathan@kudan.eu> Co-authored-by: Adi Vardi <57910756+adivardi@users.noreply.github.com> Co-authored-by: Christopher Thompson <pele1410@gmail.com> Co-authored-by: Christopher Thompson <cthompson@metalsharkboats.com> Co-authored-by: Maurice Alexander Purnawan <mauricepurnawan@gmail.com>
Basic Info
Description of contribution in a few bullet points
Prevent the costmap_2d_publisher from trying to publish when it is not active.
Description of documentation updates required from your changes
N/A
Description of how this change was tested
Replicated the steps to produce the issue in #5710 and did not see the issue.
Future work that may be required in bullet points
This is not likely the root cause for the out-of-bounds index access but:
For Maintainers:
backport-*.