Skip to content

GitHub repository for comprehensive drone programming using SITL, ROS, mavros, and Gazebo simulation

License

Notifications You must be signed in to change notification settings

pratik7229/Autonomous_Drone_using_SITL_ROS_and-gazebo_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Autonomous Drone using SITL ROS and gazebo simulation

Drone Programming using mavros and ROS and simulation environments like SITL and Gazebo is a centralized repository that houses a wealth of information, including code snippets and installation instructions, for enthusiasts and developers interested in drone programming. This comprehensive resource covers essential topics such as SITL, Gazebo, ROS, mavros, DroneKit, pymavlink, and more. Whether you are a beginner seeking guidance on installations or an experienced developer looking for code examples, this repository is designed to cater to a wide range of needs in the drone programming community. Dive into the world of UAVs with confidence, leveraging the power of mavros and ROS in conjunction with realistic simulations provided by SITL and Gazebo.

Prerequisite Installation

mavros Installation

  • First update and upgrade the System (Ubuntu 20.04).
  sudo apt update
  sudo apt upgrade
  • Installing python3 and pip3.
    sudo apt-get install python-dev python-pip python3-dev python3-pip python3-rospkg
  • Install MAVProxy with pip in python2
    pip install MAVProxy
  • Use apt-get for installation, where ${ROS_DISTRO} below should resolve to noetic, depending on your version of ROS
    sudo apt-get install ros-${ROS_DISTRO}-mavros ros-${ROS_DISTRO}-mavros-extras ros-${ROS_DISTRO}-mavros-msgs
  • Then install GeographicLib (opens new window) datasets
  wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
  sudo bash ./install_geographiclib_datasets.sh   

SITL Installation

Setting up the build environment in Linux

  • First update and upgrade the System (Ubuntu 20.04).
  sudo apt update
  sudo apt upgrade
  • Install git to the computer.
  sudo apt-get install git gitk git-gui
  • Configure git to use HTTPS instead of git.
  git config --global url."https://github.com/".insteadOf git@github.com:
  git config --global url."https://".insteadOf git://
  • Clone the ardupilot repository from github.
  cd && git clone https://github.com/ArduPilot/ardupilot.git
  • Perform submodule updates.
  cd ardupilot/
  git submodule update --init --recursive
  • Install required packages.
  Tools/environment_install/install-prereqs-ubuntu.sh -y
  • Update profile.
  . ~/.profile
  • This will install all the required Linux system packages and python modules.
curl -s -L https://raw.githubusercontent.com/mustafa-gokce/ardupilot-software-development/main/environment-setup/quickstart.sh | /usr/bin/bash

Setting up the simulation software in Linux

  • Get into the ardupilot project directory.
cd && cd ardupilot/
  • Update profile.
. ~/.profile

Copter simulation in Linux

  • Go into the ArduCopter directory.
cd && cd ardupilot/ArduCopter/
  • Start the simulation with wiping the virtual EEPROM option to load correct parameters.
sim_vehicle.py -w
  • After simulation has started, press Ctrl+C and start the simulation normally.
sim_vehicle.py --console --map

Gazebo Installation

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
  • Setup keys:
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
  • Reload software list:
sudo apt update
  • Install Gazebo:
sudo apt-get install gazebo11 libgazebo11-dev

Install Gazebo plugin for APM (ArduPilot Master) :

cd ~
git clone https://github.com/khancyr/ardupilot_gazebo.git
cd ardupilot_gazebo
  • build and install plugin
mkdir build
cd build
cmake ..
make -j4
sudo make install
echo 'source /usr/share/gazebo/setup.sh' >> ~/.bashrc
  • Set paths for models:
echo 'export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models' >> ~/.bashrc
. ~/.bashrc

Run Simulator

NOTE the iris_arducopter_runway is not currently working in gazebo11.

  • In one Terminal (Terminal 1), run Gazebo:
gazebo --verbose ~/ardupilot_gazebo/worlds/iris_arducopter_runway.world
  • In another Terminal (Terminal 2), run SITL:
cd ~/ardupilot/ArduCopter/
sim_vehicle.py -v ArduCopter -f gazebo-iris --console
  • In another Terminal (Terminal 3), run mavros:
roslaunch mavros apm.launch fcu_url:=udp://:14550@

Screenshots

drone

  • After this Follow the Youtube Video Tutorials

About

GitHub repository for comprehensive drone programming using SITL, ROS, mavros, and Gazebo simulation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published