Tools: ros2: Fix plane launch headless

* Install models for other users
* Fix bool parsing in some launch args
This commit is contained in:
Ryan Friedman 2024-05-22 01:02:25 -07:00 committed by Randy Mackay
parent a1e612c9ee
commit b7721f5eda
2 changed files with 17 additions and 6 deletions

View File

@ -79,6 +79,12 @@ install(DIRECTORY
DESTINATION share/${PROJECT_NAME}/config/ DESTINATION share/${PROJECT_NAME}/config/
) )
# Install additional autotest model params.
install(DIRECTORY
${ARDUPILOT_ROOT}/Tools/autotest/models
DESTINATION share/${PROJECT_NAME}/config/
)
# Install Python package. # Install Python package.
ament_python_install_package(${PROJECT_NAME} ament_python_install_package(${PROJECT_NAME}
PACKAGE_DIR src/${PROJECT_NAME} PACKAGE_DIR src/${PROJECT_NAME}

View File

@ -31,6 +31,9 @@ from launch_ros.substitutions import FindPackageShare
from .actions import ExecuteFunction from .actions import ExecuteFunction
TRUE_STRING = "True"
FALSE_STRING = "False"
BOOL_STRING_CHOICES = set([TRUE_STRING, FALSE_STRING])
class VirtualPortsLaunch: class VirtualPortsLaunch:
"""Launch functions for creating virtual ports using `socat`.""" """Launch functions for creating virtual ports using `socat`."""
@ -307,10 +310,10 @@ class MAVProxyLaunch:
"--non-interactive ", "--non-interactive ",
] ]
if console: if console == TRUE_STRING:
cmd.append("--console ") cmd.append("--console ")
if map: if map == TRUE_STRING:
cmd.append("--map ") cmd.append("--map ")
# Create action. # Create action.
@ -369,11 +372,13 @@ class MAVProxyLaunch:
"map", "map",
default_value="False", default_value="False",
description="Enable MAVProxy Map.", description="Enable MAVProxy Map.",
choices=BOOL_STRING_CHOICES
), ),
DeclareLaunchArgument( DeclareLaunchArgument(
"console", "console",
default_value="False", default_value="False",
description="Enable MAVProxy Console.", description="Enable MAVProxy Console.",
choices=BOOL_STRING_CHOICES
), ),
] ]
@ -419,12 +424,12 @@ class SITLLaunch:
# Optional arguments. # Optional arguments.
wipe = LaunchConfiguration("wipe").perform(context) wipe = LaunchConfiguration("wipe").perform(context)
if wipe == "True": if wipe == TRUE_STRING:
cmd_args.append("--wipe ") cmd_args.append("--wipe ")
print(f"wipe: {wipe}") print(f"wipe: {wipe}")
synthetic_clock = LaunchConfiguration("synthetic_clock").perform(context) synthetic_clock = LaunchConfiguration("synthetic_clock").perform(context)
if synthetic_clock == "True": if synthetic_clock == TRUE_STRING:
cmd_args.append("--synthetic-clock ") cmd_args.append("--synthetic-clock ")
print(f"synthetic_clock: {synthetic_clock}") print(f"synthetic_clock: {synthetic_clock}")
@ -586,13 +591,13 @@ class SITLLaunch:
"wipe", "wipe",
default_value="False", default_value="False",
description="Wipe eeprom.", description="Wipe eeprom.",
choices=["True", "False"], choices=BOOL_STRING_CHOICES,
), ),
DeclareLaunchArgument( DeclareLaunchArgument(
"synthetic_clock", "synthetic_clock",
default_value="False", default_value="False",
description="Set synthetic clock mode.", description="Set synthetic clock mode.",
choices=["True", "False"], choices=BOOL_STRING_CHOICES,
), ),
DeclareLaunchArgument( DeclareLaunchArgument(
"home", "home",