-
Notifications
You must be signed in to change notification settings - Fork 471
[Draft]Add structured parameter support #2944
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
base: rolling
Are you sure you want to change the base?
[Draft]Add structured parameter support #2944
Conversation
Signed-off-by: Rahul K.A <[email protected]>
Signed-off-by: Rahul K.A <[email protected]>
Signed-off-by: Rahul K.A <[email protected]>
Signed-off-by: Rahul K.A <[email protected]>
Signed-off-by: Rahul K.A <[email protected]>
Signed-off-by: Rahul K.A <[email protected]>
Tagging this as a draft, because Im yet to add in tests/ apply linter. Once done,will remove the draft tag. Maintainers are welcome to start reviewing it in the meantime |
Tagging this as a draft, because Im yet to add in tests/ apply linter. Once done,will remove the draft tag. Maintainers are welcome to start reviewing it in the meantime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncrustify is failing. You might need to run
ament_uncrustify --reformat <filenames or directory>
as_yaml() const; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as_yaml() const; | |
as_yaml() const; | |
explicit ParameterValue(const std::vector<std::string> & string_array_value); | ||
|
||
|
||
/// Generate a parameter value with type PARAMETER_YAML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit ParameterValue(const std::vector<std::string> & string_array_value); | |
/// Generate a parameter value with type PARAMETER_YAML | |
explicit ParameterValue(const std::vector<std::string> & string_array_value); | |
/// Generate a parameter value with type PARAMETER_YAML |
|
||
template<ParameterType type> | ||
constexpr | ||
typename std::enable_if<type == ParameterType::PARAMETER_YAML, const YAML::Node>::type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include <type_traits>
<package format="2"> | ||
<name>rclcpp</name> | ||
<version>30.1.0</version> | ||
<version>30.0.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't change this number manually. Restore
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
#include <string> | ||
#include <utility> | ||
#include <vector> | ||
#include "yaml-cpp/yaml.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move above <rcl_yaml_param_parser/parser.h>
and use <>
} | ||
|
||
|
||
RCLCPP_LOCAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
RCLCPP_LOCAL | |
} | |
RCLCPP_LOCAL |
|
||
RCLCPP_LOCAL | ||
/// Pulled from Question 78243576 from Stack Overflow | ||
void __traverse_node_and_change_value(YAML::Node & root, const std::vector<std::string>& path, rclcpp::ParameterValue value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lines < 100 characters
hi, exposing third party library API (yaml-cpp) as a part of ROS api is not a good idea. |
Hi @asherikov , yaml-cpp is used by ROS2 on all platforms, as per my knowledge, since it's a dependency of rclcpp itself (yaml_cpp_vendor is just a wrapper). In that sense I do not consider it foreign to the ROS ecoyststem |
API dependency has more implications, e.g., a change in yaml-cpp API would imply a change in ROS2 public API affecting all user code. |
Description
Adds additional API that allows the user to access structured YAML parameters as a
YAML::Node
(part of yaml-cpp inrclcpp
. Original GSOC proposal can be found hereEssentially, given a parameter YAML file such as
In the code, the user can declare a structured yaml parameter as
And get access to all the elements under
passenger_size
asThey can then access individual fields using the standard
dict()
syntaxUsers can also now set yaml parameters through the
ros2
CLI. The syntax is very similar to the one already used for setting messages. For example:will change passenger size as
Fixes # (issue)
Is this user-facing behavior change?
Yes, it adds an additional parameter type that they can use. None of the existing parameter types are affected. Support for existing namespaced parameters is not affected. If required users will still be able to access individual namespaced parameters such as
passenger_size.min.x
,passenger_size.max.x
, etc.Did you use Generative AI?
No.
Additional Information
rclpy
PR: [Draft]Add structured parameter support rclpy#1494rcl
PR: [Draft]Add structured parameter support rcl#1254rcl_interfaces
PR: Add structured parameter support rcl_interfaces#183