Skip to content
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

mppi parameters_handler: Improve verbose handling (#4704) #4711

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aosmw
Copy link
Contributor

@aosmw aosmw commented Oct 7, 2024

The "verbose" parameter of the parameters_handler is a special case that needs registration before the
dynamic parameter handler callback is registered.

In verbose mode make the parameter handler info/warn/debug messages more expressive.


Basic Info

Info Please fill out this column
Ticket(s) this addresses #4704
Primary OS tested on Ubuntu
Robotic platform tested on AOS kelpie
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

Improve the verbose handling of the mppi parameter_handler class and make it more verbose to
help distinguish between ParameterType::Dynamic and ParameterType::Static parameters.

Description of documentation updates required from your changes

Key point is to treat the verbose parameter of the mppi parameter_handler class
as a special case and register it BEFORE the dynamic parameter handler callback is
registered.

Other parameters may be "ParameterType::Static" on purpose, so a decision is required
about whether or not to return false from the dynamicParamsCallback is required.

I left it as false as per initial PR.


Future work that may be required in bullet points

Make decision about returning false and remove commented out return true.

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

The "verbose" parameter of the parameters_handler is
a special case that needs registration before the
dynamic parameter handler callback is registered.

In verbose mode make the parameter handler info/warn/debug
messages more expressive.

Signed-off-by: Mike Wake <[email protected]>
@aosmw aosmw force-pushed the feature/mw/mppi_param_verbose_4704 branch from baae2fd to 7e9304b Compare October 7, 2024 01:47
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
.../nav2_mppi_controller/tools/parameters_handler.hpp 100.00% <100.00%> (+5.12%) ⬆️
nav2_mppi_controller/src/parameters_handler.cpp 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

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.

Generally approve, 2 nits and will merge!

* remove comments.
* Use RCLCPP_DEBUG instead of INFO for low level messages.
* Add test for trying to access parameters that are not declared.

Signed-off-by: Mike Wake <[email protected]>
@aosmw aosmw marked this pull request as draft October 8, 2024 12:04
…os-navigation#4704)

Attempts to change undefined parameters will not be successful
and will log an error.

Attempts to change static parameters will be ignored, a debug
message is logged if a change in parameters is attempted.

Signed-off-by: Mike Wake <[email protected]>
@aosmw aosmw force-pushed the feature/mw/mppi_param_verbose_4704 branch from b8d38c7 to 4cf6d2b Compare October 8, 2024 13:08
@aosmw aosmw marked this pull request as ready for review October 8, 2024 13:14
setting = as<T>(param);

if (verbose_) {
RCLCPP_INFO(logger_, "Dynamic parameter changed: %s", std::to_string(param).c_str());
}
};

addDynamicParamCallback(name, callback);
auto static_callback = [this, &setting, name](const rclcpp::Parameter & param) {
Copy link
Member

@SteveMacenski SteveMacenski Oct 8, 2024

Choose a reason for hiding this comment

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

If a static callback is created, then if someone attempts to set a static parameter through the dynamic parameter interface, it would return true on the change, even though its static and rejected the update. I would think that it should fail to find the callback and thus return false, just as if the parameter doesn't exist since this parameter is not able to be adjusted dynamically

I see that it logs, which is good, but I think the dynamic parameter setting application needs to get a failure code that it indeed did not successfully set the new parameter's value

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.

Log discrepancy when setting MPPI parameters dynamically
2 participants