The first thing to do before more in-depth research is to actually use PX4 autopilot to fly something. This is a relatively straight forward process once you have a multicopter that is healthy and ready for the sky.
Here is a step by step guide on how to flash px4 firmware onto your autopilot hardware and fly your multicopter with it.
A quick summary:
- What you need
- Get QGroundControl
- Flash PX4 firmware onto your board via QGroundControl
- Choose airframes, calibrate sensors and radio
- Arm and takeoff
1. What you need:
- A computer with Internet Access
- Linux operating system (I am using Ubuntu 14.04 LTS, you can use the operating system you want, but since I am also doing source code development, Linux will make my days a lot easier)
- A PX4 autopilot (Pixhawk, Pixfalcon, HK Pilot 32, Pixracer) with micro usb cable
- A healthy multicopter
- A pair of telemetry modules (optional)
Before we connect the hardware to computer, check if you have wired everything correctly. As a minimum, you need to connect at least the RC receiver, the power module, 4 ESCs and a safety switch to the board. Telemetry modules are recommended but are not necessary if you only want to do manual flight. If you are using Pixhawk or HK Pilot 32, a buzzer is also recommended since the firmware will emit different status tones which are handy in some situations. If your autopilot hardware is mounted on your multicopter already, make sure you are not powering it from the battery. The autopilot hardware gets confused when it has two power sources. And DO NOT INSTALL PROPELLERS BEFORE YOU ARE READY TO FLY!!!
You should also check if your motors are installed correctly, so they are spinning in the right directions. A separate tutorial on how to assemble a quadcopter from scratch will be included later, for now, use Ardupilot’s wiki: Assemble Quadcopter
2. Get QGroundControl:
QGroundControl is a nifty ground station designed around PX4, you can download from the official website: QGroundControl
Go to the downloading subsection and find the current stable releases for Linux. The browser will then ask you to save qgroundcontrol.tar.bz2. Save it in whatever directory you like. Once it is finished downloading, extract the content to ~/Application/qgroundcontrol. Now open a terminal, and use the following command:
You should now see QGroundControl window on your desktop.
3. Flash PX4 firmware onto your board via QGroundControl:
Now click the 3 cogwheels under the menu bars in QGroundControl and go to Firmware.
Now follow the instructions on the screen, first plug in your autopilot hardware via USB (Note: if you have already plugged in your hardware before launching QGroundControl, it will ask you to unplug your Pixhawk and/or Radio from USB, unplug and follow the same procedures below). QGroundControl should identify your hardware instantaneously and start a dialogue asking you to choose which flight stacks you want. Let’s choose PX4 Flight Stack. The advanced settings let you upload your custom firmware or beta testing versions, we will not use them for now.
Click Ok and let QGroundControl to do its thing. Once the process is finished, you should see a line of yellow text that says “Upgrade complete”. If you have the buzzer connected, you will hear a series of short beeps followed by 2 music tones, wait for PX4 to stop singing and the QGroundControl will automatically connect to your hardware again. Click the paper airplane icon on the top of your window and you should see a interface like the one below. If you move your autopilot hardware around now, you should see the artificial horizon in QGroundControl react to your motion.
4. Calibrate sensors and radio:
You have probably noticed the rapid flashing red light on your hardware as well as the giant yellow warning messages in QGroundControl. This means you need to set up your vehicle before you can fly. Go back to the setup menu by clicking the cogwheels on the top again. On the left panel a list of configuration tasks are listed, usually you will need to go through all of these buttons sequentially. The ones require immediate fix will be highlighted red. If your hardware is factory new, you will probably need to do all of them. Here is a nice video showing you how to do each of them: Initial configurations
- If you are flying a Quadrotor x, do NOT choose any of the custom options even if you have the exact model listed, choose Generic Quadrotor X config. It was found out some of the parameters are hard coded into the frame configurations and you cannot change them later.
- If this is your first time flying, set all flight modes to manual or stabilized.
- Disable all safety features if you are flying indoors.
After you complete all of the configuration tasks, go to the Summary button and you should see green lights for Airframe, Radio, Sensors, Flight Modes and Power, and now you are ready to fly!
5. Arm and takeoff:
Power up your hardware with the battery, wait for the LED light to turn into a blue breathing effect (green if you have GPS lock). Now press the safety switch until the buzzer emits a positive musical tone, release the switch, you can arm the vehicle by either using QGroundStation or by moving the yaw stick all the way to the right and keeping the throttle stick at the bottom for 3 seconds. If armed successfully, the motors will start spinning.
Note: if you don’t do anything for 5 seconds the vehicle will disarm automatically. You just need to arm it again.
Now you can raise the throttle stick slowly for takeoff. Alternatively if you have telemetry connection, you can send a takeoff command from QGroundStation (be careful about the target altitude if you are flying indoor).