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

AP_UROS: add micro-ROS client #25154

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@
path = modules/Micro-CDR
url = https://github.com/ardupilot/Micro-CDR.git
branch = master
[submodule "modules/ardupilot_uros"]
path = modules/ardupilot_uros
url = https://github.com/srmainwaring/ardupilot_uros.git
1 change: 1 addition & 0 deletions Tools/ardupilotwaf/ardupilotwaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def get_legacy_defines(sketch_name, bld):
'doc',
'AP_Scripting', # this gets explicitly included when it is needed and should otherwise never be globbed in
'AP_DDS',
'AP_UROS',
]


Expand Down
12 changes: 12 additions & 0 deletions Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ def srcpath(path):
env.ENABLE_DDS = False
env.DEFINES.update(AP_DDS_ENABLED = 0)

# configurations for UROS
if cfg.options.enable_uros:
cfg.recurse('libraries/AP_UROS')
env.ENABLE_UROS = True
env.AP_LIBRARIES += [
'AP_UROS'
]
env.DEFINES.update(AP_UROS_ENABLED = 1)
else:
env.ENABLE_UROS = False
env.DEFINES.update(AP_UROS_ENABLED = 0)

# setup for supporting onvif cam control
if cfg.options.enable_onvif:
cfg.recurse('libraries/AP_ONVIF')
Expand Down
5 changes: 5 additions & 0 deletions Tools/autotest/sim_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ def do_build(opts, frame_options):
if opts.enable_dds:
cmd_configure.append("--enable-dds")

if opts.enable_uros:
cmd_configure.append("--enable-uros")

pieces = [shlex.split(x) for x in opts.waf_configure_args]
for piece in pieces:
cmd_configure.extend(piece)
Expand Down Expand Up @@ -1326,6 +1329,8 @@ def generate_frame_help():
help="IP address of the simulator. Defaults to localhost")
group_sim.add_option("--enable-dds", action='store_true',
help="Enable the dds client to connect with ROS2/DDS")
group_sim.add_option("--enable-uros", action='store_true',
help="Enable the micro-ros client to connect with ROS2/DDS")

parser.add_option_group(group_sim)

Expand Down
24 changes: 22 additions & 2 deletions Tools/ros2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,28 @@ master:=tcp:127.0.0.1:5760 \
sitl:=127.0.0.1:5501
```

UDP version
### DDS UDP version

```
```bash
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 refs:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/dds_xrce_profile.xml synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501
```

### UROS UDP

Launch agent:

```bash
ros2 launch ardupilot_sitl micro_ros_agent.launch.py transport:=udp4 port:=2019 verbose:=6
```

Launch SITL:

```bash
ros2 launch ardupilot_sitl sitl.launch.py synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1
```

Launch non-interactive MAVProxy:

```bash
ros2 launch ardupilot_sitl mavproxy.launch.py master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501
```
4 changes: 2 additions & 2 deletions Tools/ros2/ardupilot_sitl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ message(STATUS "WAF_COMMAND: ${WAF_COMMAND}")
set(WAF_CONFIG $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:"--debug">)

add_custom_target(ardupilot_configure ALL
${WAF_COMMAND} configure --board sitl --enable-dds ${WAF_CONFIG}
${WAF_COMMAND} configure --board sitl --enable-uros ${WAF_CONFIG}
WORKING_DIRECTORY ${ARDUPILOT_ROOT}
)

add_custom_target(ardupilot_build ALL
${WAF_COMMAND} build --enable-dds ${WAF_CONFIG}
${WAF_COMMAND} build --enable-uros ${WAF_CONFIG}
WORKING_DIRECTORY ${ARDUPILOT_ROOT}
)
add_dependencies(ardupilot_build ardupilot_configure)
Expand Down
Loading