Skip to content

Commit 2bf5d08

Browse files
kaiaaiclaude
andcommitted
oomwoo_bringup: reformat launch files to this repo's lint style
The launch files came over in kaiaai style (2-space indent, double quotes) and failed this repo's ament_flake8 / ament_pep257 (colcon test). Reformat all nine to match the oomwoo packages here -- 4-space indent, single quotes, sorted/grouped imports, no unused imports -- with no behavior change, plus a few small cleanups surfaced along the way: - drop dead code: an unused `re` import in every file, an unused robot_description in cartographer, an unused urdf_path_str in publish_urdf, and physical's four no-op LogInfo() statements (never added to the launch description, so they logged nothing; the print()s above them remain). - physical: build the telemetry parameter list before the node instead of an inline ternary; rename the local `lidar_model` to `lidar_model_name` to not reuse the argument name. - navigation: rename the `map` OpaqueFunction arg to `map_arg` (avoids shadowing the builtin); the launch argument is still `map`. - inspect_urdf: the joints-arg description was `don''t` (two adjacent string literals -> "dont"); reworded to avoid the apostrophe. Verified with the real ament_flake8 + ament_pep257 in the jazzy container: 9 files, no problems; colcon test oomwoo_bringup = 16 tests, 0 failures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e53c078 commit 2bf5d08

9 files changed

Lines changed: 151 additions & 130 deletions

src/oomwoo_bringup/launch/cartographer.launch.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,37 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os, re
17+
import os
18+
1819
from ament_index_python.packages import get_package_share_path
19-
from launch import LaunchDescription, LaunchContext
20-
from launch.actions import DeclareLaunchArgument, OpaqueFunction
21-
from launch.actions import IncludeLaunchDescription
22-
from launch.conditions import IfCondition, UnlessCondition
23-
from launch.substitutions import Command, LaunchConfiguration, ThisLaunchFileDir
20+
21+
from kaiaai import config
22+
23+
from launch import LaunchContext, LaunchDescription
24+
from launch.actions import (
25+
DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction)
2426
from launch.launch_description_sources import PythonLaunchDescriptionSource
25-
from launch_ros.parameter_descriptions import ParameterValue
27+
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
28+
2629
from launch_ros.actions import Node
27-
from kaiaai import config
2830

2931

30-
def make_nodes(context: LaunchContext, robot_model, use_sim_time, configuration_basename):
32+
def make_nodes(context: LaunchContext, robot_model, use_sim_time,
33+
configuration_basename):
3134
robot_model_str = context.perform_substitution(robot_model)
3235
use_sim_time_str = context.perform_substitution(use_sim_time)
33-
configuration_basename_str = context.perform_substitution(configuration_basename)
36+
configuration_basename_str = context.perform_substitution(
37+
configuration_basename)
3438

3539
if len(robot_model_str) == 0:
36-
robot_model_str = config.get_var('robot.model')
40+
robot_model_str = config.get_var('robot.model')
3741

3842
description_package_path = get_package_share_path(robot_model_str)
3943

40-
#model_name = re.sub(r'_description$', '', description_str)
4144
urdf_path_name = os.path.join(
42-
description_package_path,
43-
'urdf',
44-
'robot.urdf.xacro')
45-
46-
robot_description = ParameterValue(Command(['xacro ', urdf_path_name]), value_type=str)
45+
description_package_path,
46+
'urdf',
47+
'robot.urdf.xacro')
4748

4849
cartographer_config_path = os.path.join(
4950
description_package_path,
@@ -55,7 +56,8 @@ def make_nodes(context: LaunchContext, robot_model, use_sim_time, configuration_
5556
'cartographer.rviz')
5657

5758
print('URDF file : {}'.format(urdf_path_name))
58-
print('Cartographer config : {}/{}'.format(cartographer_config_path, configuration_basename_str))
59+
print('Cartographer config : {}/{}'.format(
60+
cartographer_config_path, configuration_basename_str))
5961
print('Rviz2 config : {}'.format(rviz_config_path))
6062

6163
return [
@@ -80,7 +82,6 @@ def make_nodes(context: LaunchContext, robot_model, use_sim_time, configuration_
8082

8183

8284
def generate_launch_description():
83-
8485
return LaunchDescription([
8586
DeclareLaunchArgument(
8687
name='robot_model',
@@ -101,15 +102,17 @@ def generate_launch_description():
101102
DeclareLaunchArgument(
102103
'resolution',
103104
default_value='0.05',
104-
description='Resolution of a grid cell in the published occupancy grid'
105+
description='Resolution of a grid cell in the published occupancy '
106+
'grid'
105107
),
106108
DeclareLaunchArgument(
107109
'publish_period_sec',
108110
default_value='1.0',
109111
description='OccupancyGrid publishing period'
110112
),
111113
IncludeLaunchDescription(
112-
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/occupancy_grid.launch.py']),
114+
PythonLaunchDescriptionSource(
115+
[ThisLaunchFileDir(), '/occupancy_grid.launch.py']),
113116
launch_arguments={
114117
'use_sim_time': LaunchConfiguration('use_sim_time'),
115118
'resolution': LaunchConfiguration('resolution'),

src/oomwoo_bringup/launch/edit_urdf.launch.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,40 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os, re
17+
import os
18+
1819
from ament_index_python.packages import get_package_share_path
19-
from launch import LaunchDescription, LaunchContext
20-
from launch.actions import DeclareLaunchArgument, OpaqueFunction
21-
from launch.actions import ExecuteProcess
22-
from launch.conditions import IfCondition, UnlessCondition
23-
from launch.substitutions import Command, LaunchConfiguration
24-
from launch_ros.actions import Node
25-
from launch_ros.parameter_descriptions import ParameterValue
20+
2621
from kaiaai import config
2722

23+
from launch import LaunchContext, LaunchDescription
24+
from launch.actions import DeclareLaunchArgument, ExecuteProcess, OpaqueFunction
25+
from launch.substitutions import LaunchConfiguration
26+
27+
from launch_ros.actions import Node
28+
29+
2830
def make_nodes(context: LaunchContext, robot_model, gui):
2931
robot_model_str = context.perform_substitution(robot_model)
3032
gui_str = context.perform_substitution(gui)
3133

3234
if len(robot_model_str) == 0:
33-
robot_model_str = config.get_var('robot.model')
35+
robot_model_str = config.get_var('robot.model')
3436

3537
description_package_path = get_package_share_path(robot_model_str)
3638

3739
urdf_path_name = os.path.join(
38-
description_package_path,
39-
'urdf',
40-
# robot_model_str + '.urdf.xacro')
41-
'robot.urdf.xacro')
40+
description_package_path,
41+
'urdf',
42+
'robot.urdf.xacro')
4243

4344
rviz_config_path = os.path.join(
4445
description_package_path,
4546
'rviz',
4647
'inspect_urdf.rviz')
4748

48-
print("Rviz2 config : {}".format(rviz_config_path))
49-
print("URDF config : {}".format(urdf_path_name))
49+
print('Rviz2 config : {}'.format(rviz_config_path))
50+
print('URDF config : {}'.format(urdf_path_name))
5051

5152
return [
5253
ExecuteProcess(
@@ -70,7 +71,6 @@ def make_nodes(context: LaunchContext, robot_model, gui):
7071

7172

7273
def generate_launch_description():
73-
7474
return LaunchDescription([
7575
DeclareLaunchArgument(
7676
name='robot_model',

src/oomwoo_bringup/launch/explore.launch.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,46 @@
33
import os
44

55
from ament_index_python.packages import get_package_share_directory
6-
from launch_ros.actions import Node
76

87
from launch import LaunchDescription
98
from launch.actions import DeclareLaunchArgument
109
from launch.substitutions import LaunchConfiguration
1110

11+
from launch_ros.actions import Node
12+
1213

1314
def generate_launch_description():
1415
ld = LaunchDescription()
1516
config = os.path.join(
16-
get_package_share_directory("explore_lite"), "config", "params.yaml"
17+
get_package_share_directory('explore_lite'), 'config', 'params.yaml'
1718
)
18-
use_sim_time = LaunchConfiguration("use_sim_time")
19-
namespace = LaunchConfiguration("namespace")
19+
use_sim_time = LaunchConfiguration('use_sim_time')
20+
namespace = LaunchConfiguration('namespace')
2021

2122
declare_use_sim_time_argument = DeclareLaunchArgument(
22-
"use_sim_time", default_value="true", description="Use simulation/Gazebo clock"
23+
'use_sim_time', default_value='true',
24+
description='Use simulation/Gazebo clock'
2325
)
2426
declare_namespace_argument = DeclareLaunchArgument(
25-
"namespace",
26-
default_value="",
27-
description="Namespace for the explore node",
27+
'namespace',
28+
default_value='',
29+
description='Namespace for the explore node',
2830
)
2931

30-
# Map fully qualified names to relative ones so the node's namespace can be prepended.
31-
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative
32+
# Map fully qualified names to relative ones so the node's namespace can be
33+
# prepended. For the transforms (tf), currently, there doesn't seem to be a
34+
# better alternative:
3235
# https://github.com/ros/geometry2/issues/32
3336
# https://github.com/ros/robot_state_publisher/pull/30
34-
remappings = [("/tf", "tf"), ("/tf_static", "tf_static")]
37+
remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')]
3538

3639
node = Node(
37-
package="explore_lite",
38-
name="explore_node",
40+
package='explore_lite',
41+
name='explore_node',
3942
namespace=namespace,
40-
executable="explore",
41-
parameters=[config, {"use_sim_time": use_sim_time}],
42-
output="screen",
43+
executable='explore',
44+
parameters=[config, {'use_sim_time': use_sim_time}],
45+
output='screen',
4346
remappings=remappings,
4447
)
4548
ld.add_action(declare_use_sim_time_argument)

src/oomwoo_bringup/launch/inspect_urdf.launch.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,44 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os, re
17+
import os
18+
1819
from ament_index_python.packages import get_package_share_path
19-
from launch import LaunchDescription, LaunchContext
20+
21+
from kaiaai import config
22+
23+
from launch import LaunchContext, LaunchDescription
2024
from launch.actions import DeclareLaunchArgument, OpaqueFunction
2125
from launch.conditions import LaunchConfigurationEquals
2226
from launch.substitutions import Command, LaunchConfiguration
27+
2328
from launch_ros.actions import Node
2429
from launch_ros.parameter_descriptions import ParameterValue
25-
from kaiaai import config
2630

2731

2832
def make_nodes(context: LaunchContext, robot_model):
2933
robot_model_str = context.perform_substitution(robot_model)
3034

3135
if len(robot_model_str) == 0:
32-
robot_model_str = config.get_var('robot.model')
36+
robot_model_str = config.get_var('robot.model')
3337

3438
description_package_path = get_package_share_path(robot_model_str)
3539

3640
urdf_path_name = os.path.join(
37-
description_package_path,
38-
'urdf',
39-
# robot_model_str + '.urdf.xacro')
40-
'robot.urdf.xacro')
41+
description_package_path,
42+
'urdf',
43+
'robot.urdf.xacro')
4144

42-
robot_description = ParameterValue(Command(['xacro ', urdf_path_name]), value_type=str)
45+
robot_description = ParameterValue(
46+
Command(['xacro ', urdf_path_name]), value_type=str)
4347

4448
rviz_config_path = os.path.join(
4549
description_package_path,
4650
'rviz',
4751
'inspect_urdf.rviz')
4852

49-
print("URDF file : {}".format(urdf_path_name))
50-
print("Rviz2 config : {}".format(rviz_config_path))
53+
print('URDF file : {}'.format(urdf_path_name))
54+
print('Rviz2 config : {}'.format(rviz_config_path))
5155

5256
return [
5357
Node(
@@ -66,13 +70,13 @@ def make_nodes(context: LaunchContext, robot_model):
6670

6771

6872
def generate_launch_description():
69-
7073
return LaunchDescription([
7174
DeclareLaunchArgument(
7275
name='joints',
7376
default_value='gui',
7477
choices=['gui', 'nogui', 'none'],
75-
description='Control joints using GUI, no GUI or don''t launch joint_state_publisher at all'
78+
description='Control joints with the GUI, without the GUI, or do '
79+
'not launch joint_state_publisher at all'
7680
),
7781
DeclareLaunchArgument(
7882
name='robot_model',
@@ -85,13 +89,11 @@ def generate_launch_description():
8589
Node(
8690
package='joint_state_publisher',
8791
executable='joint_state_publisher',
88-
# condition=UnlessCondition(LaunchConfiguration('gui'))
8992
condition=LaunchConfigurationEquals('joints', 'nogui')
9093
),
9194
Node(
9295
package='joint_state_publisher_gui',
9396
executable='joint_state_publisher_gui',
94-
# condition=IfCondition(LaunchConfiguration('gui'))
9597
condition=LaunchConfigurationEquals('joints', 'gui')
9698
)
9799
])

src/oomwoo_bringup/launch/monitor_robot.launch.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,31 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os, re
17+
import os
18+
1819
from ament_index_python.packages import get_package_share_path
19-
from launch import LaunchDescription, LaunchContext
20-
from launch_ros.actions import Node
20+
21+
from kaiaai import config
22+
23+
from launch import LaunchContext, LaunchDescription
2124
from launch.actions import DeclareLaunchArgument, OpaqueFunction
2225
from launch.substitutions import LaunchConfiguration
23-
from kaiaai import config
26+
27+
from launch_ros.actions import Node
2428

2529

2630
def make_rviz2_node(context: LaunchContext, robot_model, use_sim_time):
2731
robot_model_str = context.perform_substitution(robot_model)
2832
use_sim_time_str = context.perform_substitution(use_sim_time)
2933

3034
if len(robot_model_str) == 0:
31-
robot_model_str = config.get_var('robot.model')
35+
robot_model_str = config.get_var('robot.model')
3236

3337
rviz_config_path = os.path.join(
3438
get_package_share_path(robot_model_str),
3539
'rviz',
3640
'monitor_robot.rviz')
37-
print("Rviz2 config : {}".format(rviz_config_path))
41+
print('Rviz2 config : {}'.format(rviz_config_path))
3842

3943
return [
4044
Node(
@@ -47,8 +51,8 @@ def make_rviz2_node(context: LaunchContext, robot_model, use_sim_time):
4751
)
4852
]
4953

50-
def generate_launch_description():
5154

55+
def generate_launch_description():
5256
return LaunchDescription([
5357
DeclareLaunchArgument(
5458
name='robot_model',

0 commit comments

Comments
 (0)