Skip to content

Commit

Permalink
moved all params declarations to src/
Browse files Browse the repository at this point in the history
  • Loading branch information
BOOTCFG committed Dec 18, 2024
1 parent 99c941e commit 309edd7
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 8 deletions.
4 changes: 2 additions & 2 deletions husarion_ugv_battery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ add_executable(
src/battery_publisher/single_battery_publisher.cpp)
ament_target_dependencies(battery_driver_node ${PACKAGE_DEPENDENCIES})

generate_parameter_library(battery_parameters config/battery_parameters.yaml)
generate_parameter_library(battery_parameters src/battery_parameters.yaml)
target_link_libraries(battery_driver_node battery_parameters)

install(TARGETS battery_driver_node DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY config launch DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
Expand Down
15 changes: 15 additions & 0 deletions husarion_ugv_battery/config/battery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**:
battery_driver:
ros__parameters:
adc:
device0: "/sys/bus/iio/devices/iio:device0"
device1: "/sys/bus/iio/devices/iio:device1"
ma_window_len:
charge: 10
temp: 10
ma_window_len:
voltage: 10
current: 10
roboteq:
driver_state_timeout: 0.2
battery_timeout: 1.0
22 changes: 21 additions & 1 deletion husarion_ugv_battery/launch/battery.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import EnvironmentVariable, LaunchConfiguration
from launch.substitutions import (
EnvironmentVariable,
LaunchConfiguration,
PathJoinSubstitution,
)
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():
Expand All @@ -28,17 +33,32 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

battery_config_path = LaunchConfiguration("battery_config_path")
declare_battery_config_path_arg = DeclareLaunchArgument(
"battery_config_path",
default_value=PathJoinSubstitution(
[
FindPackageShare("husarion_ugv_battery"),
"config",
"battery.yaml",
]
),
description="Specify the path to the system monitor configuration file.",
)

battery_driver_node = Node(
package="husarion_ugv_battery",
executable="battery_driver_node",
name="battery_driver",
parameters=[battery_config_path],
namespace=namespace,
remappings=[("/diagnostics", "diagnostics")],
emulate_tty=True,
)

actions = [
declare_namespace_arg,
declare_battery_config_path_arg,
battery_driver_node,
]

Expand Down
2 changes: 1 addition & 1 deletion husarion_ugv_hardware_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endforeach()
include_directories(include)

generate_parameter_library(phidgets_spatial_parameters
config/phidgets_spatial_parameters.yaml)
src/phidgets_spatial_parameters.yaml)

set(ENV{PKG_CONFIG_PATH}
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
Expand Down
4 changes: 2 additions & 2 deletions husarion_ugv_lights/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ament_target_dependencies(
std_srvs)

generate_parameter_library(lights_driver_parameters
config/lights_driver_parameters.yaml)
src/lights_driver_parameters.yaml)
target_link_libraries(lights_driver_node_component lights_driver_parameters)

add_library(
Expand All @@ -63,7 +63,7 @@ ament_target_dependencies(
sensor_msgs)

generate_parameter_library(lights_controller_parameters
config/lights_controller_parameters.yaml)
src/lights_controller_parameters.yaml)
target_link_libraries(lights_controller_node_component yaml-cpp
lights_controller_parameters)

Expand Down
4 changes: 2 additions & 2 deletions husarion_ugv_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ament_target_dependencies(
std_msgs)

generate_parameter_library(safety_manager_parameters
config/safety_manager_parameters.yaml)
src/safety_manager_parameters.yaml)
target_link_libraries(safety_manager_node ${plugin_libs}
safety_manager_parameters)

Expand All @@ -89,7 +89,7 @@ ament_target_dependencies(
std_msgs)

generate_parameter_library(lights_manager_parameters
config/lights_manager_parameters.yaml)
src/lights_manager_parameters.yaml)
target_link_libraries(lights_manager_node ${plugin_libs}
lights_manager_parameters)

Expand Down

0 comments on commit 309edd7

Please sign in to comment.