ArduPilot / ardupilot_gz

Tools for ArduPilot ROS2 integration and testing on ROS 2 humble
GNU General Public License v3.0
31 stars 22 forks source link

Support launching gazebo sim to visualize vehicle #2

Closed Ryanf55 closed 1 year ago

Ryanf55 commented 1 year ago
srmainwaring commented 1 year ago

There is an initial version of a bring-up package for an ArduPilot / microROS DDS / ROS 2 / Gazebo system here:

The system can be brought up by a single launch file:

ros2 launch ardupilot_gz_bringup bringup_iris.launch.py

Run a interactive MAVProxy session:

mavproxy.py --console --map

The topics published by ArduPilot may be inspected with:

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
srmainwaring commented 1 year ago

Moved code to new repo: https://github.com/srmainwaring/ardupilot_gz/pull/1

Docker image

Notes for running the ardupilot_gz packages on the docker image Dockerfile_dev-ros.

The image is configured for CI and requires additional packages to be used with Gazebo (in server only mode).

Summary

Details

Install gz-garden and libsdformat12-dev

sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

sudo apt-get update
sudo apt-get install gz-garden
sudo apt install libsdformat12-dev

Install dependencies for ardupilot_gazebo

sudo apt install rapidjson-dev

Install dependencies for ros_gz

sudo apt install libgflags-dev
sudo apt install ros-humble-ament-cmake-mypy
sudo apt install ros-humble-image-transport
sudo apt install ros-humble-image-transport-plugins

Since ROS 2 Humble and Gazebo Garden is not an officially supported combination, rosdep is not able to resolve all the required dependencies:

rosdep check --from-paths src
System dependencies have not been satisfied:
apt ros-humble-ros-gz-bridge
apt ros-humble-ros-gz-sim
apt ros-humble-ros-gz-sim-demos
apt ros-humble-ros-gz-image
apt libgflags-dev
apt ros-humble-ament-cmake-mypy
apt ros-humble-ament-cmake-pclint
apt ros-humble-ament-cmake-pycodestyle
apt ros-humble-image-transport
apt ros-humble-image-transport-plugins
apt ros-humble-rqt-image-view
apt ros-humble-rqt-plot
apt ros-humble-rqt-topic
apt ros-humble-rviz2
apt ros-humble-sdformat-urdf
apt ros-humble-xacro
apt ros-humble-sdformat-test-files
apt ros-humble-gps-msgs
apt ros-humble-ros-gz-interfaces
ERROR[ros_gz_sim]: Cannot locate rosdep definition for [gz-math7]
    rosdep key : gz-math7
    OS name    : ubuntu
    OS version : jammy
    Data:
<no data>
ERROR[ros_gz_image]: Cannot locate rosdep definition for [gz-transport12]
    rosdep key : gz-transport12
    OS name    : ubuntu
    OS version : jammy
    Data:
<no data>
ERROR[ros_gz_sim_demos]: Cannot locate rosdep definition for [gz-sim7]
    rosdep key : gz-sim7
    OS name    : ubuntu
    OS version : jammy
    Data:
<no data>
ERROR[ros_gz_bridge]: Cannot locate rosdep definition for [gz-transport12]
    rosdep key : gz-transport12
    OS name    : ubuntu
    OS version : jammy
    Data:
<no data>
Ryanf55 commented 1 year ago

Moved code to new repo: https://github.com/srmainwaring/ardupilot_gz/pull/1

Docker image

Notes for running the ardupilot_gz packages on the docker image Dockerfile_dev-ros.

The image is configured for CI and requires additional packages to be used with Gazebo (in server only mode).

Summary

  • [ ] Install Gazebo Garden.
  • [ ] Install libsdformat12-dev.
  • [ ] Install rapidjson-dev.
  • [ ] Install libgflags-dev, ros-humble-ament-cmake-mypy, ros-humble-image-transport, ros-humble-image-transport-plugins.

Details

Install gz-garden and libsdformat12-dev

sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null

sudo apt-get update
sudo apt-get install gz-garden
sudo apt install libsdformat12-dev

Install dependencies for ardupilot_gazebo

sudo apt install rapidjson-dev

Install dependencies for ros_gz

sudo apt install libgflags-dev
sudo apt install ros-humble-ament-cmake-mypy
sudo apt install ros-humble-image-transport
sudo apt install ros-humble-image-transport-plugins

Since ROS 2 Humble and Gazebo Garden is not an officially supported combination, rosdep is not able to resolve all the required dependencies:

rosdep check --from-paths src
System dependencies have not been satisfied:
apt   ros-humble-ros-gz-bridge
apt   ros-humble-ros-gz-sim
apt   ros-humble-ros-gz-sim-demos
apt   ros-humble-ros-gz-image
apt   libgflags-dev
apt   ros-humble-ament-cmake-mypy
apt   ros-humble-ament-cmake-pclint
apt   ros-humble-ament-cmake-pycodestyle
apt   ros-humble-image-transport
apt   ros-humble-image-transport-plugins
apt   ros-humble-rqt-image-view
apt   ros-humble-rqt-plot
apt   ros-humble-rqt-topic
apt   ros-humble-rviz2
apt   ros-humble-sdformat-urdf
apt   ros-humble-xacro
apt   ros-humble-sdformat-test-files
apt   ros-humble-gps-msgs
apt   ros-humble-ros-gz-interfaces
ERROR[ros_gz_sim]: Cannot locate rosdep definition for [gz-math7]
  rosdep key : gz-math7
  OS name    : ubuntu
  OS version : jammy
  Data:
<no data>
ERROR[ros_gz_image]: Cannot locate rosdep definition for [gz-transport12]
  rosdep key : gz-transport12
  OS name    : ubuntu
  OS version : jammy
  Data:
<no data>
ERROR[ros_gz_sim_demos]: Cannot locate rosdep definition for [gz-sim7]
  rosdep key : gz-sim7
  OS name    : ubuntu
  OS version : jammy
  Data:
<no data>
ERROR[ros_gz_bridge]: Cannot locate rosdep definition for [gz-transport12]
  rosdep key : gz-transport12
  OS name    : ubuntu
  OS version : jammy
  Data:
<no data>

The fact that the GZ rosdep keys will never resolve is actually pretty annoying. If we want to run this in CI, we could add the --skip-keys arguments, and then remove -r to enfoce our package.xml's work here.

srmainwaring commented 1 year ago

Closing: we have not added a plane, but the two copter examples demonstrate the procedure for adding further vehicles.