Skip to content

Commit

Permalink
Copter: add bring-up and launch for Iris
Browse files Browse the repository at this point in the history
- Adapted from https://github.com/gazebosim/ros_gz_project_template.
- Update launch for macOS (separate server and gui for Gazebo).
- Update maintainer details.

Rename diff drive bridge yaml, remove extra clock entry

Add bringup for iris quadcopter
- Shorten name in interface to iris.

Add lift-drag and ardupilot plugins to example

Enable static code checks
- Enable static code checks in ardupilot_gz_gazebo
- Enable static code checks in ardupilot_gz_description
- Enable static code checks in ardupilot_gz_bringup
- Enable static code checks in ardupilot_gz_application
- Apply flake8 extend-ignore.
- Format launch files with black.
- Apply common linters.

Add iris bringup launch
- Compose the SITL and microROS agent launch with Gazebo and Rviz.

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed May 7, 2023
1 parent 1c3faf4 commit 8252bb6
Show file tree
Hide file tree
Showing 32 changed files with 2,306 additions and 1 deletion.
129 changes: 128 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,128 @@
# ardupilot_gz
# ardupilot_gz

Adapted from the [`ros_gz_project_template`](https://github.com/gazebosim/ros_gz_project_template) project integrating ROS 2 and Gazebo.

## Included packages

* `ardupilot_gz_description` - Contains the sdf description of the simulated
system and any other assets.

* `ardupilot_gz_gazebo` - Contains Gazebo specific code and configurations such
as system plugins.

* `ardupilot_gz_application` - Contains ROS 2 specific code and configuration.

* `ardupilot_gz_bringup` - Contains launch files and high level utilities.


## Install

### Dependencies

1. Install [ROS 2 Humble](https://docs.ros.org/en/humble/index.html)

1. Install [Gazebo Garden](https://gazebosim.org/docs/garden)

1. Install necessary tools

`sudo apt install python3-vcstool python3-colcon-common-extensions git wget`

### Usage

1. Create a workspace, for example:

```
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
```
1. Clone the project:
```
TBC
```
1. Set the Gazebo version to Garden:
```
export GZ_VERSION=garden
```
1. Install ROS dependencies
```
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -r -y -i
```
1. Build and install
```
cd ~/ros2_ws
colcon build --cmake-args -DBUILD_TESTING=ON
```
### Run
1. Source the workspace
`. ~/ros2_ws/install/setup.sh`
1. Launch the simulation
`ros2 launch ardupilot_gz_bringup bringup_iris.launch.py`
1. Launch the a GCS
`mavproxy.py --console --map`
1. Inspect topics
```bash
$ ros2 topic list
/ROS2_BatteryState0
/ROS2_NavSatFix0
/ROS2_Time
/clicked_point
/clock
/goal_pose
/initialpose
/iris/odometry
/joint_states
/parameter_events
/robot_description
/rosout
/tf
/tf_static
```
## Notes
1. Additional dependency
`ros_gz` has a dependency on `gps_msgs` included in
```bash
git clone https://github.com/swri-robotics/gps_umd.git -b ros2-devel
```
Add `COLCON_IGNORE` to `gpsd_client` as this package is not required and
will not build on macOS.
1. sdformat_urdf
On macOS the `robot_state_publisher` node cannot load the
`sdformat_urdf_plugin` plugin unless the
suffix is changed:
```bash
cd ./install/sdformat_urdf/lib
ln -s libsdformat_urdf_plugin.so libsdformat_urdf_plugin.dylib
```
1. Model URIs
The `<uri>` element must use the `package` prefix for resource to be located
by RViz.
10 changes: 10 additions & 0 deletions ardupilot_gz_application/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
# Match black line length (default 88).
max-line-length = 88
# Match black configuration where there are conflicts.
extend-ignore =
# Q000: Double quotes found but single quotes preferred
Q000,
# W503: Line break before binary operator
W503

23 changes: 23 additions & 0 deletions ardupilot_gz_application/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.5)
project(ardupilot_gz_application)

# --------------------------------------------------------------------------- #
# Find dependencies.
find_package(ament_cmake REQUIRED)

# --------------------------------------------------------------------------- #
# Build tests

if(BUILD_TESTING)
# Override default flake8 configuration.
set(ament_cmake_flake8_CONFIG_FILE ${CMAKE_SOURCE_DIR}/.flake8)

# Add linters.
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

# --------------------------------------------------------------------------- #
# Call last.

ament_package()
20 changes: 20 additions & 0 deletions ardupilot_gz_application/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ardupilot_gz_application</name>
<version>0.0.0</version>
<description>Application code for `ardupilot_gz`.</description>
<maintainer email="[email protected]">Rhys Mainwaring</maintainer>
<license>GPL-3.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>

10 changes: 10 additions & 0 deletions ardupilot_gz_bringup/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
# Match black line length (default 88).
max-line-length = 88
# Match black configuration where there are conflicts.
extend-ignore =
# Q000: Double quotes found but single quotes preferred
Q000,
# W503: Line break before binary operator
W503

40 changes: 40 additions & 0 deletions ardupilot_gz_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.5)
project(ardupilot_gz_bringup)

# --------------------------------------------------------------------------- #
# Find dependencies.
find_package(ament_cmake REQUIRED)

# --------------------------------------------------------------------------- #
# Install.

# Install project launch files.
install(
DIRECTORY
launch/
DESTINATION share/${PROJECT_NAME}/launch
)

# Install project configuration files.
install(
DIRECTORY
config/
DESTINATION share/${PROJECT_NAME}/config
)

# --------------------------------------------------------------------------- #
# Build tests.

if(BUILD_TESTING)
# Override default flake8 configuration.
set(ament_cmake_flake8_CONFIG_FILE ${CMAKE_SOURCE_DIR}/.flake8)

# Add linters.
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

# --------------------------------------------------------------------------- #
# Call last.

ament_package()
Loading

0 comments on commit 8252bb6

Please sign in to comment.