Skip to content

Log when a parameter is set #106

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

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Log when a parameter is set #106

merged 1 commit into from
Apr 20, 2023

Conversation

tylerjw
Copy link
Contributor

@tylerjw tylerjw commented Apr 19, 2023

Fixes #86

If you build this locally, you can test this by running the example node with debug logging:

ros2 run generate_parameter_library_example test_node --ros-args --params-file src/generate_parameter_library/example/config/implementation.yaml --log-level debug

Then in another terminal change a parameter:

ros2 param set /admittance_controller control.frame.id new_frame

You should see an output like this in the logs:

[DEBUG] [1681944620.098785049] [admittance_controller]: control.frame.id: string = new_frame

@tylerjw tylerjw force-pushed the log_parameter_getting branch from d2f57b8 to 3f23f6f Compare April 19, 2023 22:33
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
@tylerjw tylerjw force-pushed the log_parameter_getting branch from 3f23f6f to 02babfa Compare April 19, 2023 22:51
Copy link

@abake48 abake48 left a comment

Choose a reason for hiding this comment

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

tested and lgtm

@tylerjw
Copy link
Contributor Author

tylerjw commented Apr 20, 2023

Thank you

Copy link
Contributor

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM 👏

Copy link
Collaborator

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

It works, LGTM (except for the missing dash in your instructions ;) --params-file).

I'm just wondering: At the first run, all parameters are listed in the debug output. After changing .frame.id, there is an output line with the change of this parameter but also a subset of other parameters (pid. and gains. structure. I guess all __map - parameters?). Is this intentional?

@tylerjw
Copy link
Contributor Author

tylerjw commented Apr 20, 2023

The output that seems extra is intentional, because of how the map parameters work they are reread anytime a parameter changes. The log is printed anytime we read a parameter from ROS including on startup.

@christophfroehlich
Copy link
Collaborator

ok, I just saw that at the beginning "all" parameters are written, at run-time only the changed one and the __map parameters.

@tylerjw
Copy link
Contributor Author

tylerjw commented Apr 20, 2023

ok, I just saw that at the beginning "all" parameters are written, at run-time only the changed one and the __map parameters.

The reason the map parameters are re-read after any parameter change is it accounts for if you change the key parameter for the map. Re-reading in the library also will declare any parameters that have not been declared and give them default values in the map. Eventually, I hope to fix this by detecting when the key is changed and only re-reading the map parameters then.

@tylerjw tylerjw merged commit 70c917d into main Apr 20, 2023
@delete-merged-branch delete-merged-branch bot deleted the log_parameter_getting branch April 20, 2023 13:41
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.

Option to print parameter values
4 participants