Skip to content

Commit

Permalink
Add log level argument to launch files
Browse files Browse the repository at this point in the history
  • Loading branch information
miloszlagan committed Dec 20, 2024
1 parent 99c941e commit da4e981
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 17 deletions.
9 changes: 9 additions & 0 deletions husarion_ugv_battery/launch/battery.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@


def generate_launch_description():
log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand All @@ -34,10 +41,12 @@ def generate_launch_description():
name="battery_driver",
namespace=namespace,
remappings=[("/diagnostics", "diagnostics")],
arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"],
emulate_tty=True,
)

actions = [
declare_log_level_arg,
declare_namespace_arg,
battery_driver_node,
]
Expand Down
36 changes: 30 additions & 6 deletions husarion_ugv_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def generate_launch_description():
choices=["True", "true", "False", "false"],
)

log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand All @@ -62,7 +69,11 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_controller"), "launch", "controller.launch.py"]
)
),
launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"common_dir_path": common_dir_path,
}.items(),
)

system_monitor_launch = IncludeLaunchDescription(
Expand All @@ -75,7 +86,7 @@ def generate_launch_description():
]
),
),
launch_arguments={"namespace": namespace}.items(),
launch_arguments={"log_level": log_level, "namespace": namespace}.items(),
)

lights_launch = IncludeLaunchDescription(
Expand All @@ -84,7 +95,11 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_lights"), "launch", "lights.launch.py"]
)
),
launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"common_dir_path": common_dir_path,
}.items(),
)

battery_launch = IncludeLaunchDescription(
Expand All @@ -93,7 +108,7 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_battery"), "launch", "battery.launch.py"]
),
),
launch_arguments={"namespace": namespace}.items(),
launch_arguments={"log_level": log_level, "namespace": namespace}.items(),
)

ekf_launch = IncludeLaunchDescription(
Expand All @@ -102,7 +117,11 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_localization"), "launch", "localization.launch.py"]
)
),
launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"common_dir_path": common_dir_path,
}.items(),
)

manager_launch = IncludeLaunchDescription(
Expand All @@ -112,7 +131,11 @@ def generate_launch_description():
)
),
condition=UnlessCondition(disable_manager),
launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"common_dir_path": common_dir_path,
}.items(),
)

delayed_action = TimerAction(
Expand All @@ -128,6 +151,7 @@ def generate_launch_description():
actions = [
declare_common_dir_path_arg,
declare_disable_manager_arg,
declare_log_level_arg,
declare_namespace_arg,
welcome_info,
controller_launch,
Expand Down
23 changes: 23 additions & 0 deletions husarion_ugv_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ def generate_launch_description():
),
)

log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand Down Expand Up @@ -263,6 +270,11 @@ def generate_launch_description():
"controller_manager",
"--controller-manager-timeout",
"10",
"--ros-args",
"--log-level",
log_level,
"--log-level",
"rcl:=INFO",
],
namespace=namespace,
emulate_tty=True,
Expand All @@ -277,6 +289,11 @@ def generate_launch_description():
"controller_manager",
"--controller-manager-timeout",
"10",
"--ros-args",
"--log-level",
log_level,
"--log-level",
"rcl:=INFO",
],
namespace=namespace,
emulate_tty=True,
Expand All @@ -299,6 +316,11 @@ def generate_launch_description():
"controller_manager",
"--controller-manager-timeout",
"10",
"--ros-args",
"--log-level",
log_level,
"--log-level",
"rcl:=INFO",
],
namespace=namespace,
emulate_tty=True,
Expand All @@ -324,6 +346,7 @@ def generate_launch_description():
declare_publish_robot_state_arg,
declare_use_sim_arg,
declare_wheel_config_path_arg,
declare_log_level_arg,
SetParameter(name="use_sim_time", value=use_sim),
control_node,
robot_state_pub_node,
Expand Down
9 changes: 9 additions & 0 deletions husarion_ugv_diagnostics/launch/system_monitor.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@


def generate_launch_description():
log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand Down Expand Up @@ -53,10 +60,12 @@ def generate_launch_description():
parameters=[system_monitor_config_path],
namespace=namespace,
remappings=[("/diagnostics", "diagnostics")],
arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"],
emulate_tty=True,
)

actions = [
declare_log_level_arg,
declare_namespace_arg,
declare_system_monitor_config_path_arg,
system_monitor_node,
Expand Down
34 changes: 31 additions & 3 deletions husarion_ugv_gazebo/launch/simulate_robot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def generate_launch_description():
description="Path to the parameter_bridge configuration file.",
)

log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand All @@ -108,6 +115,7 @@ def generate_launch_description():
),
launch_arguments={
"add_wheel_joints": "False",
"log_level": log_level,
"namespace": namespace,
}.items(),
)
Expand All @@ -118,7 +126,11 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_lights"), "launch", "lights.launch.py"]
)
),
launch_arguments={"namespace": namespace, "use_sim": "True"}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"use_sim": "True",
}.items(),
)

manager_launch = IncludeLaunchDescription(
Expand All @@ -127,7 +139,11 @@ def generate_launch_description():
[FindPackageShare("husarion_ugv_manager"), "launch", "manager.launch.py"]
)
),
launch_arguments={"namespace": namespace, "use_sim": "True"}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"use_sim": "True",
}.items(),
condition=UnlessCondition(disable_manager),
)

Expand All @@ -142,6 +158,7 @@ def generate_launch_description():
)
),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"publish_robot_state": "False",
"use_sim": "True",
Expand All @@ -158,7 +175,11 @@ def generate_launch_description():
]
)
),
launch_arguments={"namespace": namespace, "use_sim": "True"}.items(),
launch_arguments={
"log_level": log_level,
"namespace": namespace,
"use_sim": "True",
}.items(),
)

simulate_components = IncludeLaunchDescription(
Expand Down Expand Up @@ -191,6 +212,7 @@ def generate_launch_description():
name="gz_bridge",
parameters=[{"config_file": namespaced_gz_bridge_config_path}],
namespace=namespace,
arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"],
emulate_tty=True,
)

Expand All @@ -217,6 +239,11 @@ def generate_launch_description():
"world",
"--child-frame-id",
child_tf,
"--ros-args",
"--log-level",
log_level,
"--log-level",
"rcl:=INFO",
],
namespace=namespace,
emulate_tty=True,
Expand All @@ -230,6 +257,7 @@ def generate_launch_description():
declare_components_config_path_arg,
declare_disable_manager_arg,
declare_gz_bridge_config_path_arg,
declare_log_level_arg,
declare_namespace_arg,
SetUseSimTime(True),
spawn_robot_launch,
Expand Down
9 changes: 9 additions & 0 deletions husarion_ugv_gazebo/launch/simulation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ def generate_launch_description():
description="Run simulation with specific GUI layout.",
)

log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand Down Expand Up @@ -91,10 +98,12 @@ def generate_launch_description():
]
)
),
launch_arguments={"log_level": log_level}.items(),
)

actions = [
declare_gz_gui,
declare_log_level_arg,
declare_namespace_arg,
declare_use_rviz_arg,
# Sets use_sim_time for all nodes started below (doesn't work for nodes started from ignition gazebo)
Expand Down
13 changes: 13 additions & 0 deletions husarion_ugv_gazebo/launch/spawn_robot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@


def generate_launch_description():
log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
Expand Down Expand Up @@ -91,6 +97,7 @@ def generate_launch_description():
),
launch_arguments={
"add_wheel_joints": LaunchConfiguration("add_wheel_joints", default="True"),
"log_level": log_level,
"namespace": namespace,
"use_sim": "True",
}.items(),
Expand All @@ -116,12 +123,18 @@ def generate_launch_description():
pitch,
"-Y",
yaw,
"--ros-args",
"--log-level",
log_level,
"--log-level",
"rcl:=INFO",
],
namespace=namespace,
emulate_tty=True,
)

actions = [
declare_log_level_arg,
declare_namespace_arg,
declare_robot_model_arg,
declare_x_arg,
Expand Down
9 changes: 9 additions & 0 deletions husarion_ugv_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ def generate_launch_description():
description="Path to a YAML file with a description of led configuration.",
)

log_level = LaunchConfiguration("log_level")
declare_log_level_arg = DeclareLaunchArgument(
"log_level",
default_value="info",
description="Logging level",
)

namespace = LaunchConfiguration("namespace")
declare_namespace_arg = DeclareLaunchArgument(
"namespace",
Expand Down Expand Up @@ -124,6 +131,7 @@ def generate_launch_description():
],
),
],
arguments=["--ros-args", "--log-level", log_level, "--log-level", "rcl:=INFO"],
emulate_tty=True,
on_exit=Shutdown(),
)
Expand All @@ -132,6 +140,7 @@ def generate_launch_description():
declare_common_dir_path_arg,
declare_robot_model_arg, # robot_model is used by animations_config_path
declare_animations_config_path_arg,
declare_log_level_arg,
declare_namespace_arg,
declare_use_sim_arg,
declare_user_led_animations_path_arg,
Expand Down
Loading

0 comments on commit da4e981

Please sign in to comment.