Skip to content

Commit ad496a1

Browse files
committed
lint and format
1 parent d8e7df4 commit ad496a1

File tree

2 files changed

+95
-72
lines changed

2 files changed

+95
-72
lines changed

opennav_coverage_demo/launch/coverage_demo_launch.py

+45-34
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
from ament_index_python.packages import get_package_share_directory
1919
from launch import LaunchDescription
20-
from launch.actions import ExecuteProcess, IncludeLaunchDescription, OpaqueFunction, RegisterEventHandler
20+
from launch.actions import (
21+
ExecuteProcess,
22+
IncludeLaunchDescription,
23+
OpaqueFunction,
24+
RegisterEventHandler,
25+
)
2126
from launch.event_handlers import OnShutdown
2227
from launch.launch_description_sources import PythonLaunchDescriptionSource
2328
from launch_ros.actions import Node
@@ -27,18 +32,18 @@ def generate_launch_description():
2732
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
2833
coverage_demo_dir = get_package_share_directory('opennav_coverage_demo')
2934
rviz_config_file = os.path.join(coverage_demo_dir, 'rviz_config.rviz')
30-
sim_dir = get_package_share_directory("nav2_minimal_tb3_sim")
35+
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
3136

3237
world = os.path.join(coverage_demo_dir, 'blank.world')
3338
param_file_path = os.path.join(coverage_demo_dir, 'demo_params.yaml')
34-
robot_sdf = os.path.join(sim_dir, "urdf", "gz_waffle.sdf.xacro")
39+
robot_sdf = os.path.join(sim_dir, 'urdf', 'gz_waffle.sdf.xacro')
3540

3641
# start the simulation
37-
world_sdf = tempfile.mktemp(prefix="nav2_", suffix=".sdf")
38-
world_sdf_xacro = ExecuteProcess(cmd=["xacro", "-o", world_sdf, "headless:=false", world])
42+
world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf')
43+
world_sdf_xacro = ExecuteProcess(cmd=['xacro', '-o', world_sdf, 'headless:=false', world])
3944
gazebo_server = ExecuteProcess(
40-
cmd=["gz", "sim", "-r", "-s", world_sdf],
41-
output="screen",
45+
cmd=['gz', 'sim', '-r', '-s', world_sdf],
46+
output='screen',
4247
)
4348

4449
urdf = os.path.join(sim_dir, 'urdf', 'turtlebot3_waffle.urdf')
@@ -50,58 +55,64 @@ def generate_launch_description():
5055
executable='robot_state_publisher',
5156
name='robot_state_publisher',
5257
output='screen',
53-
parameters=[{'use_sim_time': True,
54-
'robot_description': robot_description}])
58+
parameters=[{'use_sim_time': True, 'robot_description': robot_description}],
59+
)
5560

5661
remove_temp_sdf_file = RegisterEventHandler(
57-
event_handler=OnShutdown(on_shutdown=[OpaqueFunction(function=lambda _: os.remove(world_sdf))])
62+
event_handler=OnShutdown(
63+
on_shutdown=[OpaqueFunction(function=lambda _: os.remove(world_sdf))]
64+
)
5865
)
5966

6067
gazebo_client = IncludeLaunchDescription(
6168
PythonLaunchDescriptionSource(
62-
os.path.join(get_package_share_directory("ros_gz_sim"), "launch", "gz_sim.launch.py")
69+
os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')
6370
),
64-
launch_arguments={"gz_args": ["-v4 -g "]}.items(),
71+
launch_arguments={'gz_args': ['-v4 -g ']}.items(),
6572
)
6673

6774
start_gazebo_spawner_cmd = IncludeLaunchDescription(
68-
PythonLaunchDescriptionSource(
69-
os.path.join(sim_dir, 'launch', 'spawn_tb3.launch.py')),
70-
launch_arguments={'namespace': '',
71-
'robot_name': 'turtlebot3_waffle',
72-
'robot_sdf': robot_sdf,
73-
'x_pose': str(5.0),
74-
'y_pose': str(5.0),
75-
'z_pose': str(0.1),
76-
'roll': str(0.0),
77-
'pitch': str(0.0),
78-
'yaw': str(0.0)}.items())
75+
PythonLaunchDescriptionSource(os.path.join(sim_dir, 'launch', 'spawn_tb3.launch.py')),
76+
launch_arguments={
77+
'namespace': '',
78+
'robot_name': 'turtlebot3_waffle',
79+
'robot_sdf': robot_sdf,
80+
'x_pose': str(5.0),
81+
'y_pose': str(5.0),
82+
'z_pose': str(0.1),
83+
'roll': str(0.0),
84+
'pitch': str(0.0),
85+
'yaw': str(0.0),
86+
}.items(),
87+
)
7988

8089
# start the visualization
8190
rviz_cmd = IncludeLaunchDescription(
82-
PythonLaunchDescriptionSource(
83-
os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')),
84-
launch_arguments={'namespace': '', 'rviz_config': rviz_config_file}.items())
91+
PythonLaunchDescriptionSource(os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')),
92+
launch_arguments={'namespace': '', 'rviz_config': rviz_config_file}.items(),
93+
)
8594

8695
# start navigation
8796
bringup_cmd = IncludeLaunchDescription(
88-
PythonLaunchDescriptionSource(
89-
os.path.join(coverage_demo_dir, 'bringup_launch.py')),
90-
launch_arguments={'params_file': param_file_path}.items())
97+
PythonLaunchDescriptionSource(os.path.join(coverage_demo_dir, 'bringup_launch.py')),
98+
launch_arguments={'params_file': param_file_path}.items(),
99+
)
91100

92101
# world->odom transform, no localization. For visualization & controller transform
93102
fake_localization_cmd = Node(
94-
package='tf2_ros',
95-
executable='static_transform_publisher',
96-
output='screen',
97-
arguments=['5.0', '5.0', '0', '0', '0', '0', 'map', 'odom'])
103+
package='tf2_ros',
104+
executable='static_transform_publisher',
105+
output='screen',
106+
arguments=['5.0', '5.0', '0', '0', '0', '0', 'map', 'odom'],
107+
)
98108

99109
# start the demo task
100110
demo_cmd = Node(
101111
package='opennav_coverage_demo',
102112
executable='demo_coverage',
103113
emulate_tty=True,
104-
output='screen')
114+
output='screen',
115+
)
105116

106117
ld = LaunchDescription()
107118
ld.add_action(world_sdf_xacro)

opennav_coverage_demo/launch/row_coverage_demo_launch.py

+50-38
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
from ament_index_python.packages import get_package_share_directory
1919
from launch import LaunchDescription
20-
from launch.actions import ExecuteProcess, IncludeLaunchDescription, OpaqueFunction, RegisterEventHandler
20+
from launch.actions import (
21+
ExecuteProcess,
22+
IncludeLaunchDescription,
23+
OpaqueFunction,
24+
RegisterEventHandler,
25+
)
2126
from launch.event_handlers import OnShutdown
2227
from launch.launch_description_sources import PythonLaunchDescriptionSource
2328
from launch_ros.actions import Node
@@ -27,18 +32,18 @@ def generate_launch_description():
2732
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
2833
coverage_demo_dir = get_package_share_directory('opennav_coverage_demo')
2934
rviz_config_file = os.path.join(coverage_demo_dir, 'rviz_config.rviz')
30-
sim_dir = get_package_share_directory("nav2_minimal_tb3_sim")
35+
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
3136

3237
world = os.path.join(coverage_demo_dir, 'blank.world')
3338
param_file_path = os.path.join(coverage_demo_dir, 'demo_params.yaml')
34-
robot_sdf = os.path.join(sim_dir, "urdf", "gz_waffle.sdf.xacro")
39+
robot_sdf = os.path.join(sim_dir, 'urdf', 'gz_waffle.sdf.xacro')
3540

3641
# start the simulation
37-
world_sdf = tempfile.mktemp(prefix="nav2_", suffix=".sdf")
38-
world_sdf_xacro = ExecuteProcess(cmd=["xacro", "-o", world_sdf, "headless:=false", world])
42+
world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf')
43+
world_sdf_xacro = ExecuteProcess(cmd=['xacro', '-o', world_sdf, 'headless:=false', world])
3944
gazebo_server = ExecuteProcess(
40-
cmd=["gz", "sim", "-r", "-s", world_sdf],
41-
output="screen",
45+
cmd=['gz', 'sim', '-r', '-s', world_sdf],
46+
output='screen',
4247
)
4348

4449
urdf = os.path.join(sim_dir, 'urdf', 'turtlebot3_waffle.urdf')
@@ -50,63 +55,70 @@ def generate_launch_description():
5055
executable='robot_state_publisher',
5156
name='robot_state_publisher',
5257
output='screen',
53-
parameters=[{'use_sim_time': True,
54-
'robot_description': robot_description}])
58+
parameters=[{'use_sim_time': True, 'robot_description': robot_description}],
59+
)
5560

5661
remove_temp_sdf_file = RegisterEventHandler(
57-
event_handler=OnShutdown(on_shutdown=[OpaqueFunction(function=lambda _: os.remove(world_sdf))])
62+
event_handler=OnShutdown(
63+
on_shutdown=[OpaqueFunction(function=lambda _: os.remove(world_sdf))]
64+
)
5865
)
5966

6067
gazebo_client = IncludeLaunchDescription(
6168
PythonLaunchDescriptionSource(
62-
os.path.join(get_package_share_directory("ros_gz_sim"), "launch", "gz_sim.launch.py")
69+
os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')
6370
),
64-
launch_arguments={"gz_args": ["-v4 -g "]}.items(),
71+
launch_arguments={'gz_args': ['-v4 -g ']}.items(),
6572
)
6673

6774
start_gazebo_spawner_cmd = IncludeLaunchDescription(
68-
PythonLaunchDescriptionSource(
69-
os.path.join(sim_dir, 'launch', 'spawn_tb3.launch.py')),
70-
launch_arguments={'namespace': '',
71-
'robot_name': 'turtlebot3_waffle',
72-
'robot_sdf': robot_sdf,
73-
'x_pose': str(6.23),
74-
'y_pose': str(15.0),
75-
'z_pose': str(0.1),
76-
'roll': str(0.0),
77-
'pitch': str(0.0),
78-
'yaw': str(-1.5708)}.items())
75+
PythonLaunchDescriptionSource(os.path.join(sim_dir, 'launch', 'spawn_tb3.launch.py')),
76+
launch_arguments={
77+
'namespace': '',
78+
'robot_name': 'turtlebot3_waffle',
79+
'robot_sdf': robot_sdf,
80+
'x_pose': str(6.23),
81+
'y_pose': str(15.0),
82+
'z_pose': str(0.1),
83+
'roll': str(0.0),
84+
'pitch': str(0.0),
85+
'yaw': str(-1.5708),
86+
}.items(),
87+
)
7988

8089
# start the visualization
8190
rviz_cmd = IncludeLaunchDescription(
82-
PythonLaunchDescriptionSource(
83-
os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')),
84-
launch_arguments={'namespace': '', 'rviz_config': rviz_config_file}.items())
91+
PythonLaunchDescriptionSource(os.path.join(nav2_bringup_dir, 'launch', 'rviz_launch.py')),
92+
launch_arguments={'namespace': '', 'rviz_config': rviz_config_file}.items(),
93+
)
8594

8695
# start navigation
8796
bringup_cmd = IncludeLaunchDescription(
88-
PythonLaunchDescriptionSource(
89-
os.path.join(coverage_demo_dir, 'row_bringup_launch.py')),
90-
launch_arguments={'params_file': param_file_path}.items())
97+
PythonLaunchDescriptionSource(os.path.join(coverage_demo_dir, 'row_bringup_launch.py')),
98+
launch_arguments={'params_file': param_file_path}.items(),
99+
)
91100

92101
# Demo GPS->map->odom transform, no localization. For visualization & controller transform
93102
fake_localization_cmd = Node(
94-
package='tf2_ros',
95-
executable='static_transform_publisher',
96-
output='screen',
97-
arguments=['6.23', '15', '0', '0', '0', '0', 'map', 'odom'])
103+
package='tf2_ros',
104+
executable='static_transform_publisher',
105+
output='screen',
106+
arguments=['6.23', '15', '0', '0', '0', '0', 'map', 'odom'],
107+
)
98108
fake_gps_cmd = Node(
99-
package='tf2_ros',
100-
executable='static_transform_publisher',
101-
output='screen',
102-
arguments=['0', '0', '0', '0', '0', '0', 'EPSG:4258', 'map'])
109+
package='tf2_ros',
110+
executable='static_transform_publisher',
111+
output='screen',
112+
arguments=['0', '0', '0', '0', '0', '0', 'EPSG:4258', 'map'],
113+
)
103114

104115
# start the demo task
105116
demo_cmd = Node(
106117
package='opennav_coverage_demo',
107118
executable='demo_row_coverage',
108119
emulate_tty=True,
109-
output='screen')
120+
output='screen',
121+
)
110122

111123
ld = LaunchDescription()
112124
ld.add_action(world_sdf_xacro)

0 commit comments

Comments
 (0)