55from ament_index_python .packages import get_package_share_directory
66
77from launch import LaunchDescription
8- from launch .actions import DeclareLaunchArgument , IncludeLaunchDescription , OpaqueFunction
8+ from launch .actions import (
9+ DeclareLaunchArgument ,
10+ IncludeLaunchDescription ,
11+ OpaqueFunction ,
12+ )
913from launch .launch_description_sources import PythonLaunchDescriptionSource
1014from launch .substitutions import LaunchConfiguration
1115from launch_ros .actions import Node , SetParameter
@@ -31,16 +35,17 @@ def _launch_setup(context, *args, **kwargs):
3135 # first and drone1 just inherits drone0's - both ended up driving
3236 # /gz/drone0/cmd_vel and the second drone never moved. easiest way out is to
3337 # skip that file and start the node ourselves with the real topic strings.
34- cmd_vel = LaunchConfiguration ("cmd_vel_topic" ).perform (context ) \
38+ cmd_vel = (
39+ LaunchConfiguration ("cmd_vel_topic" ).perform (context )
3540 or f"/gz/{ namespace } /cmd_vel"
36- arm = LaunchConfiguration ("arm_topic" ).perform (context ) \
37- or f"/gz/{ namespace } /arm"
38- acro = LaunchConfiguration ("acro_topic" ).perform (context ) \
39- or f"/gz/{ namespace } /acro"
41+ )
42+ arm = LaunchConfiguration ("arm_topic" ).perform (context ) or f"/gz/{ namespace } /arm"
43+ acro = LaunchConfiguration ("acro_topic" ).perform (context ) or f"/gz/{ namespace } /acro"
4044
4145 control_modes = os .path .join (
4246 get_package_share_directory ("as2_platform_gazebo" ),
43- "config" , "control_modes.yaml" ,
47+ "config" ,
48+ "control_modes.yaml" ,
4449 )
4550 platform_gazebo = Node (
4651 package = "as2_platform_gazebo" ,
@@ -51,11 +56,11 @@ def _launch_setup(context, *args, **kwargs):
5156 emulate_tty = True ,
5257 parameters = [
5358 {
54- "use_sim_time" : True ,
59+ "use_sim_time" : True ,
5560 "control_modes_file" : control_modes ,
56- "cmd_vel_topic" : cmd_vel ,
57- "arm_topic" : arm ,
58- "acro_topic" : acro ,
61+ "cmd_vel_topic" : cmd_vel ,
62+ "arm_topic" : arm ,
63+ "acro_topic" : acro ,
5964 },
6065 as2_sim_config ,
6166 ],
@@ -111,15 +116,18 @@ def generate_launch_description():
111116 "namespace" , default_value = "drone0" , description = "Drone namespace."
112117 ),
113118 DeclareLaunchArgument (
114- "cmd_vel_topic" , default_value = "" ,
119+ "cmd_vel_topic" ,
120+ default_value = "" ,
115121 description = "Gazebo cmd_vel topic. Empty = auto-derive from namespace." ,
116122 ),
117123 DeclareLaunchArgument (
118- "arm_topic" , default_value = "" ,
124+ "arm_topic" ,
125+ default_value = "" ,
119126 description = "Gazebo arm topic. Empty = auto-derive from namespace." ,
120127 ),
121128 DeclareLaunchArgument (
122- "acro_topic" , default_value = "" ,
129+ "acro_topic" ,
130+ default_value = "" ,
123131 description = "Gazebo acro topic. Empty = auto-derive from namespace." ,
124132 ),
125133 OpaqueFunction (function = _launch_setup ),
0 commit comments