Main Content

Fly a Parrot Minidrone Using the Quadcopter Simulink Model

The 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:

  • Aerospace Blockset

  • Aerospace Toolbox

  • Control System Toolbox™

  • Signal Processing Toolbox™

  • Simulink® 3D Animation™

  • Simulink Coder™

Open and Deploy the Quadcopter Model and Start the Flight

  1. At the MATLAB® prompt, type:

    openExample('aeroblks_quad/QuadcopterProjectExample')

    This opens the Quadcopter Project example. Then open the project file.

    openProject('asbQuadcopter');

    This opens a Simulink project with the asbQuadcopter model and loads the required workspace variables.

  2. Run the asbQuadcopter model 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.

  3. With the asbQuadcopter Simulink 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.

  4. Double-click the Flight Control System block in the asbQuadcopter model in Simulink. The flightControlSystem model opens.

    Note

    In the flightControlSystem model, do not change the root level input ports, output ports, or the signals through them.

  5. 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).

  6. 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%.

  7. 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.

  8. 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.

    Note

    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.

  9. 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.

  10. Click Flight Log and MAT File to download the flight log and the MAT-file, respectively. The files droneFlight.txt and RSdata.mat are downloaded to the Current Folder in MATLAB.

    The data in RSdata.mat includes 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.PostFlightAnalysis

    Note

    The command parrot.util.PostFlightAnalysis is specific to the asbQuadcopter model.

After successfully flying the Parrot minidrone using the asbQuadcopter 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.

See Also

| |