ardupilot/Tools/ros2/ardupilot_sitl/launch/sitl_dds_udp.launch.py
Rhys Mainwaring 21ea0d9794 Tools: ROS 2 update launch scripts and tests
Add launch module to ardupilot_sitl package
- Move body of launch scripts into package for reuse.
- Add utilities module.

Update launch scripts
- Provide type hints.
- Add arguments to sitl.launch.py.
- Fix formatting bug in sitl.launch.py home argument.

Update micro_ros_agent launch script
- Modify import for lauch_ros.actions.Node.
- Change argument order in node initialiser.
- Add args for UDP transport and set as default.

Update ROS 2 DDS default params
- Add default params for both serial and UDP transports.
- Add DDS_ENABLE.

Rename ROS 2 sitl_dds launch script
- Rename sitl_dds launch script with serial suffix.
- Add launch script for UDP transport.

Update ROS 2 launch test fixtures
- Make common test fixtures more granular.
- Add fixtures and tests for UDP transport.
- Update ROS 2 package.xml dependencies
- Use yield rather than return in test fixtures.
- Use ardupilot_sitl launch module directly.
- Correct return type descriptions.
- Fix flake8 failure.

Update ROS 2 README
- Update launch instructions.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
2023-05-12 07:11:25 +10:00

81 lines
2.4 KiB
Python

# Copyright 2023 ArduPilot.org.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
Launch ArduPilot SITL, MAVProxy and the microROS DDS agent.
Run with default arguments:
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py
"""
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
def generate_launch_description() -> LaunchDescription:
"""Generate a launch description to bring up ArduPilot SITL with DDS."""
# Compose launch files.
micro_ros_agent = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
PathJoinSubstitution(
[
FindPackageShare("ardupilot_sitl"),
"launch",
"micro_ros_agent.launch.py",
]
),
]
)
)
sitl = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
PathJoinSubstitution(
[
FindPackageShare("ardupilot_sitl"),
"launch",
"sitl.launch.py",
]
),
]
)
)
mavproxy = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
PathJoinSubstitution(
[
FindPackageShare("ardupilot_sitl"),
"launch",
"mavproxy.launch.py",
]
),
]
)
)
return LaunchDescription(
[
micro_ros_agent,
sitl,
mavproxy,
]
)