From 6ea401fd4adf57bec10702e2db3df4a680a96428 Mon Sep 17 00:00:00 2001 From: Paul Gesel Date: Sun, 25 Feb 2024 11:57:41 -0700 Subject: [PATCH] fix string filter for cpp and add new test cases to yaml Signed-off-by: Paul Gesel --- example/src/parameters.yaml | 24 +++++++++++++++++++ .../parameters.yaml | 24 +++++++++++++++++++ .../string_filters_cpp.py | 5 +++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/example/src/parameters.yaml b/example/src/parameters.yaml index 583aecc..77e17cd 100644 --- a/example/src/parameters.yaml +++ b/example/src/parameters.yaml @@ -284,3 +284,27 @@ admittance_controller: one_of<>: [ [ 0, 1, 2, -1 ] ], }, } + angle_wraparound: { + type: bool, + default_value: false, + description: 'For joints that wrap around (without end stop, ie. are continuous), + where the shortest rotation to the target position is the desired motion. + If true, the position error :math:`e = normalize(s_d - s)` is normalized between :math:`-\pi, \pi`. + Otherwise :math:`e = s_d - s` is used, with the desired position :math:`s_d` and the measured + position :math:`s` from the state interface.' + } + open_loop_control: { + type: bool, + default_value: false, + description: "Use controller in open-loop control mode + \n\n + * The controller ignores the states provided by hardware interface but using last commands as states for starting the trajectory interpolation.\n + * It deactivates the feedback control, see the ``gains`` structure. + \n\n + This is useful if hardware states are not following commands, i.e., an offset between those (typical for hydraulic manipulators). + \n\n + If this flag is set, the controller tries to read the values from the command interfaces on activation. + If they have real numeric values, those will be used instead of state interfaces. + Therefore it is important set command interfaces to NaN (i.e., ``std::numeric_limits::quiet_NaN()``) or state values when the hardware is started.\n", + read_only: true, + } diff --git a/example_python/generate_parameter_module_example/parameters.yaml b/example_python/generate_parameter_module_example/parameters.yaml index 7c8d419..e49c6f2 100644 --- a/example_python/generate_parameter_module_example/parameters.yaml +++ b/example_python/generate_parameter_module_example/parameters.yaml @@ -292,3 +292,27 @@ admittance_controller: one_of<>: [ [ 0, 1, 2, -1 ] ], }, } + angle_wraparound: { + type: bool, + default_value: false, + description: 'For joints that wrap around (without end stop, ie. are continuous), + where the shortest rotation to the target position is the desired motion. + If true, the position error :math:`e = normalize(s_d - s)` is normalized between :math:`-\pi, \pi`. + Otherwise :math:`e = s_d - s` is used, with the desired position :math:`s_d` and the measured + position :math:`s` from the state interface.' + } + open_loop_control: { + type: bool, + default_value: false, + description: "Use controller in open-loop control mode + \n\n + * The controller ignores the states provided by hardware interface but using last commands as states for starting the trajectory interpolation.\n + * It deactivates the feedback control, see the ``gains`` structure. + \n\n + This is useful if hardware states are not following commands, i.e., an offset between those (typical for hydraulic manipulators). + \n\n + If this flag is set, the controller tries to read the values from the command interfaces on activation. + If they have real numeric values, those will be used instead of state interfaces. + Therefore it is important set command interfaces to NaN (i.e., ``std::numeric_limits::quiet_NaN()``) or state values when the hardware is started.\n", + read_only: true, + } diff --git a/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py b/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py index 9da13cc..003d8a1 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py +++ b/generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py @@ -10,7 +10,10 @@ def valid_string_cpp(description): str: The filtered string that is a valid C++ string. """ if description: - filtered_description = description.replace('\n', '\\n ') + # remove possible markdown/rst syntax, but add proper indent for cpp-header files. + filtered_description = ( + description.replace('\\', '\\\\').replace('`', '').replace('\n', '\\n ') + ) return f'"{filtered_description}"' else: return '""'