Main Content

Getting Started with Grabber Block for Parrot Minidrone

This example shows how to use the Grabber block in Simulink® Support Package for Parrot® Minidrones to control a Grabber module attached to a Parrot Mambo minidrone.

Introduction

The Simulink Support Package for Parrot Minidrones provides a Grabber block that you can use to control the Grabber module attached to a Parrot Mambo minidrone.

The Grabber block can be found in the Simulink library. To access the block from Simulink Library Browser:

1. Enter slLibraryBrowser at the MATLAB® prompt.

2. In the Simulink Library Browser, navigate to Simulink Support Package for Parrot Minidrones.

open_system('parrotlib');

In this example, you will learn how to use the Grabber block in the Code Generation Template to close and open the Grabber module attached to the Parrot minidrone.

Prerequisites

Required Hardware

To run this example, you will need the following hardware:

  • Parrot Mambo minidrone with a fully charged battery

  • Grabber module attached to the drone

  • Bluetooth Low Energy (BLE) 4.0 support on the host computer

Task 1 - Add a Cannon Block and Configure the Input and Output Ports

1. On the Simulink Start page, navigate to Simulink Support Package for Parrot Minidrones and select Code Generation Template.

2. In the Simulink model, navigate into the Flight Control System, and insert the Grabber block from the library.

3. Add two Constant blocks and a Manual Switch block in the model, and connect the output of the Constant blocks to the inputs of the Manual Switch block.

4. Double-click the Constant blocks and set the Constant value as 1 and 0 respectively.

5. Connect the output of the Manual Switch block to the input of the Grabber block.

6. Connect the output port of the Grabber block to a Scope block. The output port provides a boolean value that represents the current state of the Grabber module (open or closed).

The completed Simulink model looks like this:

Task 2 - Perform Monitor and Tune to Close and Open the Grabber Module

In this task, you will use the Monitor and Tune feature in Simulink to run the model on Parrot minidrone, and change the values of the Manual Switch block to close and open the Grabber module attached to the drone.

Before proceeding with this task, ensure that the Grabber module is properly attached to the Parrot Mambo minidrone.

1. Go to the Hardware tab of the Simulink toolstrip, and click Monitor & Tune. The Simulink model starts running on the Parrot minidrone.

2. In the Simulink model, double click the Manual Switch block to change the input value to 1. The Grabber module closes.

Observe the value in the Scope block connected to the output of Cannon block in the model, after the Grabber closes. The displayed value is 1.

3. Double click the Manual Switch block again to change input value to 0. The Grabber module opens.

The support package also provides a pre-configured model parrot_grabber_getting_started that you can use to work with the Grabber module of Parrot Mambo minidrone.

Other Things to Try

You can use the Keyboard Read block available with Simulink Support Package for Parrot Minidrones to control the input to the Grabber block. You can configure any key on the keyboard of the host computer to trigger the closing or opening of the Grabber module. For reference, look at this pre-configured model parrot_grabber_keyboard_control.