Ardupilot SITL - Aeroclub-IITM/Installation-SITL-Gazebo-ROS GitHub Wiki
SITL installation
Follow the steps in this site with reading the instructions below :
-
GUI tools not required.
-
Clone main ardupilot repo.
-
Instead of .bashrc part you need to use .zshrc because we ran this script and made our terminal zsh.
-
Do build using build.md( Waf )
https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html
Some dependencies that might be missing
sudo pip install -U pymavlink MAVProxy
conda install wxpython
sudo apt-get install libcanberra-gtk-module
Ardupilot-gazebo Plugin
Follow the steps in this site with reading the instructions below -
-
In the plugin installation part they mentioned about two : khancyr and SwiftGust. Follow the SwiftGust part.Read their readme and follow their steps.Plugins are additional part of the softwares which give a software some extra features. Here gazebo simulation wants this plugin to make the drone in it react to the wills of FC.
-
You are required to install gazebo 9.So replace with
sudo apt-get install libgazebo9-dev
- Important : Change the github branch you are in. If you using gazebo 9 then you have to change it to gazebo9 branch from main. Git clone the repo then by git clone https://github.com/SwiftGust/ardupilot_gazebo.git.
Then follow these cammands instead of those in site-
cd ardupilot_gazebo
git checkout gazebo9
mkdir build
cd build
cmake ..
make -j4
sudo make install
4.After completing SwiftGust installation return to your original page where there is instructions to launch them. There in Start the Simulator instead of gazebo --verbose worlds/iris_arducopter_runway.world run gazebo --verbose worlds/iris_ardupilot.world
If error comes in gazebo window after running opening an empty world while trying to run gazebo_sitl , then be sure you have these three lines in your .zshrc file.
source /usr/share/gazebo/setup.sh
export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/gazebo_models
export GAZEBO_RESOURCE_PATH=~/ardupilot_gazebo/gazebo_worlds:${GAZEBO_RESOURCE_PATH}
And source them using
source ~/.zshrc
Then run the command
gazebo --verbose iris_ardupilot.world
.
After getting SITL and Gazebo window with a drone in it, type help in SITL window.You will see various options and commands in SITL.Try to control drone with those.
Install QGC( Qground Control).
Download from this site
To open the software -.
cd <directory it is in>
./QGroundControl.AppImage.
You will see a drone is connected to it.This is because your SITL gives all data to QGC. Now try to arm and takeoff with QGC and observe gazebo.
Mavros installation
Follow this site for installing mavros.
In case you are getting errors like these during catkin build after installing mavros, uninstall mavros and do source installation.
If that also fails ,then :
Delete mavros and mavlink folders.
cd catkin_ws
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream-development --deps mavros | tee -a /tmp/mavros.rosinstall
Then proceed with step3 of source installation.
If you can see all the outputs i have mentioned you are successful with the installation part.