Skip to content

Commit

Permalink
Default to harmonic
Browse files Browse the repository at this point in the history
* And clean up instructions
* rosdep now resolves correctly

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored and srmainwaring committed May 29, 2024
1 parent fa54212 commit 4779c72
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@ The project is adapted from the [`ros_gz_project_template`](https://github.com/g
## Prerequisites

- Install [ROS 2 Humble](https://docs.ros.org/en/humble/index.html)
- Install [Gazebo Garden](https://gazebosim.org/docs/garden)
- Install [Gazebo Harmonic (recommended)](https://gazebosim.org/docs/harmonic) or [Gazebo Garden](https://gazebosim.org/docs/garden)
- Follow the [`Installing Build Dependencies`](https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_DDS#installing-build-dependencies) section of `AP_DDS`'s README

## Install

#### 1. Create a workspace folder

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

#### 2. Get the project source

```bash
cd ~/ros2_ws/src
wget https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos
vcs import --recursive < ros2_gz.repos
cd ~/ros2_ws
mkdir src
vcs import --input https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos --recursive src
```

#### 3. Set the Gazebo version to Garden:
#### 3. Set the Gazebo version to Harmonic or Garden:

It is recommended to put this in your `~/.bashrc` or equivalent file.

```bash
export GZ_VERSION=garden
export GZ_VERSION=harmonic
```

#### 4. Update ROS dependencies
Expand All @@ -52,14 +54,14 @@ cd ~/ros2_ws
source /opt/ros/humble/setup.bash
sudo apt update
rosdep update
rosdep install --rosdistro $ROS_DISTRO --from-paths src -i -r -y
rosdep install --from-paths src --ignore-src -y
```

#### 5. Build

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

#### 6. Test
Expand Down
4 changes: 2 additions & 2 deletions ardupilot_gz_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<exec_depend>ardupilot_sitl_models</exec_depend>
<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>ros_gz_sim</exec_depend>
<exec_depend>ros_gz_bridge</exec_depend>
<!-- TODO this installs ignition -->
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>sdformat_urdf</exec_depend>
<exec_depend>topic_tools</exec_depend>
Expand Down
8 changes: 4 additions & 4 deletions ardupilot_gz_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-common5 REQUIRED COMPONENTS profiler)
set(GZ_COMMON_VER ${gz-common5_VERSION_MAJOR})

# Garden (default)
if("$ENV{GZ_VERSION}" STREQUAL "garden" OR NOT DEFINED "ENV{GZ_VERSION}")
# Garden
if("$ENV{GZ_VERSION}" STREQUAL "garden")
gz_find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})

message(STATUS "Compiling against Gazebo Garden")
# Harmonic
elseif("$ENV{GZ_VERSION}" STREQUAL "harmonic")
# Harmonic (default)
elseif("$ENV{GZ_VERSION}" STREQUAL "harmonic" OR NOT DEFINED "ENV{GZ_VERSION}")
gz_find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})

Expand Down
6 changes: 3 additions & 3 deletions ardupilot_gz_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<depend>gz-cmake3</depend>
<depend>gz-plugin2</depend>

<!-- Garden (default) -->
<!-- Garden -->
<depend condition="$GZ_VERSION == garden">gz-sim7</depend>
<depend condition="$GZ_VERSION == ''">gz-sim7</depend>
<!-- Harmonic -->
<!-- Harmonic (default) -->
<depend condition="$GZ_VERSION == ''">gz-sim8</depend>
<depend condition="$GZ_VERSION == harmonic">gz-sim8</depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down

0 comments on commit 4779c72

Please sign in to comment.