Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log_level #62

Merged
merged 21 commits into from
Nov 28, 2024
1 change: 1 addition & 0 deletions app/imshow/launch/imshow_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions app/power_map/launch/power_map_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions app/simple_joy_app/launch/app_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 10 additions & 1 deletion device/camera_reader/launch/camera_reader_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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],
)
2 changes: 1 addition & 1 deletion device/joystick/joystick/joystick.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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で変えられるようにしたい
# TODO : ここparameterで変えられるようにしたい
self._joystick = pygame.joystick.Joystick(0)
# logging
name = self._joystick.get_name()
Expand Down
38 changes: 28 additions & 10 deletions device/joystick/launch/joystick_launch.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
from typing import Any

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
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:
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")

joystick = Node(
package="joystick",
executable="joystick",
namespace="device",
remappings=[("/device/joystick", "/packet/joystick")],
ros_arguments=["--log-level", log_level],
)

return LaunchDescription([log_level_arg, joystick])
12 changes: 11 additions & 1 deletion device/nucleo_communicate/launch/channel_launch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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"],
description="Logging level for the nodes",
)
log_level = LaunchConfiguration("log_level")
channel = Node(
package="nucleo_communicate",
executable="nucleo-channel",
Expand All @@ -15,5 +24,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])
12 changes: 11 additions & 1 deletion device/nucleo_communicate_py/launch/channel_launch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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"],
description="Logging level for the nodes",
)
log_level = LaunchConfiguration("log_level")
main = Node(
package="nucleo_communicate_py",
executable="channel",
Expand All @@ -15,5 +24,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])
12 changes: 11 additions & 1 deletion device/nucleo_communicate_py/launch/receiver_launch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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"],
description="Logging level for the nodes",
)
log_level = LaunchConfiguration("log_level")
receiver = Node(
package="nucleo_communicate_py",
executable="receiver",
Expand All @@ -13,5 +22,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])
12 changes: 11 additions & 1 deletion device/nucleo_communicate_py/launch/sender_launch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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"],
description="Logging level for the nodes",
)
log_level = LaunchConfiguration("log_level")
sender = Node(
package="nucleo_communicate_py",
executable="sender",
Expand All @@ -11,5 +20,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])
12 changes: 11 additions & 1 deletion device/pi_i2c/launch/all_launch.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
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"],
description="Logging level for the nodes",
)
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])
12 changes: 11 additions & 1 deletion device/pi_i2c/launch/depth_launch.py
Original file line number Diff line number Diff line change
@@ -1,11 +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"],
description="Logging level for the nodes",
)
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])
12 changes: 11 additions & 1 deletion device/pi_i2c/launch/imu_launch.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
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"],
description="Logging level for the nodes",
)
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])
17 changes: 15 additions & 2 deletions device/pi_led/launch/led_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ 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", 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
Expand All @@ -42,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]
)
21 changes: 17 additions & 4 deletions ul/launch/double_camera.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
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(
Expand All @@ -22,5 +29,11 @@ def generate_launch_description() -> LaunchDescription:
),
launch_arguments=[("index", "1")],
)
cameras = GroupAction([camera0, camera1], forwarding=False)
return LaunchDescription([cameras])
cameras = GroupAction([camera0, camera1],
forwarding=False,
launch_configurations={
"log_level":log_level,
}
)

return LaunchDescription([log_level_arg, cameras])
Loading