Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: ros2: Improve ability to launch plane in headless mode #27131

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Tools/ros2/ardupilot_sitl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ install(DIRECTORY
DESTINATION share/${PROJECT_NAME}/config/
)

# Install additional autotest model params.
install(DIRECTORY
${ARDUPILOT_ROOT}/Tools/autotest/models
Ryanf55 marked this conversation as resolved.
Show resolved Hide resolved
DESTINATION share/${PROJECT_NAME}/config/
)

# Install Python package.
ament_python_install_package(${PROJECT_NAME}
PACKAGE_DIR src/${PROJECT_NAME}
Expand Down
17 changes: 11 additions & 6 deletions Tools/ros2/ardupilot_sitl/src/ardupilot_sitl/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

from .actions import ExecuteFunction

TRUE_STRING = "True"
FALSE_STRING = "False"
BOOL_STRING_CHOICES = set([TRUE_STRING, FALSE_STRING])

class VirtualPortsLaunch:
"""Launch functions for creating virtual ports using `socat`."""
Expand Down Expand Up @@ -307,10 +310,10 @@ def generate_action(context: LaunchContext, *args, **kwargs) -> ExecuteProcess:
"--non-interactive ",
]

if console:
if console == TRUE_STRING:
cmd.append("--console ")

if map:
if map == TRUE_STRING:
cmd.append("--map ")

# Create action.
Expand Down Expand Up @@ -369,11 +372,13 @@ def generate_launch_arguments() -> List[DeclareLaunchArgument]:
"map",
default_value="False",
description="Enable MAVProxy Map.",
choices=BOOL_STRING_CHOICES
),
DeclareLaunchArgument(
"console",
default_value="False",
description="Enable MAVProxy Console.",
choices=BOOL_STRING_CHOICES
),
]

Expand Down Expand Up @@ -419,12 +424,12 @@ def generate_action(context: LaunchContext, *args, **kwargs) -> ExecuteProcess:

# Optional arguments.
wipe = LaunchConfiguration("wipe").perform(context)
if wipe == "True":
if wipe == TRUE_STRING:
cmd_args.append("--wipe ")
print(f"wipe: {wipe}")

synthetic_clock = LaunchConfiguration("synthetic_clock").perform(context)
if synthetic_clock == "True":
if synthetic_clock == TRUE_STRING:
cmd_args.append("--synthetic-clock ")
print(f"synthetic_clock: {synthetic_clock}")

Expand Down Expand Up @@ -586,13 +591,13 @@ def generate_launch_arguments() -> List[DeclareLaunchArgument]:
"wipe",
default_value="False",
description="Wipe eeprom.",
choices=["True", "False"],
choices=BOOL_STRING_CHOICES,
),
DeclareLaunchArgument(
"synthetic_clock",
default_value="False",
description="Set synthetic clock mode.",
choices=["True", "False"],
choices=BOOL_STRING_CHOICES,
),
DeclareLaunchArgument(
"home",
Expand Down
Loading