Skip to content

Commit

Permalink
Tools: Expose map/console mavproxy args
Browse files Browse the repository at this point in the history
* These can be set in ros2 launch calls now

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored and tridge committed May 13, 2024
1 parent a7d4183 commit ebaedb3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
8 changes: 8 additions & 0 deletions Tools/ros2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ For example `ardurover` SITL may be launched with:
ros2 launch ardupilot_sitl sitl.launch.py command:=ardurover model:=rover
```

Other launch files are included with many arguments.
Some common arguments are exposed and forwarded to the underlying process.

For example, MAVProxy can be launched, and you can enable the `console` and `map`.
```bash
ros2 launch ardupilot_sitl sitl_mavproxy.launch.py map:=True console:=True
```

#### `ardupilot_dds_test`

A `colcon` package for testing communication between `micro_ros_agent` and the
Expand Down
42 changes: 31 additions & 11 deletions Tools/ros2/ardupilot_sitl/src/ardupilot_sitl/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,26 +286,36 @@ def generate_action(context: LaunchContext, *args, **kwargs) -> ExecuteProcess:
master = LaunchConfiguration("master").perform(context)
out = LaunchConfiguration("out").perform(context)
sitl = LaunchConfiguration("sitl").perform(context)
console = LaunchConfiguration("console").perform(context)
map = LaunchConfiguration("map").perform(context)

# Display launch arguments.
print(f"command: {command}")
print(f"master: {master}")
print(f"sitl: {sitl}")
print(f"out: {out}")
print(f"console: {console}")
print(f"map: {map}")

cmd = [
f"{command} ",
f"--out {out} ",
"--out ",
"127.0.0.1:14551 ",
f"--master {master} ",
f"--sitl {sitl} ",
"--non-interactive ",
]

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

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

# Create action.
mavproxy_process = ExecuteProcess(
cmd=[
[
f"{command} ",
f"--out {out} ",
"--out ",
"127.0.0.1:14551 ",
f"--master {master} ",
f"--sitl {sitl} ",
"--non-interactive ",
]
],
cmd=cmd,
shell=True,
output="both",
respawn=False,
Expand Down Expand Up @@ -355,6 +365,16 @@ def generate_launch_arguments() -> List[DeclareLaunchArgument]:
default_value="127.0.0.1:5501",
description="SITL output port.",
),
DeclareLaunchArgument(
"map",
default_value="False",
description="Enable MAVProxy Map.",
),
DeclareLaunchArgument(
"console",
default_value="False",
description="Enable MAVProxy Console.",
),
]


Expand Down

0 comments on commit ebaedb3

Please sign in to comment.