Skip to content

Commit

Permalink
Tools: update README to follow ArduPilot Wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-fuoco committed Nov 7, 2024
1 parent a0850d7 commit 808605d
Showing 1 changed file with 1 addition and 157 deletions.
158 changes: 1 addition & 157 deletions Tools/ros2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,163 +36,7 @@ ArduPilot `AP_DDS` client library.

## Prerequisites

The packages depend on:

- [ROS 2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)


## Install Ubuntu

#### 1. Create a workspace folder

```bash
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
```

The ROS 2 tutorials contain more details regarding [ROS 2 workspaces](https://docs.ros.org/en/humble/Tutorials/Workspace/Creating-A-Workspace.html).

#### 2. Get the `ros2.repos` file

```bash
cd ~/ros2_ws/src
wget https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2.repos
vcs import --recursive < ros2.repos
```

#### 3. Update dependencies

```bash
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
sudo apt update
rosdep update
rosdep install --rosdistro ${ROS_DISTRO} --from-paths src
```

#### 4. Build

Check that the [ROS environment](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#check-environment-variables) is configured correctly:

```bash
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_DISTRO=humble
```

```bash
cd ~/ros2_ws
colcon build --cmake-args -DBUILD_TESTING=ON
```

#### 5. Test

```bash
source ./install/setup.bash
colcon test --packages-select ardupilot_dds_tests
colcon test-result --all --verbose
```

To debug a specific test, you can do the following:
```
colcon --log-level DEBUG test --packages-select ardupilot_dds_tests --event-handlers=console_direct+ --pytest-args -k test_dds_udp_geopose_msg_recv -s
```

## Install macOS

The install procedure on macOS is similar, except that all dependencies
must be built from source and additional compiler flags are needed.

#### 1. Create a workspace folder

```bash
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
```

#### 2. Get the `ros2_macos.repos` file

The `ros2_macos.repos` includes additional dependencies to build:

```bash
cd ~/ros2_ws/src
wget https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2_macos.repos
vcs import --recursive < ros2_macos.repos
```

#### 3. Update dependencies

```bash
cd ~/ros2_ws
source /{path_to_your_ros_distro_workspace}/install/setup.zsh
```

#### 4.1. Build microxrcedds_gen:

```bash
cd ~/ros2_ws/src/microxrcedds_gen
./gradlew assemble
export PATH=$PATH:$(pwd)/scripts
```

#### 4.2. Build colcon projects

```bash
colcon build --symlink-install --cmake-args \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_MACOSX_RPATH=FALSE \
-DUAGENT_SOCKETCAN_PROFILE=OFF \
-DUAGENT_LOGGER_PROFILE=OFF \
-DUAGENT_USE_SYSTEM_LOGGER=OFF \
-DUAGENT_USE_SYSTEM_FASTDDS=ON \
-DUAGENT_USE_SYSTEM_FASTCDR=ON \
--event-handlers=desktop_notification-
```

#### 5. Test

```bash
colcon test \
--pytest-args -s -v \
--event-handlers console_cohesion+ desktop_notification- \
--packages-select ardupilot_dds_tests
```

## Install Docker

#### 0. Build the image and run the container

Clone the ArduPilot docker project:

```bash
git clone https://github.com/ArduPilot/ardupilot_dev_docker.git
```

Build the container:

```bash
cd ~/ardupilot_dev_docker/docker
docker build -t ardupilot/ardupilot-dev-ros -f Dockerfile_dev-ros .
```

Start the container in interactive mode:

```bash
docker run -it --name ardupilot-dds ardupilot/ardupilot-dev-ros
```

Connect another bash process to the running container:

```bash
docker container exec -it ardupilot-dds /bin/bash
```

The remaining steps 1 - 5 are the same as for Ubuntu. You may need to
install MAVProxy if it is not available on the container.


```bash
pip install -U MAVProxy
```
Follow the installation instructions in the [ArduPilot Wiki](https://ardupilot.org/dev/docs/ros2.html)


## Test details
Expand Down

0 comments on commit 808605d

Please sign in to comment.