Skip to content

Conversation

@adivardi
Copy link
Contributor

@adivardi adivardi commented Dec 8, 2025


Basic Info

Info Please fill out this column
Ticket(s) this addresses -
Primary OS tested on Ubuntu
Robotic platform tested on Gazebo sim
Does this PR contain AI generated software? No
Was this PR description generated by AI software? No

Description of contribution in a few bullet points

Fix 2 bugs:

  1. Set the reset() flag correctly to avoid resetting speed limits when other parameters are changed and after a fallback.
  2. initialize the motion model in setSpeedLimit() so that the new speed limit is updated in the motion model settings. This way the predict() function is also aware of the new speed limit.

Description of documentation updates required from your changes

None

Description of how this change was tested

Tested in simulation:
Bug 1:

  • Cause Controller to fail while inside a speed limit filter (e.g. with an obstacle). then check that the speed limit is still set after the controller is reset
  • Changed param with reconfigure, and test the speed limit is still set

Bug 2:
Print the value of one of the constraints params inside predict(). Without this PR, it is never updated. With it, is it updated when entering/leaving a speed limit zone.


Future work that may be required in bullet points

None

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

@adivardi adivardi force-pushed the av/mppi_speed_reset branch from f38e6c0 to dc5fa33 Compare December 8, 2025 15:25
@adivardi adivardi marked this pull request as ready for review December 8, 2025 15:26
Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other 2 lines I agree with

Comment on lines 125 to 126
// Don't reset zone-based speed limits after params changes
parameters_handler_->addPostCallback([this]() {reset(false);});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameters were updated, that can mean that there are new maximum/minimum limits that need to be respected. If for instance the speed limits are set as 50% of 1m/s but the new max controller speed is now 0.3m/s, that would be invalid. That seems like a potential problem on this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
I can see different approaches, each could make sense:

  • Run the speed limit conversion again (so in your example, new max speed will be 50% * 0.3 = 0.15m/s)
  • Take the lowest between the old speed with speed limit and the new value from reconfigure without speed limit
  • Ignore the speed limit and only use the new value from reconfigure

I think (1) is the most strict and consistent, but maybe a bit less intuitive (user sets a new speed, but it's then modified).
What do you think?

Copy link
Member

@SteveMacenski SteveMacenski Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you having a situation where you're messing with the parameters in the middle of a mission via dynamic parameters? That feels like it might not be a wise choice if also using speed limit callbacks.

I also just looked at setSpeedLimit and I guess nothing about this technically prevents the ratio or set velocity from being larger than the limits in the controller (i.e. 110% or 100m/s). So... I suppose you're right that we could keep it as false to not mess with the current limits. I don't think I see an issue with keeping that at the end of a control sequence, even if the new limits are not reset here. that's not intuitive to me because then the new limits really wouldn't be looked at until a no speed limit set enum comes into the setSpeedLimit, but I suppose (?) that's the workflow as intended.

Messing around with both velocities in dynamic parameters and speed limits is super duper inadvisable which is what makes this subtle. Maybe the better action is to set boundaries that you can only set one or the other - so that this workflow is simpler to think about and programming logic? If a dynamic parameter comes in but s.constraints != s.base_constraints, reject the update. Then the rest of what you have now would be fine and we wouldn't have to be concerned about this in the future.

Copy link
Contributor Author

@adivardi adivardi Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not really. The issue I really needed to fix is the other change for the fallback.

I can also restore it to true for the parameter change so the speed limit is reset if someone change the param. Maybe this is the best, at least for manual param changes? (and not some automatic reconfigure).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best answer is this one:

Maybe the better action is to set boundaries that you can only set one or the other - so that this workflow is simpler to think about and programming logic? If a dynamic parameter comes in but s.constraints != s.base_constraints, reject the update. Then the rest of what you have now would be fine and we wouldn't have to be concerned about this in the future.

Alternatively:

I can also restore it to true for the parameter change so the speed limit is reset if someone change the param. Maybe this is the best, at least for manual param changes? (and not some automatic reconfigure).

I'd accept this for now and kick the can down the road. I'd just want a ticket filed on this topic. It would actually be a good first issue item for a student or junior engineer to work on. If its not something you need, maybe just file this ticket to give another developer the opportunity (and not use your limited cycles on something you don't need)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticket: #5768

and I reverted the change for the dynamic params

@adivardi
Copy link
Contributor Author

how can I see the CI tests errors? I can't find any error logs.
All I found was

- nav2_navfn_planner.copyright include/nav2_navfn_planner/navfn.hpp
  <<< failure message
    copyright=Willow Garage, Inc. (2008), license=<unknown>
  >>>
- nav2_navfn_planner.copyright src/navfn.cpp
  <<< failure message
    copyright=Willow Garage, Inc. (2008), license=<unknown>
  >>>

@mini-1235
Copy link
Collaborator

how can I see the CI tests errors? I can't find any error logs.

@adivardi Can you try pulling in / rebase main? I think this is fixed in main already

Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
@adivardi adivardi force-pushed the av/mppi_speed_reset branch from 34e09e1 to 63fdd88 Compare December 17, 2025 09:50
@adivardi
Copy link
Contributor Author

how can I see the CI tests errors? I can't find any error logs.

@adivardi Can you try pulling in / rebase main? I think this is fixed in main already

Done, hope it works

@adivardi
Copy link
Contributor Author

Now the build has timeout out after 45 minutes :(

@mini-1235
Copy link
Collaborator

:( I don't have permission to retrigger this, let's wait for Steve

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
nav2_mppi_controller/src/optimizer.cpp 96.97% <100.00%> (+0.01%) ⬆️

... and 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SteveMacenski SteveMacenski merged commit ec0cbfe into ros-navigation:main Dec 17, 2025
16 checks passed
@adivardi adivardi deleted the av/mppi_speed_reset branch December 18, 2025 07:46
pele1410 pushed a commit to Metal-Shark-Sharktech/navigation2 that referenced this pull request Dec 30, 2025
* [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>
Signed-off-by: Christopher Thompson <cthompson@metalsharkboats.com>
Lotusymt pushed a commit to Lotusymt/navigation2 that referenced this pull request Jan 16, 2026
* [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>
SteveMacenski pushed a commit that referenced this pull request Jan 24, 2026
* [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>
SteveMacenski added a commit that referenced this pull request Jan 24, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants