Testing development code on a flying platform is always risky, one small bug in the code could cause your beloved airframe go straight into the bin. To avoid that, always check your code stability in simulation. And the PX4 Software In the Loop (SIL) simulation is the perfect solution.
SIL uses your computer hardware to run PX4 firmware, therefore it will not behave exactly the same as your flight controller board in some cases. However it is similar enough for testing code stability. The recommended simulation software for multicopter is jMAVsim.
A quick summary:
- Preparation, equipment
- Download QGroundControl daily build (optional)
- Make SIL firmware
- Connect to QGroundControl and run an example mission
- Connect joystick and calibrate (optional)
- Disarm and fly
1. Preparation, equipment
To start SIL on Ubuntu, you need to set up the PX4 development environment correctly. Follow the steps in this link if you have not done so: PX4 development environment
You should also acquire a joystick. This is due to the fact that I haven’t found if there exists a command to control PWM values for each channel in SIL. Maybe there is, but anyway, a joystick simulates manual flight much better. Preferably a RC simulator transmitter, like the ESKY Simulator FMS: