Ardupilot SITL with ROS2 and Gazebo - ashBabu/Utilities GitHub Wiki

I could not get it working but there are several individual parts were working.

Installation

Some important links for installation. Official, One. My post. Install dependencies

  • sudo apt install default-jre

  • git clone --recurse-submodules https://github.com/eProsima/Micro-XRCE-DDS-Gen.git

  • cd Micro-XRCE-DDS-Gen

  • ./gradlew assemble

  • export PATH=$PATH:/home/ash/Ash/repo/Micro-XRCE-DDS-Gen/scripts/

  • cd ~/ros2_ws

  • wget https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos

  • vcs import --recursive src < ros2_gz.repos

  • Inside src, ./ardupilot/Tools/environment_install/install-prereqs-ubuntu.sh -y

  • . ~/.profile

  • cd ardupilot/ArduCopter

  • sim_vehicle.py -w

  • sim_vehicle.py --console --map --console --osd

  • pip install --upgrade pymavlink MAVProxy --user

optional

  • Flightgear *sudo apt-get install flightgear

  • cd /ardupilot/Tools/autotest/: fg_plane_view.sh (Plane) or fg_quad_view.sh (Copter).

  • sim_vehicle.py -L KSFO #######

  • sudo apt install ros-humble-micro-ros-msgs

  • sudo apt install ros-humble-geographic-msgs

Install gazebo garden

  • 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 -y gz-garden
  • sudo apt install python-is-python3
  • sudo snap install micro-xrce-dds-agent
  • git clone https://github.com/eProsima/Micro-XRCE-DDS-Client.git
  • cd Micro-XRCE-DDS-Client
  • mkdir build && cd build
  • cmake ..
  • make
  • sudo make install

What works from here

  • Source your ros2_ws, gz sim -v4 -r zephyr_runway.sdf
  • sim_vehicle.py -v ArduPlane -f gazebo-zephyr --model JSON --map --console