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

Feature/param integration #1

Merged
merged 5 commits into from
Sep 11, 2024
Merged

Feature/param integration #1

merged 5 commits into from
Sep 11, 2024

Conversation

RCMast3r
Copy link
Contributor

@RCMast3r RCMast3r commented Aug 31, 2024

context:

I am adding in a live parameter handler to the software for use with components internal to the software.

I update the configuration (Configurable base class) handler to both handle live parameters and file-only parameters. the live parameters are loaded first from the file passed in and then are added to a cache internally that then becomes the source of truth for the parameters. this cache can then be updated at runtime by the foxglove parameter interface.

since the configurable base class will have multiple instances running in multiple threads I put the parameter cache (each configurable component has it's own cache) behind a mutex so that the parameter server thread can lock onto that mutex and update it in a thread-safe manor.

I also added a boost signal to the configurable class that gets executed on callback within the foxglove server thread and calls the user implemented signal to handle the parameter updates internally to the configurable component, this allows the "user" of the configurable class within their component to handle live updates the way that they want.

references:
https://www.boost.org/doc/libs/1_84_0/doc/html/signals2/tutorial.html

@RCMast3r RCMast3r requested review from 12458 and SreeDan August 31, 2024 02:16
@12458
Copy link

12458 commented Aug 31, 2024

Do you want a review or stamp? If the former can you provide context on your changes.

@RCMast3r
Copy link
Contributor Author

RCMast3r commented Sep 8, 2024

@12458 @SreeDan I added context for yalls review

/// @return true or false depending on if the key exists or not
bool handle_update_parameter(const std::string &key, std::variant<bool, int, float, std::string> parameter_val)
template <typename ParamType>
std::optional<ParamType> get_live_parameter(const std::string &key)
Copy link

Choose a reason for hiding this comment

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

Consider adding documentation for this method

Copy link

@12458 12458 left a comment

Choose a reason for hiding this comment

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

Based on my limited understand, LGTM.

It would be helpful to include comments explaining the reasoning behind the design decisions where possible. Also document your methods. This would aid future maintainers.

Also consider adding tests (if possible - not really sure how the testing suite works at the moment).

@12458
Copy link

12458 commented Sep 8, 2024

Maybe we should consider writing a code style guide and enforcing documentation styles:

https://www.doxygen.nl/manual/docblocks.html

@RCMast3r RCMast3r merged commit 1d89c23 into master Sep 11, 2024
@RCMast3r RCMast3r deleted the feature/param_integration branch September 11, 2024 15:14
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