diff --git a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py index 4e12d5dbd42..d8ceaab93ab 100644 --- a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py +++ b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py @@ -17,9 +17,10 @@ import os from pathlib import Path import tempfile +from typing import Optional from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription +from launch import LaunchDescription, LaunchDescriptionEntity from launch.actions import (AppendEnvironmentVariable, DeclareLaunchArgument, ExecuteProcess, ForEach, GroupAction, IncludeLaunchDescription, LogInfo, OpaqueFunction, RegisterEventHandler) @@ -50,7 +51,9 @@ def count_robots(context: LaunchContext) -> list[LogInfo]: return [LogInfo(msg=[log_msg])] -def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[GroupAction]: +def generate_robot_actions( + name: str = '', pose: dict[str, float] = {}) -> \ + Optional[list[LaunchDescriptionEntity]]: """Generate the actions to launch a robot with the given name and pose.""" bringup_dir = get_package_share_directory('nav2_bringup') launch_dir = os.path.join(bringup_dir, 'launch') diff --git a/nav2_bringup/launch/tb3_loopback_simulation_launch.py b/nav2_bringup/launch/tb3_loopback_simulation_launch.py index 4dd21a5841b..8fe2de77e43 100644 --- a/nav2_bringup/launch/tb3_loopback_simulation_launch.py +++ b/nav2_bringup/launch/tb3_loopback_simulation_launch.py @@ -125,11 +125,11 @@ def generate_launch_description() -> LaunchDescription: rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(launch_dir, 'rviz_launch.py')), condition=IfCondition(use_rviz), - launch_arguments={ - 'namespace': namespace, - 'use_sim_time': 'True', - 'rviz_config': rviz_config_file, - }.items(), + launch_arguments=[ + ('namespace', namespace), + ('use_sim_time', 'True'), + ('rviz_config', rviz_config_file), + ], ) bringup_cmd = IncludeLaunchDescription( diff --git a/nav2_bringup/launch/tb4_loopback_simulation_launch.py b/nav2_bringup/launch/tb4_loopback_simulation_launch.py index bfc607f7a53..715a6730c8c 100644 --- a/nav2_bringup/launch/tb4_loopback_simulation_launch.py +++ b/nav2_bringup/launch/tb4_loopback_simulation_launch.py @@ -123,11 +123,11 @@ def generate_launch_description() -> LaunchDescription: rviz_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource(os.path.join(launch_dir, 'rviz_launch.py')), condition=IfCondition(use_rviz), - launch_arguments={ - 'namespace': namespace, - 'use_sim_time': 'True', - 'rviz_config': rviz_config_file, - }.items(), + launch_arguments=[ + ('namespace', namespace), + ('use_sim_time', 'True'), + ('rviz_config', rviz_config_file), + ], ) bringup_cmd = IncludeLaunchDescription( @@ -148,10 +148,10 @@ def generate_launch_description() -> LaunchDescription: loopback_sim_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(loopback_sim_dir, 'loopback_simulation.launch.py')), - launch_arguments={ - 'params_file': params_file, - 'scan_frame_id': 'rplidar_link', - }.items(), + launch_arguments=[ + ('params_file', params_file), + ('scan_frame_id', 'rplidar_link'), + ], ) static_publisher_cmd = Node( diff --git a/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py index 19e45505788..c1725a5f442 100644 --- a/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py +++ b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py @@ -23,6 +23,7 @@ import os from pathlib import Path import tempfile +from typing import TypedDict from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription @@ -36,6 +37,18 @@ from nav2_common.launch import LaunchConfigAsBool +class RobotConfig(TypedDict): + """TypedDict for robot configuration.""" + + name: str + x_pose: float + y_pose: float + z_pose: float + roll: float + pitch: float + yaw: float + + def generate_launch_description() -> LaunchDescription: # Get the launch directory bringup_dir = get_package_share_directory('nav2_bringup') @@ -43,7 +56,7 @@ def generate_launch_description() -> LaunchDescription: sim_dir = get_package_share_directory('nav2_minimal_tb3_sim') # Names and poses of the robots - robots = [ + robots: list[RobotConfig] = [ { 'name': 'robot1', 'x_pose': 0.0, diff --git a/nav2_common/nav2_common/launch/has_node_params.py b/nav2_common/nav2_common/launch/has_node_params.py index fa36f280785..2544d7bdb35 100644 --- a/nav2_common/nav2_common/launch/has_node_params.py +++ b/nav2_common/nav2_common/launch/has_node_params.py @@ -16,7 +16,7 @@ import yaml -class HasNodeParams(launch.Substitution): # type: ignore[misc] +class HasNodeParams(launch.Substitution): """ Substitution that checks if a param file contains parameters for a node. diff --git a/nav2_common/nav2_common/launch/launch_config_as_bool.py b/nav2_common/nav2_common/launch/launch_config_as_bool.py index 0eefdac4c17..3b880d69131 100644 --- a/nav2_common/nav2_common/launch/launch_config_as_bool.py +++ b/nav2_common/nav2_common/launch/launch_config_as_bool.py @@ -18,7 +18,7 @@ from launch.utilities import perform_substitutions -class LaunchConfigAsBool(launch.Substitution): # type: ignore[misc] +class LaunchConfigAsBool(launch.Substitution): """ Converts a LaunchConfiguration value into a normalized boolean string: 'true' or 'false'. diff --git a/nav2_common/nav2_common/launch/replace_string.py b/nav2_common/nav2_common/launch/replace_string.py index e379c045457..0a210faab6e 100644 --- a/nav2_common/nav2_common/launch/replace_string.py +++ b/nav2_common/nav2_common/launch/replace_string.py @@ -13,12 +13,12 @@ # limitations under the License. import tempfile -from typing import Optional +from typing import IO, Optional import launch -class ReplaceString(launch.Substitution): # type: ignore[misc] +class ReplaceString(launch.Substitution): """ Substitution that replaces strings on a given file. @@ -87,8 +87,8 @@ def resolve_replacements(self, context: launch.LaunchContext) -> dict[str, str]: ) return resolved_replacements - def replace(self, input_file: launch.SomeSubstitutionsType, - output_file: launch.SomeSubstitutionsType, replacements: dict[str, str]) -> None: + def replace(self, input_file: IO[str], output_file: IO[str], + replacements: dict[str, str]) -> None: for line in input_file: for key, value in replacements.items(): if isinstance(key, str) and isinstance(value, str): diff --git a/nav2_common/nav2_common/launch/rewritten_yaml.py b/nav2_common/nav2_common/launch/rewritten_yaml.py index e475dc410fc..2a80ecf6409 100644 --- a/nav2_common/nav2_common/launch/rewritten_yaml.py +++ b/nav2_common/nav2_common/launch/rewritten_yaml.py @@ -35,7 +35,7 @@ def setValue(self, value: YamlValue) -> None: self.dictionary[self.dictKey] = value -class RewrittenYaml(launch.Substitution): # type: ignore[misc] +class RewrittenYaml(launch.Substitution): """ Substitution that modifies the given YAML file. diff --git a/nav2_costmap_2d/test/integration/costmap_tests_launch.py b/nav2_costmap_2d/test/integration/costmap_tests_launch.py index d1bec18587f..553b81ff2e0 100755 --- a/nav2_costmap_2d/test/integration/costmap_tests_launch.py +++ b/nav2_costmap_2d/test/integration/costmap_tests_launch.py @@ -24,11 +24,11 @@ from launch_testing.legacy import LaunchTestService -def main(argv: list[str] = sys.argv[1:]) -> LaunchTestService: +def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] launchFile = os.path.join( os.getenv('TEST_LAUNCH_DIR', ''), 'costmap_map_server.launch.py' ) - testExecutable = os.getenv('TEST_EXECUTABLE') + testExecutable = os.getenv('TEST_EXECUTABLE', '') map_to_odom = launch_ros.actions.Node( package='tf2_ros', @@ -86,11 +86,11 @@ def main(argv: list[str] = sys.argv[1:]) -> LaunchTestService: output='screen' ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_docking/opennav_docking/test/test_docking_server.py b/nav2_docking/opennav_docking/test/test_docking_server.py index 05dd85f71f8..8974c236ab0 100644 --- a/nav2_docking/opennav_docking/test/test_docking_server.py +++ b/nav2_docking/opennav_docking/test/test_docking_server.py @@ -98,7 +98,7 @@ def generate_test_description() -> LaunchDescription: parameters=[{'autostart': True}, {'node_names': ['docking_server']}] ), - launch_testing.actions.ReadyToTest(), + launch_testing.actions.ReadyToTest(), # type: ignore[no-untyped-call] ]) @@ -345,9 +345,9 @@ def test_docking_server(self) -> None: self.assertTrue(self.action_result[3].result.success) -@launch_testing.post_shutdown_test() +@launch_testing.post_shutdown_test() # type: ignore[no-untyped-call] class TestProcessOutput(unittest.TestCase): def test_exit_code(self, proc_info: launch_testing.ProcInfoHandler) -> None: # Check that all processes in the launch exit with code 0 - launch_testing.asserts.assertExitCodes(proc_info) + launch_testing.asserts.assertExitCodes(proc_info) # type: ignore[no-untyped-call] diff --git a/nav2_lifecycle_manager/test/launch_bond_test.py b/nav2_lifecycle_manager/test/launch_bond_test.py index 4f4687c576a..45576c63a11 100755 --- a/nav2_lifecycle_manager/test/launch_bond_test.py +++ b/nav2_lifecycle_manager/test/launch_bond_test.py @@ -43,17 +43,17 @@ def generate_launch_description() -> LaunchDescription: def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] ld = generate_launch_description() - testExecutable = os.getenv('TEST_EXECUTABLE') + testExecutable = os.getenv('TEST_EXECUTABLE', '') test1_action = ExecuteProcess( cmd=[testExecutable], name='test_bond_gtest', output='screen' ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_lifecycle_manager/test/launch_lifecycle_test.py b/nav2_lifecycle_manager/test/launch_lifecycle_test.py index 66d013f57bc..2a709fe1fce 100755 --- a/nav2_lifecycle_manager/test/launch_lifecycle_test.py +++ b/nav2_lifecycle_manager/test/launch_lifecycle_test.py @@ -44,17 +44,17 @@ def generate_launch_description() -> LaunchDescription: def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] ld = generate_launch_description() - testExecutable = os.getenv('TEST_EXECUTABLE') + testExecutable = os.getenv('TEST_EXECUTABLE', '') test1_action = ExecuteProcess( cmd=[testExecutable], name='test_lifecycle_node_gtest', output='screen' ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_map_server/test/component/test_map_saver_launch.py b/nav2_map_server/test/component/test_map_saver_launch.py index 35fba24fe4d..76ff9539315 100755 --- a/nav2_map_server/test/component/test_map_saver_launch.py +++ b/nav2_map_server/test/component/test_map_saver_launch.py @@ -37,12 +37,12 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] cmd=[testExecutable], name='test_map_saver_node', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) os.chdir(launchDir) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_map_server/test/component/test_map_server_launch.py b/nav2_map_server/test/component/test_map_server_launch.py index 681c567f2e1..f6a985a9b3b 100755 --- a/nav2_map_server/test/component/test_map_server_launch.py +++ b/nav2_map_server/test/component/test_map_server_launch.py @@ -37,12 +37,12 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] cmd=[testExecutable], name='test_map_server_node', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) os.chdir(launchDir) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_simple_commander/launch/route_example_launch.py b/nav2_simple_commander/launch/route_example_launch.py index 18b03d0a60b..285508599a0 100644 --- a/nav2_simple_commander/launch/route_example_launch.py +++ b/nav2_simple_commander/launch/route_example_launch.py @@ -164,14 +164,14 @@ def generate_launch_description() -> LaunchDescription: bringup_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(nav2_bringup_dir, 'launch', 'bringup_launch.py')), - launch_arguments={ - 'map': map_yaml_file, - 'graph': graph_filepath, - 'use_keepout_zones': use_keepout_zones, - 'use_speed_zones': use_speed_zones, - 'keepout_mask': keepout_mask_yaml_file, - 'speed_mask': speed_mask_yaml_file, - }.items()) + launch_arguments=[ + ('map', map_yaml_file), + ('graph', graph_filepath), + ('use_keepout_zones', use_keepout_zones), + ('use_speed_zones', use_speed_zones), + ('keepout_mask', keepout_mask_yaml_file), + ('speed_mask', speed_mask_yaml_file), + ]) # start the demo autonomy task demo_cmd = Node( diff --git a/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py b/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py index 01b71676695..3c880efa119 100755 --- a/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py +++ b/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py @@ -123,11 +123,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] cmd=[testExecutable], name='test_assisted_teleop_behavior_node', output='screen' ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py b/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py index f543296447d..99b0e8f3f18 100755 --- a/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py @@ -148,11 +148,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py b/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py index 6e267e21f25..44db54a6fa5 100755 --- a/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py @@ -148,11 +148,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py b/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py index 007291cd4a0..02c2bee9acd 100755 --- a/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py @@ -148,11 +148,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py b/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py index f4230ac00bd..3c70c5ee797 100755 --- a/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py +++ b/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py @@ -128,11 +128,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] cmd=[testExecutable], name='test_wait_behavior_node', output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] kill_os_processes('gz sim') return return_code diff --git a/nav2_system_tests/src/costmap_filters/test_keepout_launch.py b/nav2_system_tests/src/costmap_filters/test_keepout_launch.py index 0821af43078..5f2d082ec56 100755 --- a/nav2_system_tests/src/costmap_filters/test_keepout_launch.py +++ b/nav2_system_tests/src/costmap_filters/test_keepout_launch.py @@ -184,11 +184,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/costmap_filters/test_speed_launch.py b/nav2_system_tests/src/costmap_filters/test_speed_launch.py index b25b73dd25c..8aca0e71e28 100755 --- a/nav2_system_tests/src/costmap_filters/test_speed_launch.py +++ b/nav2_system_tests/src/costmap_filters/test_speed_launch.py @@ -175,11 +175,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/error_codes/test_error_codes_launch.py b/nav2_system_tests/src/error_codes/test_error_codes_launch.py index 7e33c5bb240..b3e7235b538 100755 --- a/nav2_system_tests/src/error_codes/test_error_codes_launch.py +++ b/nav2_system_tests/src/error_codes/test_error_codes_launch.py @@ -112,11 +112,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test_error_codes_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test_error_codes_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_system_tests/src/gps_navigation/test_case_py.launch.py b/nav2_system_tests/src/gps_navigation/test_case_py.launch.py index d071eba1a6e..43a4dcae3a2 100755 --- a/nav2_system_tests/src/gps_navigation/test_case_py.launch.py +++ b/nav2_system_tests/src/gps_navigation/test_case_py.launch.py @@ -119,11 +119,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/localization/test_localization_launch.py b/nav2_system_tests/src/localization/test_localization_launch.py index c573f39dd56..fb0e615bc8f 100755 --- a/nav2_system_tests/src/localization/test_localization_launch.py +++ b/nav2_system_tests/src/localization/test_localization_launch.py @@ -111,11 +111,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] cmd=[testExecutable], name='test_localization_node', output='screen' ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/planning/test_planner_costmaps_launch.py b/nav2_system_tests/src/planning/test_planner_costmaps_launch.py index 6eb5888e80f..e5661892423 100755 --- a/nav2_system_tests/src/planning/test_planner_costmaps_launch.py +++ b/nav2_system_tests/src/planning/test_planner_costmaps_launch.py @@ -23,7 +23,7 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] - testExecutable = os.getenv('TEST_EXECUTABLE') + testExecutable = os.getenv('TEST_EXECUTABLE', '') ld = LaunchDescription([]) @@ -33,11 +33,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_system_tests/src/planning/test_planner_random_launch.py b/nav2_system_tests/src/planning/test_planner_random_launch.py index ca014d6a59f..727cb8c22f7 100755 --- a/nav2_system_tests/src/planning/test_planner_random_launch.py +++ b/nav2_system_tests/src/planning/test_planner_random_launch.py @@ -23,7 +23,7 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] - testExecutable = os.getenv('TEST_EXECUTABLE') + testExecutable = os.getenv('TEST_EXECUTABLE', '') ld = LaunchDescription([]) @@ -33,11 +33,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_system_tests/src/route/test_route_launch.py b/nav2_system_tests/src/route/test_route_launch.py index 7b8e4e97949..6a454563894 100755 --- a/nav2_system_tests/src/route/test_route_launch.py +++ b/nav2_system_tests/src/route/test_route_launch.py @@ -159,11 +159,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/system/test_multi_robot_launch.py b/nav2_system_tests/src/system/test_multi_robot_launch.py index e39a6993f77..6ceb0292112 100755 --- a/nav2_system_tests/src/system/test_multi_robot_launch.py +++ b/nav2_system_tests/src/system/test_multi_robot_launch.py @@ -16,6 +16,7 @@ import os import sys +from typing import TypedDict from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription, LaunchService @@ -27,6 +28,15 @@ from launch_testing.legacy import LaunchTestService +class RobotConfig(TypedDict): + """TypedDict for robot configuration.""" + + name: str + x_pose: float + y_pose: float + z_pose: float + + def generate_launch_description() -> LaunchDescription: map_yaml_file = os.getenv('TEST_MAP', '') world = os.getenv('TEST_WORLD', '') @@ -48,7 +58,7 @@ def generate_launch_description() -> LaunchDescription: ) # Names and poses of the robots - robots = [ + robots: list[RobotConfig] = [ {'name': 'robot1', 'x_pose': 0.0, 'y_pose': 0.5, 'z_pose': 0.01}, {'name': 'robot2', 'x_pose': 0.0, 'y_pose': -0.5, 'z_pose': 0.01}, ] @@ -183,11 +193,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return lts.run(ls) + return lts.run(ls) # type: ignore[no-untyped-call] if __name__ == '__main__': diff --git a/nav2_system_tests/src/system/test_system_launch.py b/nav2_system_tests/src/system/test_system_launch.py index e93efc9a646..a1b13bcbaef 100755 --- a/nav2_system_tests/src/system/test_system_launch.py +++ b/nav2_system_tests/src/system/test_system_launch.py @@ -155,11 +155,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/system/test_system_with_obstacle_launch.py b/nav2_system_tests/src/system/test_system_with_obstacle_launch.py index 8413da01458..095066ea739 100755 --- a/nav2_system_tests/src/system/test_system_with_obstacle_launch.py +++ b/nav2_system_tests/src/system/test_system_with_obstacle_launch.py @@ -165,11 +165,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py index 81ae8bd483c..bef573bca71 100755 --- a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py +++ b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py @@ -155,11 +155,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/system_failure/test_system_failure_launch.py b/nav2_system_tests/src/system_failure/test_system_failure_launch.py index b8735d3e515..592efbf007d 100755 --- a/nav2_system_tests/src/system_failure/test_system_failure_launch.py +++ b/nav2_system_tests/src/system_failure/test_system_failure_launch.py @@ -142,11 +142,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] output='screen', ) - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code diff --git a/nav2_system_tests/src/waypoint_follower/test_case_launch.py b/nav2_system_tests/src/waypoint_follower/test_case_launch.py index b3ed12cddb6..ebcd491c2ea 100755 --- a/nav2_system_tests/src/waypoint_follower/test_case_launch.py +++ b/nav2_system_tests/src/waypoint_follower/test_case_launch.py @@ -124,11 +124,11 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] name='tester_node', output='screen') - lts = LaunchTestService() - lts.add_test_action(ld, test1_action) + lts = LaunchTestService() # type: ignore[no-untyped-call] + lts.add_test_action(ld, test1_action) # type: ignore[no-untyped-call] ls = LaunchService(argv=argv) ls.include_launch_description(ld) - return_code = lts.run(ls) + return_code = lts.run(ls) # type: ignore[no-untyped-call] return return_code