Fly a Parrot Minidrone Using the Quadcopter Simulink Model
asbQuadcopter model, which is available in the Aerospace Blockset,
starts the flight of a Parrot® minidrone. The drone hovers at an altitude of 1.1 meters for a specified
flight time before powering off.
Before you begin, make sure that you have licenses for these products:
Control System Toolbox
Signal Processing Toolbox
Simulink® 3-D Animation
Open and Deploy the Quadcopter Model and Start the Flight
At the MATLAB prompt, type:
This opens a Simulink project with the
asbQuadcoptermodel and loads the required workspace variables.
asbQuadcoptermodel in normal simulation mode. Navigate through the different subsystems to learn about the modeling hierarchy and quadcopter dynamics. You can also view the Simulink 3-D animation of the model. For more information, see Quadcopter Project.
asbQuadcopterSimulink project open, click the Project Shortcuts tab and perform one of the following tasks based on the type of minidrone connected:
If the host computer is connected to a Parrot Rolling Spider, click Set Rolling Spider Model and then click Set Parrot Target.
If the host computer is connected to a Parrot Mambo, click Set Mambo Model and then click Set Parrot Target.
Double-click the Flight Control System block in the
asbQuadcoptermodel in Simulink. The
flightControlSystemmodel, do not change the root level input ports, output ports, or the signals through them.
In Simulink, click the Deploy to Hardware icon, . After the build process and deployment is successful, the Flight Control Interface is launched automatically if you had selected the option Launch Parrot Flight Control Interface automatically after build in the Configuration Parameters dialog box in Simulink (see Model Configuration Parameters for Parrot Minidrone).
Before flying the Parrot Rolling Spider with full speed, test the model at low speed by spinning the motors at low power. Open the Flight Control Interface (see Step 1: Open the Flight Control Interface). Drag the PowerGain slider to 20, which sets the power gain of the motors to 20%.
Click START to start the drone. The motors on the Parrot minidrone start. The propellers spin for the time defined as flight duration (by default, the simulation time) and stop.
To prepare the Parrot minidrone for flight, set the power gain of the motors to the highest value (100%). Drag the PowerGain slider to 100.
Before flying the Parrot minidrone (as explained in the next step), adhere to the following safety procedures:
Ensure the safety of people, animals, and property in the vicinity of the flight.
Wear safety glasses at all times.
Place the drone on a flat surface before starting.
Fly the drone only indoors, with an open area greater than 10x10 feet, over a non-glossy floor.
Always be ready to stop the flight. The Flight Control Interface displays the STOP button after the motors on the drone start.
Click START to start the flight of the drone. The motors on the Parrot minidrone start, and the drone performs a vertical take-off to an altitude of 1.1 meters. The drone hovers at this position for the time defined as flight duration (by default, the simulation time), and the motors stop after the flight duration is completed.
To stop the flight before the flight duration is completed, click STOP in the Flight Control Interface.
Click Flight Log and MAT File to download the flight log and the MAT-file, respectively. The files
RSdata.matare downloaded to the Current Folder in MATLAB.
The data in
RSdata.matincludes various sensor values, motor commands, calibration values, and outputs of estimators during the flight. You can also plot the values from the downloaded MAT-file by using this command in MATLAB®:
parrot.util.PostFlightAnalysisis specific to the
After successfully flying the Parrot minidrone using the
model, you can now redesign the controller logic in Simulink. Deploy your new model
on the minidrone by following the same steps, and start the minidrone flight using
the same commands. Always test your model with a low value of power gain (10–20%)
for the motors. After you are confident about the minidrone flight, increase the
power gain and run the model on the minidrone.