Where things live
~/ardupilot/ ← ArduPilot SITL
~/ardupilot_gazebo/ ← Gazebo plugin
1. Install ArduPilot
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule update --init --recursive
The big step — installing dependencies (Python, compilers):
# This script sets env vars and installs the needed packages
Tools/environment_install/install-prereqs-ubuntu.sh -y
Reload your terminal so the new PATH takes effect:
source ~/.bashrc
WARN! sim_vehicle.py is not on PATH. Add it manually:
echo 'export PATH=$PATH:$HOME/ardupilot/Tools/autotest' >> ~/.bashrc
source ~/.bashrc
which sim_vehicle.py
Go into the copter directory and build (first build is slow):
cd ArduCopter
sim_vehicle.py -w
The -w flag refreshes default drone schema. For prj — don’t use.
2. Run
sim_vehicle.py -w --console
Commands
| Command | What it does |
|---|---|
GUIDED |
Switches the drone to guided mode (required for commanded takeoff) |
arm throttle |
Disarms the safety and starts the motors |
takeoff [altitude] |
Take off to the given altitude in meters |
mode RTL |
Auto return to takeoff point + landing |
mode LAND |
Land at the current position |
status |
Prints the current state of all MAVLink parameters |
Mode change via MAVROS:
ros2 service call /mavros/set_mode \
mavros_msgs/srv/SetMode \
"{custom_mode: 'GUIDED'}"