Skip to content
7 changes: 5 additions & 2 deletions nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions nav2_bringup/launch/tb3_loopback_simulation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions nav2_bringup/launch/tb4_loopback_simulation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
15 changes: 14 additions & 1 deletion nav2_bringup/launch/unique_multi_tb3_simulation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,14 +37,26 @@
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')
launch_dir = os.path.join(bringup_dir, 'launch')
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,
Expand Down
2 changes: 1 addition & 1 deletion nav2_common/nav2_common/launch/has_node_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion nav2_common/nav2_common/launch/launch_config_as_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'.

Expand Down
8 changes: 4 additions & 4 deletions nav2_common/nav2_common/launch/replace_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion nav2_common/nav2_common/launch/rewritten_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions nav2_costmap_2d/test/integration/costmap_tests_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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__':
Expand Down
6 changes: 3 additions & 3 deletions nav2_docking/opennav_docking/test/test_docking_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
])


Expand Down Expand Up @@ -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]
8 changes: 4 additions & 4 deletions nav2_lifecycle_manager/test/launch_bond_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
8 changes: 4 additions & 4 deletions nav2_lifecycle_manager/test/launch_lifecycle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
6 changes: 3 additions & 3 deletions nav2_map_server/test/component/test_map_saver_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
6 changes: 3 additions & 3 deletions nav2_map_server/test/component/test_map_server_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
16 changes: 8 additions & 8 deletions nav2_simple_commander/launch/route_example_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions nav2_system_tests/src/costmap_filters/test_keepout_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading
Loading