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/ros2 #40

Merged
merged 28 commits into from
Jan 22, 2025
Merged

Feature/ros2 #40

merged 28 commits into from
Jan 22, 2025

Conversation

nathanhhughes
Copy link
Collaborator

@Schmluk will follow up with you in person later, but was tired of having this half-done in perpetuity. Went a slightly different way than I was originally intending after digging into the the ROS2 launch file parsing infrastructure and as a result implemented something that is in no way tied to ROS2 😅 (but it seems like a useful paradigm even when developing without ROS). Developed the current solution with this as a working example.

Still might need to add a few more tests and think about how logging will function, but hopefully opening this will be a good forcing function for me to finish it.

@nathanhhughes nathanhhughes requested a review from Schmluk January 13, 2025 17:59
Copy link
Collaborator

@Schmluk Schmluk left a comment

Choose a reason for hiding this comment

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

Looks great! Really like the new features of contexts and CLI!

* @param argc Number of command line arguments
* @param argv Command line argument strings
*/
YAML::Node loadFromArguments(int& argc, char* argv[], bool remove_args);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@@ -13,6 +13,7 @@
<license>BSD-3-Clause</license>

<buildtool_depend>cmake</buildtool_depend>
<depend>yaml-cpp</depend>
Copy link
Collaborator

Choose a reason for hiding this comment

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

good catch!

* @param argv Actual command line arguments.
* @param remove_arguments Remove parsed command line arguments.
*/
void initContext(int& argc, char* argv[], bool remove_arguments = true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! I like this version of (process-) global configs!

YAML::Node node;
std::filesystem::path file(filepath);
if (!fs::exists(file)) {
// TODO(nathan) log instead of manual print
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could just import the conf_utils (abstract) logger?

auto& context = instance();
auto node = YAML::Clone(other);
moveDownNamespace(node, ns);
// default behavior of context is to act like the ROS1 param server and extend sequences
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like this! I assume the previous implementation was not extending sequences? I would have thought the recursive implementation would do that (or maybe only maps, not lists).

@@ -4,6 +4,8 @@ This tutorial explains how to create configs and other objects from source data.
**Contents:**
- [Parse from yaml](#parse-from-yaml)
- [Parse from ROS](#parse-from-ros)
- [Parse from the command line](#parse-from-the-command-line)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome to add docs!

@nathanhhughes nathanhhughes merged commit b210eb1 into main Jan 22, 2025
2 checks passed
@nathanhhughes nathanhhughes deleted the feature/ros2 branch January 22, 2025 18:57
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.

2 participants