From d971c6c7ed3c811ba36dfaff01a498980c27b349 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 17:15:02 +0900 Subject: [PATCH 01/21] Add log_level --- device/joystick/joystick/joystick.py | 6 ++- device/joystick/launch/joystick_launch.py | 56 +++++++++++++++++++---- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/device/joystick/joystick/joystick.py b/device/joystick/joystick/joystick.py index c187124..c900626 100644 --- a/device/joystick/joystick/joystick.py +++ b/device/joystick/joystick/joystick.py @@ -12,8 +12,10 @@ def __init__(self): super().__init__("joystick") self._timer = self.create_timer(0.01, self._timer_callback) self._joy_publisher = self.create_publisher(Joy, "joystick", 10) - # TODO: ここparameterで変えられるようにしたい - self._joystick = pygame.joystick.Joystick(0) + # Doing: ここparameterで変えられるようにしたい + joystick_id = self.declare_parameter("joystick_id", 0).get_parameter_value().integer_value + self._joystick = pygame.joystick.Joystick(joystick_id) + self._joystick.init() # logging name = self._joystick.get_name() self.get_logger().info(f"Using controller: {name}") diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index 5850e2a..245f1a6 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -1,15 +1,51 @@ +from typing import Any + from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.conditions import IfCondition, UnlessCondition +from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node -def generate_launch_description(): - return LaunchDescription( - [ - Node( - package="joystick", - executable="joystick", - namespace="device", - remappings=[("/device/joystick", "/packet/joystick")], - ), - ], +def joystick_node(**kwargs: Any) -> Node: + kwargs["package"] = "joystick" + kwargs["executable"] = "joystick" + kwargs["namespace"] = "device" + return Node(**kwargs) + +def generate_launch_description() -> LaunchDescription: + index_arg = DeclareLaunchArgument("index",default_value="-1") + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug","info","warn","error","fatal"], + ) + joystick_id_arg = DeclareLaunchArgument( + "joystick_id", + default_value="0", ) + index = LaunchConfiguration("index") + log_level = LaunchConfiguration("log_level") + + index_specified = PythonExpression([index,">= 0"]) + + indexed_joystick = joystick_node( + name=["joystick_",index], + remappings=[("/device/joystick","/packet/joystick")], + ros_arguments=["--log-level",log_level], + condition=IfCondition(index_specified), + ) + + unindexed_joystick = joystick_node( + remappings=[("/device/joystick","/packet/joystick")], + ros_arguments=["--log-level",log_level], + condition=UnlessCondition(index_specified), + ) + + return LaunchDescription([ + index_arg, + log_level_arg, + joystick_id_arg, + indexed_joystick, + unindexed_joystick + ]) \ No newline at end of file From 5651e9034ea7a24a4976e268aa92cbcd973c2b8c Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 17:31:41 +0900 Subject: [PATCH 02/21] fix --- device/joystick/joystick/joystick.py | 3 ++- device/joystick/launch/joystick_launch.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/device/joystick/joystick/joystick.py b/device/joystick/joystick/joystick.py index c900626..8fc9a56 100644 --- a/device/joystick/joystick/joystick.py +++ b/device/joystick/joystick/joystick.py @@ -13,7 +13,8 @@ def __init__(self): self._timer = self.create_timer(0.01, self._timer_callback) self._joy_publisher = self.create_publisher(Joy, "joystick", 10) # Doing: ここparameterで変えられるようにしたい - joystick_id = self.declare_parameter("joystick_id", 0).get_parameter_value().integer_value + param = self.declare_parameter("joystick_id", 0) + joystick_id = param.get_parameter_value().integer_value self._joystick = pygame.joystick.Joystick(joystick_id) self._joystick.init() # logging diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index 245f1a6..6d96220 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -48,4 +48,4 @@ def generate_launch_description() -> LaunchDescription: joystick_id_arg, indexed_joystick, unindexed_joystick - ]) \ No newline at end of file + ]) From e93ec93c8373e169c35c9a1e43b07f0fbadb0d87 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 17:37:27 +0900 Subject: [PATCH 03/21] deleate_index,joystick_id --- device/joystick/joystick/joystick.py | 7 ++----- device/joystick/launch/joystick_launch.py | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/device/joystick/joystick/joystick.py b/device/joystick/joystick/joystick.py index 8fc9a56..743f774 100644 --- a/device/joystick/joystick/joystick.py +++ b/device/joystick/joystick/joystick.py @@ -12,11 +12,8 @@ def __init__(self): super().__init__("joystick") self._timer = self.create_timer(0.01, self._timer_callback) self._joy_publisher = self.create_publisher(Joy, "joystick", 10) - # Doing: ここparameterで変えられるようにしたい - param = self.declare_parameter("joystick_id", 0) - joystick_id = param.get_parameter_value().integer_value - self._joystick = pygame.joystick.Joystick(joystick_id) - self._joystick.init() + # TODO : ここparameterで変えられるようにしたい + self._joystick = pygame.joystick.Joystick(0) # logging name = self._joystick.get_name() self.get_logger().info(f"Using controller: {name}") diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index 6d96220..d14c803 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -14,7 +14,6 @@ def joystick_node(**kwargs: Any) -> Node: return Node(**kwargs) def generate_launch_description() -> LaunchDescription: - index_arg = DeclareLaunchArgument("index",default_value="-1") log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", @@ -43,7 +42,6 @@ def generate_launch_description() -> LaunchDescription: ) return LaunchDescription([ - index_arg, log_level_arg, joystick_id_arg, indexed_joystick, From fbed0eda3a23e3f717af01e449a061acd1e63745 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:37:18 +0900 Subject: [PATCH 04/21] joystick --- device/joystick/launch/joystick_launch.py | 31 ++++++----------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index d14c803..ec425ef 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -2,8 +2,7 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch.conditions import IfCondition, UnlessCondition -from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -19,31 +18,17 @@ def generate_launch_description() -> LaunchDescription: default_value="info", choices=["debug","info","warn","error","fatal"], ) - joystick_id_arg = DeclareLaunchArgument( - "joystick_id", - default_value="0", - ) - index = LaunchConfiguration("index") log_level = LaunchConfiguration("log_level") - index_specified = PythonExpression([index,">= 0"]) - - indexed_joystick = joystick_node( - name=["joystick_",index], - remappings=[("/device/joystick","/packet/joystick")], - ros_arguments=["--log-level",log_level], - condition=IfCondition(index_specified), - ) - - unindexed_joystick = joystick_node( - remappings=[("/device/joystick","/packet/joystick")], - ros_arguments=["--log-level",log_level], - condition=UnlessCondition(index_specified), + joystick = Node( + package="joystick", + executable="joystick", + namespace="devide", + remappings=[("/device/joystick", "/packet/joystick")], + ros_arguments=["--log-level", log_level], ) return LaunchDescription([ log_level_arg, - joystick_id_arg, - indexed_joystick, - unindexed_joystick + joystick ]) From 2cd147789a529e97d6d62edb50afd49dedf62656 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:37:29 +0900 Subject: [PATCH 05/21] channel --- device/nucleo_communicate/launch/channel_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/nucleo_communicate/launch/channel_launch.py b/device/nucleo_communicate/launch/channel_launch.py index 64b0f54..82f8441 100644 --- a/device/nucleo_communicate/launch/channel_launch.py +++ b/device/nucleo_communicate/launch/channel_launch.py @@ -1,8 +1,16 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description(): + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug","info","warn","error","fatal"], + ) + log_level = LaunchConfiguration("log_level") channel = Node( package="nucleo_communicate", executable="nucleo-channel", @@ -15,5 +23,6 @@ def generate_launch_description(): ("/device/power", "/packet/order/power"), ("/device/quit", "/packet/order/quit"), ], + ros_arguments=["--log-level",log_level], ) - return LaunchDescription([channel]) + return LaunchDescription([log_level_arg,channel]) From 0217a4a10f8a82660bf9f3ce01677a0123cda859 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:37:41 +0900 Subject: [PATCH 06/21] channel_launch --- device/nucleo_communicate_py/launch/channel_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/nucleo_communicate_py/launch/channel_launch.py b/device/nucleo_communicate_py/launch/channel_launch.py index d61926e..e48a510 100644 --- a/device/nucleo_communicate_py/launch/channel_launch.py +++ b/device/nucleo_communicate_py/launch/channel_launch.py @@ -1,8 +1,16 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") main = Node( package="nucleo_communicate_py", executable="channel", @@ -15,5 +23,6 @@ def generate_launch_description() -> LaunchDescription: ("/device/quit", "/packet/order/quit"), ("/device/order/power", "/packet/order/power"), ], + ros_arguments=["--log-level",log_level] ) - return LaunchDescription([main]) + return LaunchDescription([log_level_arg,main]) From 087cc59c34219fcf9f3d09cea37797ce97bc79ff Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:37:48 +0900 Subject: [PATCH 07/21] receiver --- .../nucleo_communicate_py/launch/receiver_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/nucleo_communicate_py/launch/receiver_launch.py b/device/nucleo_communicate_py/launch/receiver_launch.py index 5b5952f..95f5759 100644 --- a/device/nucleo_communicate_py/launch/receiver_launch.py +++ b/device/nucleo_communicate_py/launch/receiver_launch.py @@ -1,8 +1,16 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") receiver = Node( package="nucleo_communicate_py", executable="receiver", @@ -13,5 +21,6 @@ def generate_launch_description() -> LaunchDescription: ("/device/current", "/packet/sensor/current"), ("/device/voltage", "/packet/sensor/voltage"), ], + ros_arguments=["--log-level",log_level], ) - return LaunchDescription([receiver]) + return LaunchDescription([log_level_arg,receiver]) From 2e8fcf679c332af12253bc9e6100d2207ba1c9d2 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:37:55 +0900 Subject: [PATCH 08/21] sender --- device/nucleo_communicate_py/launch/sender_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/nucleo_communicate_py/launch/sender_launch.py b/device/nucleo_communicate_py/launch/sender_launch.py index 901f40f..1f1d27d 100644 --- a/device/nucleo_communicate_py/launch/sender_launch.py +++ b/device/nucleo_communicate_py/launch/sender_launch.py @@ -1,8 +1,16 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") sender = Node( package="nucleo_communicate_py", executable="sender", @@ -11,5 +19,6 @@ def generate_launch_description() -> LaunchDescription: ("/device/quit", "/packet/order/quit"), ("/device/order/power", "/packet/order/power"), ], + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([sender]) + return LaunchDescription([log_level_arg,sender]) From 4a42e2d228f2084234bba2c0772944ea05f255af Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:01 +0900 Subject: [PATCH 09/21] all_launch --- device/pi_i2c/launch/all_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/pi_i2c/launch/all_launch.py b/device/pi_i2c/launch/all_launch.py index 5424f5f..87a55e8 100644 --- a/device/pi_i2c/launch/all_launch.py +++ b/device/pi_i2c/launch/all_launch.py @@ -1,12 +1,21 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") all_exec = Node( package="pi_i2c", executable="all", namespace="device", remappings=[("/device/imu", "/packet/sensors/imu")], + ros_arguments=["--log-level",log_level] ) - return LaunchDescription([all_exec]) + return LaunchDescription([log_level_arg,all_exec]) From 1f1dc31ba0951b8b6d278d2b7e906fcefae1396e Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:08 +0900 Subject: [PATCH 10/21] depth --- device/pi_i2c/launch/depth_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/pi_i2c/launch/depth_launch.py b/device/pi_i2c/launch/depth_launch.py index f37f542..aeb3339 100644 --- a/device/pi_i2c/launch/depth_launch.py +++ b/device/pi_i2c/launch/depth_launch.py @@ -1,11 +1,20 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") depth = Node( package="pi_i2c", executable="depth", namespace="device", + ros_arguments=["--log-level",log_level], ) - return LaunchDescription([depth]) + return LaunchDescription([log_level_arg,depth]) From 4222348cf49da087b96acc710aef7bfdee27fe62 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:15 +0900 Subject: [PATCH 11/21] imu --- device/pi_i2c/launch/imu_launch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/pi_i2c/launch/imu_launch.py b/device/pi_i2c/launch/imu_launch.py index 95564bc..5336e49 100644 --- a/device/pi_i2c/launch/imu_launch.py +++ b/device/pi_i2c/launch/imu_launch.py @@ -1,12 +1,21 @@ from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + ) + log_level = LaunchConfiguration("log_level") imu = Node( package="pi_i2c", executable="imu", namespace="device", remappings=[("/device/imu", "/packet/sensors/imu")], + ros_arguments=["--log-level",log_level], ) - return LaunchDescription([imu]) + return LaunchDescription([log_level_arg,imu]) From e22fc001271e7db8876ec263920c91e6bcb1be0c Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:27 +0900 Subject: [PATCH 12/21] double_camera --- ul/launch/double_camera.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ul/launch/double_camera.py b/ul/launch/double_camera.py index fcfde1c..05ccd90 100644 --- a/ul/launch/double_camera.py +++ b/ul/launch/double_camera.py @@ -1,18 +1,26 @@ from launch import LaunchDescription -from launch.actions import GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import PathJoinSubstitution +from launch.substitutions import LaunchConfiguration,PathJoinSubstitution from launch_ros.substitutions import FindPackageShare def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes" + ) + log_level = LaunchConfiguration("log_level") + camera0 = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "0")], + launch_arguments=[("index", "0"),("log_level", log_level)], ) camera1 = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -20,7 +28,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "1")], + launch_arguments=[("index", "1"),("log_level", log_level)], ) cameras = GroupAction([camera0, camera1], forwarding=False) return LaunchDescription([cameras]) From d070eb28f2bc1ea6dc6d58adbd7dad88ccf528eb Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:35 +0900 Subject: [PATCH 13/21] double_imshow --- ul/launch/double_imshow.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ul/launch/double_imshow.py b/ul/launch/double_imshow.py index 18d70ce..10d772e 100644 --- a/ul/launch/double_imshow.py +++ b/ul/launch/double_imshow.py @@ -1,18 +1,26 @@ from launch import LaunchDescription -from launch.actions import GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import PathJoinSubstitution +from launch.substitutions import LaunchConfiguration,PathJoinSubstitution from launch_ros.substitutions import FindPackageShare def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes" + ) + log_level = LaunchConfiguration("log_level") + imshow0 = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("imshow"), "launch", "imshow_launch.py"] ) ), - launch_arguments=[("index", "0")], + launch_arguments=[("index", "0"), ("log_level", log_level)], ) imshow1 = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -20,7 +28,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("imshow"), "launch", "imshow_launch.py"] ) ), - launch_arguments=[("index", "1")], + launch_arguments=[("index", "1"), ("log_level", log_level)], ) imshows = GroupAction([imshow0, imshow1], forwarding=False) return LaunchDescription([imshows]) From 1c19419c8d4b106fabbab437f9965446593d0266 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:43 +0900 Subject: [PATCH 14/21] double_led --- ul/launch/double_led.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ul/launch/double_led.py b/ul/launch/double_led.py index 94cd291..fff791d 100644 --- a/ul/launch/double_led.py +++ b/ul/launch/double_led.py @@ -1,22 +1,29 @@ from launch import LaunchDescription -from launch.actions import GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import PathJoinSubstitution +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes" + ) + log_level = LaunchConfiguration("log_level") led_right = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "right")], + launch_arguments=[("variant", "right"),("log_level",log_level)], ) led_left = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "left")], + launch_arguments=[("variant", "left"),("log_level",log_level)], ) leds = GroupAction([led_left, led_right], forwarding=False) - return LaunchDescription([leds]) + return LaunchDescription([log_level_arg,leds]) From bcdbd77ebda1e231584f0a14673b31f4c2be5597 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:38:52 +0900 Subject: [PATCH 15/21] nucleo_channel --- ul/launch/nucleo_channel.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ul/launch/nucleo_channel.py b/ul/launch/nucleo_channel.py index 6116074..2b0a282 100644 --- a/ul/launch/nucleo_channel.py +++ b/ul/launch/nucleo_channel.py @@ -1,16 +1,25 @@ from launch import LaunchDescription -from launch.actions import GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import PathJoinSubstitution +from launch.substitutions import LaunchConfiguration,PathJoinSubstitution from launch_ros.substitutions import FindPackageShare def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes" + ) + log_level = LaunchConfiguration("log_level") + channel = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("nucleo_communicate"), "launch", "channel_launch.py"] ) - ) + ), + launch_arguments=[("log_level", log_level)], ) - return LaunchDescription([GroupAction([channel], forwarding=False)]) + return LaunchDescription([log_level_arg,GroupAction([channel], forwarding=False)]) From 422372cf96bb2671568fa88ebb925202f61d72e7 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:39:01 +0900 Subject: [PATCH 16/21] pi_devices --- ul/launch/pi_devices.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ul/launch/pi_devices.py b/ul/launch/pi_devices.py index 251cb81..b2d4b60 100644 --- a/ul/launch/pi_devices.py +++ b/ul/launch/pi_devices.py @@ -17,6 +17,13 @@ def generate_launch_description() -> LaunchDescription: # args + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes" + ) + log_level = LaunchConfiguration("log_level") use_nucleo_arg = DeclareLaunchArgument( "use_nucleo", default_value="true", choices=["true", "false"] ) @@ -50,6 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("ul"), "launch", "nucleo_channel.py"]) ), + launch_arguments=[("log_level", log_level)], condition=IfCondition(use_nucleo), ) single_camera = IncludeLaunchDescription( @@ -58,6 +66,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), + launch_arguments=[("log_level", log_level)], condition=IfCondition(use_single_camera), ) double_camera = IncludeLaunchDescription( @@ -66,6 +75,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), + launch_arguments=[("log_level", log_level)], condition=IfCondition(use_double_camera), ) led = GroupAction( @@ -76,6 +86,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("ul"), "launch", "double_led.py"] ) ), + launch_arguments=[("log_level", log_level)], ), ExecuteProcess( cmd=[ @@ -106,6 +117,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_i2c"), "launch", "imu_launch.py"]) ), + launch_arguments=[("log_level", log_level)], condition=IfCondition(use_imu), ) nodes = GroupAction( From 25185d6e1f7a08495dcad9ee35b4e8d831db783b Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 10 Aug 2024 23:56:52 +0900 Subject: [PATCH 17/21] fix --- ul/launch/double_camera.py | 8 +++----- ul/launch/double_imshow.py | 7 +++---- ul/launch/nucleo_channel.py | 6 ++---- ul/launch/pi_devices.py | 3 ++- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ul/launch/double_camera.py b/ul/launch/double_camera.py index 05ccd90..bb3f022 100644 --- a/ul/launch/double_camera.py +++ b/ul/launch/double_camera.py @@ -1,10 +1,9 @@ from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration,PathJoinSubstitution +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare - def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", @@ -13,7 +12,6 @@ def generate_launch_description() -> LaunchDescription: description="Logging level for the nodes" ) log_level = LaunchConfiguration("log_level") - camera0 = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( @@ -31,4 +29,4 @@ def generate_launch_description() -> LaunchDescription: launch_arguments=[("index", "1"),("log_level", log_level)], ) cameras = GroupAction([camera0, camera1], forwarding=False) - return LaunchDescription([cameras]) + return LaunchDescription([log_level_arg,cameras]) diff --git a/ul/launch/double_imshow.py b/ul/launch/double_imshow.py index 10d772e..cbb95e4 100644 --- a/ul/launch/double_imshow.py +++ b/ul/launch/double_imshow.py @@ -1,10 +1,9 @@ from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration,PathJoinSubstitution +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare - def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", @@ -31,4 +30,4 @@ def generate_launch_description() -> LaunchDescription: launch_arguments=[("index", "1"), ("log_level", log_level)], ) imshows = GroupAction([imshow0, imshow1], forwarding=False) - return LaunchDescription([imshows]) + return LaunchDescription([log_level_arg,imshows]) diff --git a/ul/launch/nucleo_channel.py b/ul/launch/nucleo_channel.py index 2b0a282..4daecf5 100644 --- a/ul/launch/nucleo_channel.py +++ b/ul/launch/nucleo_channel.py @@ -1,10 +1,9 @@ from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument,GroupAction, IncludeLaunchDescription +from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration,PathJoinSubstitution +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare - def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", @@ -13,7 +12,6 @@ def generate_launch_description() -> LaunchDescription: description="Logging level for the nodes" ) log_level = LaunchConfiguration("log_level") - channel = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/ul/launch/pi_devices.py b/ul/launch/pi_devices.py index b2d4b60..98560e0 100644 --- a/ul/launch/pi_devices.py +++ b/ul/launch/pi_devices.py @@ -43,7 +43,8 @@ def generate_launch_description() -> LaunchDescription: choices=["true", "false"], ) args = GroupAction( - [use_nucleo_arg, camera_variant_arg, use_led_arg, use_imu_arg], scoped=False + [log_level_arg,use_nucleo_arg, camera_variant_arg, use_led_arg, use_imu_arg], + scoped=False ) # substitutions use_nucleo = LaunchConfiguration("use_nucleo") From c7f9f0deb6e2d4e6ac210b0202a01301caa4e925 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sun, 11 Aug 2024 00:04:10 +0900 Subject: [PATCH 18/21] fix --- ul/launch/double_camera.py | 1 + ul/launch/double_imshow.py | 1 + ul/launch/nucleo_channel.py | 1 + 3 files changed, 3 insertions(+) diff --git a/ul/launch/double_camera.py b/ul/launch/double_camera.py index bb3f022..d2f3840 100644 --- a/ul/launch/double_camera.py +++ b/ul/launch/double_camera.py @@ -4,6 +4,7 @@ from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare + def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", diff --git a/ul/launch/double_imshow.py b/ul/launch/double_imshow.py index cbb95e4..590c94c 100644 --- a/ul/launch/double_imshow.py +++ b/ul/launch/double_imshow.py @@ -4,6 +4,7 @@ from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare + def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", diff --git a/ul/launch/nucleo_channel.py b/ul/launch/nucleo_channel.py index 4daecf5..00dcb5d 100644 --- a/ul/launch/nucleo_channel.py +++ b/ul/launch/nucleo_channel.py @@ -4,6 +4,7 @@ from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare + def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", From 7f936ac8a3048e4a82c6a443c0cd034002ca7e06 Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sun, 11 Aug 2024 17:10:19 +0900 Subject: [PATCH 19/21] ruff check --- device/joystick/launch/joystick_launch.py | 10 ++++------ device/nucleo_communicate/launch/channel_launch.py | 6 +++--- device/nucleo_communicate_py/launch/channel_launch.py | 4 ++-- device/nucleo_communicate_py/launch/receiver_launch.py | 4 ++-- device/nucleo_communicate_py/launch/sender_launch.py | 2 +- device/pi_i2c/launch/all_launch.py | 4 ++-- device/pi_i2c/launch/depth_launch.py | 4 ++-- device/pi_i2c/launch/imu_launch.py | 4 ++-- device/pi_led/launch/led_launch.py | 4 +++- ul/launch/double_camera.py | 8 ++++---- ul/launch/double_imshow.py | 4 ++-- ul/launch/double_led.py | 8 ++++---- ul/launch/nucleo_channel.py | 4 ++-- ul/launch/pi_devices.py | 6 +++--- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index ec425ef..42c9d6a 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -12,23 +12,21 @@ def joystick_node(**kwargs: Any) -> Node: kwargs["namespace"] = "device" return Node(**kwargs) + def generate_launch_description() -> LaunchDescription: log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - choices=["debug","info","warn","error","fatal"], + choices=["debug", "info", "warn", "error", "fatal"], ) log_level = LaunchConfiguration("log_level") joystick = Node( package="joystick", executable="joystick", - namespace="devide", + namespace="device", remappings=[("/device/joystick", "/packet/joystick")], ros_arguments=["--log-level", log_level], ) - return LaunchDescription([ - log_level_arg, - joystick - ]) + return LaunchDescription([log_level_arg, joystick]) diff --git a/device/nucleo_communicate/launch/channel_launch.py b/device/nucleo_communicate/launch/channel_launch.py index 82f8441..08f1aa7 100644 --- a/device/nucleo_communicate/launch/channel_launch.py +++ b/device/nucleo_communicate/launch/channel_launch.py @@ -8,7 +8,7 @@ def generate_launch_description(): log_level_arg = DeclareLaunchArgument( "log_level", default_value="info", - choices=["debug","info","warn","error","fatal"], + choices=["debug", "info", "warn", "error", "fatal"], ) log_level = LaunchConfiguration("log_level") channel = Node( @@ -23,6 +23,6 @@ def generate_launch_description(): ("/device/power", "/packet/order/power"), ("/device/quit", "/packet/order/quit"), ], - ros_arguments=["--log-level",log_level], + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,channel]) + return LaunchDescription([log_level_arg, channel]) diff --git a/device/nucleo_communicate_py/launch/channel_launch.py b/device/nucleo_communicate_py/launch/channel_launch.py index e48a510..6e9e38e 100644 --- a/device/nucleo_communicate_py/launch/channel_launch.py +++ b/device/nucleo_communicate_py/launch/channel_launch.py @@ -23,6 +23,6 @@ def generate_launch_description() -> LaunchDescription: ("/device/quit", "/packet/order/quit"), ("/device/order/power", "/packet/order/power"), ], - ros_arguments=["--log-level",log_level] + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,main]) + return LaunchDescription([log_level_arg, main]) diff --git a/device/nucleo_communicate_py/launch/receiver_launch.py b/device/nucleo_communicate_py/launch/receiver_launch.py index 95f5759..9b437cd 100644 --- a/device/nucleo_communicate_py/launch/receiver_launch.py +++ b/device/nucleo_communicate_py/launch/receiver_launch.py @@ -21,6 +21,6 @@ def generate_launch_description() -> LaunchDescription: ("/device/current", "/packet/sensor/current"), ("/device/voltage", "/packet/sensor/voltage"), ], - ros_arguments=["--log-level",log_level], + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,receiver]) + return LaunchDescription([log_level_arg, receiver]) diff --git a/device/nucleo_communicate_py/launch/sender_launch.py b/device/nucleo_communicate_py/launch/sender_launch.py index 1f1d27d..2aeb999 100644 --- a/device/nucleo_communicate_py/launch/sender_launch.py +++ b/device/nucleo_communicate_py/launch/sender_launch.py @@ -21,4 +21,4 @@ def generate_launch_description() -> LaunchDescription: ], ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,sender]) + return LaunchDescription([log_level_arg, sender]) diff --git a/device/pi_i2c/launch/all_launch.py b/device/pi_i2c/launch/all_launch.py index 87a55e8..717b0e0 100644 --- a/device/pi_i2c/launch/all_launch.py +++ b/device/pi_i2c/launch/all_launch.py @@ -16,6 +16,6 @@ def generate_launch_description() -> LaunchDescription: executable="all", namespace="device", remappings=[("/device/imu", "/packet/sensors/imu")], - ros_arguments=["--log-level",log_level] + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,all_exec]) + return LaunchDescription([log_level_arg, all_exec]) diff --git a/device/pi_i2c/launch/depth_launch.py b/device/pi_i2c/launch/depth_launch.py index aeb3339..b234345 100644 --- a/device/pi_i2c/launch/depth_launch.py +++ b/device/pi_i2c/launch/depth_launch.py @@ -15,6 +15,6 @@ def generate_launch_description() -> LaunchDescription: package="pi_i2c", executable="depth", namespace="device", - ros_arguments=["--log-level",log_level], + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,depth]) + return LaunchDescription([log_level_arg, depth]) diff --git a/device/pi_i2c/launch/imu_launch.py b/device/pi_i2c/launch/imu_launch.py index 5336e49..7a84010 100644 --- a/device/pi_i2c/launch/imu_launch.py +++ b/device/pi_i2c/launch/imu_launch.py @@ -16,6 +16,6 @@ def generate_launch_description() -> LaunchDescription: executable="imu", namespace="device", remappings=[("/device/imu", "/packet/sensors/imu")], - ros_arguments=["--log-level",log_level], + ros_arguments=["--log-level", log_level], ) - return LaunchDescription([log_level_arg,imu]) + return LaunchDescription([log_level_arg, imu]) diff --git a/device/pi_led/launch/led_launch.py b/device/pi_led/launch/led_launch.py index e812f37..3a15820 100644 --- a/device/pi_led/launch/led_launch.py +++ b/device/pi_led/launch/led_launch.py @@ -22,7 +22,9 @@ def led_node(**kwargs: Any) -> Node: def generate_launch_description() -> LaunchDescription: # arguments variant_arg = DeclareLaunchArgument( - "variant", default_value="default", choices=["default", "right", "left", "custom"] + "variant", + default_value="default", + choices=["default", "right", "left", "custom"], ) param_file_arg = DeclareLaunchArgument("param_file", default_value="") # substitutions diff --git a/ul/launch/double_camera.py b/ul/launch/double_camera.py index d2f3840..fe492d1 100644 --- a/ul/launch/double_camera.py +++ b/ul/launch/double_camera.py @@ -10,7 +10,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], - description="Logging level for the nodes" + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") camera0 = IncludeLaunchDescription( @@ -19,7 +19,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "0"),("log_level", log_level)], + launch_arguments=[("index", "0"), ("log_level", log_level)], ) camera1 = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -27,7 +27,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "1"),("log_level", log_level)], + launch_arguments=[("index", "1"), ("log_level", log_level)], ) cameras = GroupAction([camera0, camera1], forwarding=False) - return LaunchDescription([log_level_arg,cameras]) + return LaunchDescription([log_level_arg, cameras]) diff --git a/ul/launch/double_imshow.py b/ul/launch/double_imshow.py index 590c94c..fd71844 100644 --- a/ul/launch/double_imshow.py +++ b/ul/launch/double_imshow.py @@ -10,7 +10,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], - description="Logging level for the nodes" + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") @@ -31,4 +31,4 @@ def generate_launch_description() -> LaunchDescription: launch_arguments=[("index", "1"), ("log_level", log_level)], ) imshows = GroupAction([imshow0, imshow1], forwarding=False) - return LaunchDescription([log_level_arg,imshows]) + return LaunchDescription([log_level_arg, imshows]) diff --git a/ul/launch/double_led.py b/ul/launch/double_led.py index fff791d..729ca49 100644 --- a/ul/launch/double_led.py +++ b/ul/launch/double_led.py @@ -10,20 +10,20 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], - description="Logging level for the nodes" + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") led_right = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "right"),("log_level",log_level)], + launch_arguments=[("variant", "right"), ("log_level", log_level)], ) led_left = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "left"),("log_level",log_level)], + launch_arguments=[("variant", "left"), ("log_level", log_level)], ) leds = GroupAction([led_left, led_right], forwarding=False) - return LaunchDescription([log_level_arg,leds]) + return LaunchDescription([log_level_arg, leds]) diff --git a/ul/launch/nucleo_channel.py b/ul/launch/nucleo_channel.py index 00dcb5d..8397128 100644 --- a/ul/launch/nucleo_channel.py +++ b/ul/launch/nucleo_channel.py @@ -10,7 +10,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], - description="Logging level for the nodes" + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") channel = IncludeLaunchDescription( @@ -21,4 +21,4 @@ def generate_launch_description() -> LaunchDescription: ), launch_arguments=[("log_level", log_level)], ) - return LaunchDescription([log_level_arg,GroupAction([channel], forwarding=False)]) + return LaunchDescription([log_level_arg, GroupAction([channel], forwarding=False)]) diff --git a/ul/launch/pi_devices.py b/ul/launch/pi_devices.py index 98560e0..3d721b6 100644 --- a/ul/launch/pi_devices.py +++ b/ul/launch/pi_devices.py @@ -21,7 +21,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], - description="Logging level for the nodes" + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") use_nucleo_arg = DeclareLaunchArgument( @@ -43,8 +43,8 @@ def generate_launch_description() -> LaunchDescription: choices=["true", "false"], ) args = GroupAction( - [log_level_arg,use_nucleo_arg, camera_variant_arg, use_led_arg, use_imu_arg], - scoped=False + [log_level_arg, use_nucleo_arg, camera_variant_arg, use_led_arg, use_imu_arg], + scoped=False, ) # substitutions use_nucleo = LaunchConfiguration("use_nucleo") From 75d6769ef9951f962d491a912962caa612966beb Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Wed, 14 Aug 2024 18:05:28 +0900 Subject: [PATCH 20/21] fix --- app/imshow/launch/imshow_launch.py | 1 + app/power_map/launch/power_map_launch.py | 1 + app/simple_joy_app/launch/app_launch.py | 1 + .../camera_reader/launch/camera_reader_launch.py | 11 ++++++++++- device/joystick/launch/joystick_launch.py | 1 + device/nucleo_communicate/launch/channel_launch.py | 1 + .../nucleo_communicate_py/launch/channel_launch.py | 1 + .../launch/receiver_launch.py | 1 + .../nucleo_communicate_py/launch/sender_launch.py | 1 + device/pi_i2c/launch/all_launch.py | 1 + device/pi_i2c/launch/depth_launch.py | 1 + device/pi_i2c/launch/imu_launch.py | 1 + device/pi_led/launch/led_launch.py | 13 ++++++++++++- ul/launch/simple_joy_app_pc.py | 14 +++++++++++--- 14 files changed, 44 insertions(+), 5 deletions(-) diff --git a/app/imshow/launch/imshow_launch.py b/app/imshow/launch/imshow_launch.py index 61f97d9..701dab8 100644 --- a/app/imshow/launch/imshow_launch.py +++ b/app/imshow/launch/imshow_launch.py @@ -20,6 +20,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) index = LaunchConfiguration("index") log_level = LaunchConfiguration("log_level") diff --git a/app/power_map/launch/power_map_launch.py b/app/power_map/launch/power_map_launch.py index 181fa7a..cc9993a 100644 --- a/app/power_map/launch/power_map_launch.py +++ b/app/power_map/launch/power_map_launch.py @@ -14,6 +14,7 @@ def generate_launch_description(): "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") power_map = Node( diff --git a/app/simple_joy_app/launch/app_launch.py b/app/simple_joy_app/launch/app_launch.py index 6622bb4..46b8596 100644 --- a/app/simple_joy_app/launch/app_launch.py +++ b/app/simple_joy_app/launch/app_launch.py @@ -9,6 +9,7 @@ def generate_launch_description(): "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") app = Node( diff --git a/device/camera_reader/launch/camera_reader_launch.py b/device/camera_reader/launch/camera_reader_launch.py index e6d0f50..e06005b 100644 --- a/device/camera_reader/launch/camera_reader_launch.py +++ b/device/camera_reader/launch/camera_reader_launch.py @@ -21,6 +21,13 @@ def camera_node(**kwargs: Any) -> Node: def generate_launch_description() -> LaunchDescription: index_arg = DeclareLaunchArgument("index", default_value="-1") + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", + ) + log_level = LaunchConfiguration("log_level") index = LaunchConfiguration("index") index_specified = PythonExpression([index, ">= 0"]) default_config_path = PathJoinSubstitution( @@ -30,13 +37,15 @@ def generate_launch_description() -> LaunchDescription: name=["camera_", index], parameters=[{"camera_id": index}], remappings=[("/device/camera_image", ["/packet/camera_image_", index])], + ros_arguments=["--log-level", log_level], condition=IfCondition(index_specified), ) unuse_index = camera_node( parameters=[default_config_path], remappings=[("/device/camera_image", "/packet/camera_image")], + ros_arguments=["--log-level", log_level], condition=UnlessCondition(index_specified), ) return LaunchDescription( - [index_arg, use_index, unuse_index], + [index_arg, log_level_arg,use_index, unuse_index], ) diff --git a/device/joystick/launch/joystick_launch.py b/device/joystick/launch/joystick_launch.py index 42c9d6a..8f7579c 100644 --- a/device/joystick/launch/joystick_launch.py +++ b/device/joystick/launch/joystick_launch.py @@ -18,6 +18,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") diff --git a/device/nucleo_communicate/launch/channel_launch.py b/device/nucleo_communicate/launch/channel_launch.py index 08f1aa7..2d2d39a 100644 --- a/device/nucleo_communicate/launch/channel_launch.py +++ b/device/nucleo_communicate/launch/channel_launch.py @@ -9,6 +9,7 @@ def generate_launch_description(): "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") channel = Node( diff --git a/device/nucleo_communicate_py/launch/channel_launch.py b/device/nucleo_communicate_py/launch/channel_launch.py index 6e9e38e..cee3c96 100644 --- a/device/nucleo_communicate_py/launch/channel_launch.py +++ b/device/nucleo_communicate_py/launch/channel_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") main = Node( diff --git a/device/nucleo_communicate_py/launch/receiver_launch.py b/device/nucleo_communicate_py/launch/receiver_launch.py index 9b437cd..2704285 100644 --- a/device/nucleo_communicate_py/launch/receiver_launch.py +++ b/device/nucleo_communicate_py/launch/receiver_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") receiver = Node( diff --git a/device/nucleo_communicate_py/launch/sender_launch.py b/device/nucleo_communicate_py/launch/sender_launch.py index 2aeb999..a1951a4 100644 --- a/device/nucleo_communicate_py/launch/sender_launch.py +++ b/device/nucleo_communicate_py/launch/sender_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") sender = Node( diff --git a/device/pi_i2c/launch/all_launch.py b/device/pi_i2c/launch/all_launch.py index 717b0e0..0d7878f 100644 --- a/device/pi_i2c/launch/all_launch.py +++ b/device/pi_i2c/launch/all_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") all_exec = Node( diff --git a/device/pi_i2c/launch/depth_launch.py b/device/pi_i2c/launch/depth_launch.py index b234345..68b83a9 100644 --- a/device/pi_i2c/launch/depth_launch.py +++ b/device/pi_i2c/launch/depth_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") depth = Node( diff --git a/device/pi_i2c/launch/imu_launch.py b/device/pi_i2c/launch/imu_launch.py index 7a84010..3ad8942 100644 --- a/device/pi_i2c/launch/imu_launch.py +++ b/device/pi_i2c/launch/imu_launch.py @@ -9,6 +9,7 @@ def generate_launch_description() -> LaunchDescription: "log_level", default_value="info", choices=["debug", "info", "warn", "error", "fatal"], + description="Logging level for the nodes", ) log_level = LaunchConfiguration("log_level") imu = Node( diff --git a/device/pi_led/launch/led_launch.py b/device/pi_led/launch/led_launch.py index 3a15820..6afdc5e 100644 --- a/device/pi_led/launch/led_launch.py +++ b/device/pi_led/launch/led_launch.py @@ -20,6 +20,12 @@ def led_node(**kwargs: Any) -> Node: def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_valye="info", + description="Logging level for the nodes", + ) + log_level = LaunchConfiguration("log-level") # arguments variant_arg = DeclareLaunchArgument( "variant", @@ -44,27 +50,32 @@ def generate_launch_description() -> LaunchDescription: use_default = led_node( parameters=[right_param_file], remappings=[("/device/led_color", "/packet/order/led_color")], + ros_arguments=["--log-level", log_level], condition=IfCondition(variant_is_default), ) use_right = led_node( name="led_right", parameters=[right_param_file], remappings=[("/device/led_color", "/packet/order/led_color_right")], + ros_arguments=["--log-level", log_level], condition=IfCondition(variant_is_right), ) use_left = led_node( name="led_left", parameters=[left_param_file], remappings=[("/device/led_color", "/packet/order/led_color_left")], + ros_arguments=["--log-level", log_level], condition=IfCondition(variant_is_left), ) use_custom = led_node( name="led_custom", parameters=[param_file], remappings=[("/device/led_color", "/packet/order/led_color_custom")], + ros_arguments=["--log-level", log_level], condition=IfCondition(variant_is_custom), ) return LaunchDescription( - [variant_arg, param_file_arg, use_default, use_right, use_left, use_custom] + [log_level_arg,variant_arg, param_file_arg, use_default, use_right, + use_left, use_custom] ) diff --git a/ul/launch/simple_joy_app_pc.py b/ul/launch/simple_joy_app_pc.py index 1123c5b..3c0e914 100644 --- a/ul/launch/simple_joy_app_pc.py +++ b/ul/launch/simple_joy_app_pc.py @@ -6,6 +6,12 @@ def generate_launch_description() -> LaunchDescription: + log_level_arg = DeclareLaunchArgument( + "log_level", + default_value="info", + description="Logging level for the nodes", + ) + log_level = LaunchConfiguration("log-level") power_map_param_file_arg = DeclareLaunchArgument( "power_map_param_file", default_value=PathJoinSubstitution( @@ -18,14 +24,16 @@ def generate_launch_description() -> LaunchDescription: PathJoinSubstitution( [FindPackageShare("joystick"), "launch", "joystick_launch.py"] ) - ) + ), + launch_arguments=[("log-level", log_level)], ) app = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("simple_joy_app"), "launch", "app_launch.py"] ) - ) + ), + launch_arguments=[("log-level", log_level)], ) power_map = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -40,4 +48,4 @@ def generate_launch_description() -> LaunchDescription: forwarding=False, launch_configurations={"param_file": power_map_param_file}, ) - return LaunchDescription([power_map_param_file_arg, nodes]) + return LaunchDescription([log_level_arg,power_map_param_file_arg, nodes]) From a7f5c460ad587e9fd1186a158f6869c82af0ea4a Mon Sep 17 00:00:00 2001 From: 23-yoshikawa Date: Sat, 24 Aug 2024 20:24:37 +0900 Subject: [PATCH 21/21] add launch_configurations --- ul/launch/double_camera.py | 12 +++++++++--- ul/launch/double_imshow.py | 11 ++++++++--- ul/launch/double_led.py | 11 ++++++++--- ul/launch/nucleo_channel.py | 10 +++++++--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ul/launch/double_camera.py b/ul/launch/double_camera.py index fe492d1..14912ff 100644 --- a/ul/launch/double_camera.py +++ b/ul/launch/double_camera.py @@ -19,7 +19,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "0"), ("log_level", log_level)], + launch_arguments=[("index", "0")], ) camera1 = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -27,7 +27,13 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("camera_reader"), "launch", "camera_reader_launch.py"] ) ), - launch_arguments=[("index", "1"), ("log_level", log_level)], + launch_arguments=[("index", "1")], ) - cameras = GroupAction([camera0, camera1], forwarding=False) + cameras = GroupAction([camera0, camera1], + forwarding=False, + launch_configurations={ + "log_level":log_level, + } + ) + return LaunchDescription([log_level_arg, cameras]) diff --git a/ul/launch/double_imshow.py b/ul/launch/double_imshow.py index fd71844..0bbf3cb 100644 --- a/ul/launch/double_imshow.py +++ b/ul/launch/double_imshow.py @@ -20,7 +20,7 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("imshow"), "launch", "imshow_launch.py"] ) ), - launch_arguments=[("index", "0"), ("log_level", log_level)], + launch_arguments=[("index", "0")], ) imshow1 = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -28,7 +28,12 @@ def generate_launch_description() -> LaunchDescription: [FindPackageShare("imshow"), "launch", "imshow_launch.py"] ) ), - launch_arguments=[("index", "1"), ("log_level", log_level)], + launch_arguments=[("index", "1")], + ) + imshows = GroupAction([imshow0, imshow1], + forwarding=False, + launch_configurations={ + "log_level":log_level, + } ) - imshows = GroupAction([imshow0, imshow1], forwarding=False) return LaunchDescription([log_level_arg, imshows]) diff --git a/ul/launch/double_led.py b/ul/launch/double_led.py index 729ca49..dde86fd 100644 --- a/ul/launch/double_led.py +++ b/ul/launch/double_led.py @@ -17,13 +17,18 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "right"), ("log_level", log_level)], + launch_arguments=[("variant", "right")], ) led_left = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution([FindPackageShare("pi_led"), "launch", "led_launch.py"]) ), - launch_arguments=[("variant", "left"), ("log_level", log_level)], + launch_arguments=[("variant", "left")], + ) + leds = GroupAction([led_left, led_right], + forwarding=False, + launch_configurations={ + "log_level":log_level, + } ) - leds = GroupAction([led_left, led_right], forwarding=False) return LaunchDescription([log_level_arg, leds]) diff --git a/ul/launch/nucleo_channel.py b/ul/launch/nucleo_channel.py index 8397128..d419ee2 100644 --- a/ul/launch/nucleo_channel.py +++ b/ul/launch/nucleo_channel.py @@ -18,7 +18,11 @@ def generate_launch_description() -> LaunchDescription: PathJoinSubstitution( [FindPackageShare("nucleo_communicate"), "launch", "channel_launch.py"] ) - ), - launch_arguments=[("log_level", log_level)], + ) ) - return LaunchDescription([log_level_arg, GroupAction([channel], forwarding=False)]) + nodes = GroupAction( + actions=[channel], + forwarding=False, + launch_configurations={"log_level":log_level}, + ) + return LaunchDescription([log_level_arg, nodes])