DevOps Dojo: ROS Node Configuration - ROS Node Parameter Coding Guidelines #3433
kaspermeck-arm
started this conversation in
Design
Replies: 1 comment
-
Add: Launch parameter file
to current proposal. Then it's complete. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Autoware documentation (web)
Autoware documentation (repo)
Note: We will keep the original content here and update at a later point once we've made progress on DevOps Dojo: ROS Node Launch
Find proposed new coding guidelines below.
Parameters
Autoware ROS nodes have declared parameters which values are provided during the node start up in the form of a parameter file. All the expected parameters with corresponding vaules should exist in the parameter file. Depending on the application, the parameter values might need to be modified.
Find more information on parameters from the official ROS documentation:
JSON Schema
JSON Schema is used the validate the parameter file(s) ensuring that is has the correct structure and content. Using JSON Schema for this purpose is considered best practice for cloud-native development. The schema template below shall be used as a starting point when defining the schema for a ROS node.
The schema file path is
INSERT_PATH_TO_PACKAGE/schema/
and the schema file name isINSERT_NODE_NAME.schema.json
. To adapt the template to the ROS node, replace eachINSERT_...
and add all parameters1..N
.See example: Lidar Apollo Segmentation TVM Nodes schema
Attributes
Parameters have several attributes, some are required and some optional. The optional attributes are highly encouraged when applicable, as they provide useful information about a parameter to the user.
Required
Optional
Parameter File
The parameter file is minimal as there is no need to provide the user with additional information, e.g., description or type. This is because the associated JSON Schema provides the additional information. Use the template below as a starting point for a ROS node.
The parameter file path is
INSERT_PATH_TO_PACKAGE/config/
and parameter file name isINSERT_NODE_NAME.param.yaml
. To adapt the template to the ROS node, replace eachINSERT_...
and add all parameters1..N
.See example: Lidar Apollo Segmentation TVM Nodes parameter file
Note:
/**
is used instead of the explicit node namespace, this allows the parameter file to be passed to a ROS node which has been remapped.Launch parameter file
(Original content, will need updating)
behavior_path_planner
stored underautoware_launch
autoware_launch
.Declare Parameter Function
It is the declare_parameter(...) function which sets the parameter values during a node startup.
As there is no default_value provided, the function throws an exception if a parameter were to be missing in the provided
*.param.yaml
file. Find the types in the table below.PARAMETER_BOOL
bool
PARAMETER_INTEGER
int64_t
PARAMETER_DOUBLE
double
PARAMETER_STRING
std::string
PARAMETER_BYTE_ARRAY
std::vector<uint8_t>
PARAMETER_BOOL_ARRAY
std::vector<bool>
PARAMETER_INTEGER_ARRAY
std::vector<int64_t>
PARAMETER_DOUBLE_ARRAY
std::vector<double>
PARAMETER_STRING_ARRAY
std::vector<std::string>
The table has been derived from Parameter Type and Parameter Value.
See example: Lidar Apollo Segmentation TVM Nodes declare function
Tips and Tricks
Using well established standards enables the use of conventional tooling. Below is an example of how to link a schema to the parameter file(s) using VS Code. This enables convenient features such as auto-complete and parameter bound validation.
In the root directory of where the project is hosted, create a
.vscode
folder with two files;extensions.json
containingand
settings.json
containingThe RedHat YAML extension enables validation of YAML files using JSON Schema and the
"yaml.schemas"
setting associates the*.schema.json
file with all*.param.yaml
files in theconfig/
folder.Edit: added link for Lidar Apollo Segmentation TVM Node schema, parameter and the declare function
Edit2: added content from Launch parameter file
Beta Was this translation helpful? Give feedback.
All reactions