From d6e172809cbdd09709280b5161968f95c1fa3a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Mon, 6 Nov 2023 12:31:21 +0000 Subject: [PATCH] Move default firmware params to leo_fw --- leo_bringup/launch/leo_bringup.launch.xml | 16 +++++++--------- .../data/default_firmware_params.yaml | 0 leo_fw/leo_fw/nodes/parameter_bridge.py | 12 +++++++++++- 3 files changed, 18 insertions(+), 10 deletions(-) rename leo_bringup/config/firmware.yaml => leo_fw/data/default_firmware_params.yaml (100%) diff --git a/leo_bringup/launch/leo_bringup.launch.xml b/leo_bringup/launch/leo_bringup.launch.xml index f88d725..3d45b90 100644 --- a/leo_bringup/launch/leo_bringup.launch.xml +++ b/leo_bringup/launch/leo_bringup.launch.xml @@ -10,13 +10,13 @@ description="Flag specifying wheel types of the robot for visualization purposes" /> - + description="Absolute path to the yaml file with firmware parameters to be overrided" /> - + + + + + - - - - - \ No newline at end of file diff --git a/leo_bringup/config/firmware.yaml b/leo_fw/data/default_firmware_params.yaml similarity index 100% rename from leo_bringup/config/firmware.yaml rename to leo_fw/data/default_firmware_params.yaml diff --git a/leo_fw/leo_fw/nodes/parameter_bridge.py b/leo_fw/leo_fw/nodes/parameter_bridge.py index 611a373..5ed2b28 100644 --- a/leo_fw/leo_fw/nodes/parameter_bridge.py +++ b/leo_fw/leo_fw/nodes/parameter_bridge.py @@ -18,8 +18,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +from os import path +from typing import Optional + import yaml # type: ignore +from ament_index_python import get_package_share_directory + from rcl_interfaces.msg import Parameter as ParameterMsg, SetParametersResult from rcl_interfaces.srv import SetParameters @@ -54,7 +59,12 @@ def __init__(self, executor: MultiThreadedExecutor) -> None: super().__init__("firmware_parameter_bridge") self.executor = executor - self.declare_parameter("default_params_file_path", "") + leo_fw_share = get_package_share_directory("leo_fw") + + self.declare_parameter( + "default_params_file_path", + path.join(leo_fw_share, "data", "default_firmware_params.yaml"), + ) self.declare_parameter("override_params_file_path", "") self.default_param_file: str = (