Ardupilot Setup
SITL + ArduPilot + Gazebo + ROS Camera Plugin (Software In Loop Simulation Interfaces, Models)
Requirements :
Ubuntu (20.04 LTS) Full 3D graphics hight recommended.
Gazebo version 11
ROS Noetic (Required to work with Gazebo)
MAVROS
Dependencies for building packages
MAVROS installation :
MAVLink extendable communication node for ROS with proxy for Ground Control Station (See original instructions here).
Configure your Ubuntu repositories
For ease of use on a desktop computer, please also install RQT
Install catkin tools
Now that we have everything correctly installed we can begin our system configuration
Environment setup and configuration :
STEP 1 - SITL Ardupilot
STEP 2 - Ardupilot gazebo plugin (Original khancyr version)
STEP 3 - Gazebo ROS plugin (roscam)
STEP 4 - Connect ArduPilot to ROS
SETP 1 - SITL Ardupilot installation :
Instructions taken from ardupilot.org (See original instructions here).
Clone ArduPilot repository
Install some required packages
If you are on a debian based system (such as Ubuntu or Mint), we provide a script that will do it for you. From ardupilot directory :
Reload the path (log-out and log-in to make permanent):
Finalize and test the installation
To start the simulator first change directory to the vehicle directory. For example, for the multicopter code change to ardupilot/ArduCopter:
Then start the simulator using sim_vehicle.py. The first time you run it you should use the -w option to wipe the virtual EEPROM and load the right default parameters for your vehicle.
Updating MAVProxy and pymavlink
New versions of MAVProxy and pymavlink are released quite regularly. If you are a regular SITL user you should update every now and again using this command
This concludes the first step SITL Ardupilot installation.
SETP 2 - Ardupilot gazebo plugin installation :
(See original instructions here).
Clone ArduPilot repository
Set environment variables
Set Path of Gazebo Models (Adapt the path to where to clone the repo)
Set Path of Gazebo Worlds (Adapt the path to where to clone the repo)
Set Path of Ardupilot
Reload the path (log-out and log-in to make permanent):
Test installation
Open one Terminal and launch SITL Ardupilot
Open a second Terminal and launch Gazebo running ardupilot_gazebo plugin
You should see a gazebo world with a small quadcopter right at the center
SETP 3 - Gazebo ROS plugin (roscam) :
This contains the ROS integrated custom models and .world files for Gazebo
Clone Gazebo roscam integrated mdodel repository
SETP 4 - Connect ArduPilot to ROS using MAVROS :
Connect to Ardupilot from ROS (Ardupilot <–> MAVLink <–> ROS ) Original information taken from here Note - Gazebo is not included in MAVROS so you cannot connect or access any of the Gazebo's Environments.
Setup MAVROS
New versions of MAVProxy and pymavlink are released quite regularly. If you are a regular SITL user you should update every now and again using this command
Test
Run it all
Launch Gazebo
Open one Terminal and launch ROS integrated Gazebo
Launch SITL Ardupilot
Open a second Terminal and launch SITL Ardupilot
Subscribe to the virtual roscam feed
Open a third Terminal and RTL
Select Plugins -> Visualization -> Image View
Then choose /roscam/cam/image_raw
You should see the live feed from inside gazebo
Final notes and comments
You can use any GCS Adrupilot software to control the UAV.
Troubleshooting
1. udp0: sendto: Invalid argument mavros
Please check this blog
2. link 1 down, even after launching ardupilot_gazebo
Check X-Terminal's Output (if two X-Terminals open). The only remedy I could find was to reinstall ardupilot SITL and ardupilot_gazebo
3. Could not find a package configuration file provided by "mavros" with any of the following names: mavrosConfig.cmake mavros-config.cmake
Follow the installation mentioned in this link
Last updated