3. Install Gazebo plugins
cd ~
git clone https://github.com/ArduPilot/ardupilot_gazebo.git
cd ~/ardupilot_gazebo
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
Install gstreamer:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
Plugin built successfully! Add the paths:
echo 'export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/ardupilot_gazebo/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}' >> ~/.bashrc
echo 'export GZ_SIM_RESOURCE_PATH=$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:${GZ_SIM_RESOURCE_PATH}' >> ~/.bashrc
source ~/.bashrc
ls ~/ardupilot_gazebo/models
We see ready-made models — iris_with_ardupilot.
gz sim ~/ardupilot_gazebo/worlds/iris_runway.sdf -r
The -r flag runs the simulation — same as pushing play in the Gazebo layout.
Connecting SITL to Gazebo
Open a new terminal:
cd ~/ardupilot/ArduCopter
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
Breakdown:
-f gazebo-iris— use the iris model for Gazebo--model JSON— SITL talks to Gazebo via the JSON protocol
If Gazebo doesn’t render (GeForce GPU)
sudo nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
Data flow
gz sim (body)
↕ UDP 9002/9003
sim_vehicle.py (brain)
↕ ros_gz_bridge (translator)
sensor_monitor.py (our code)