You know what I did this weekend? Yes, as the title of this post says, I deployed custom flight control software to my Parrot Rolling Spider Minidrone
Simulink Support Package for PARROT Minidrones
Last Christmas, my girlfriend got me one of those Parrot Rolling Spider Minidrone.
Immediately, I thought it would be cool to program it using Simulink. At that time, I did some research and it sounded pretty complicated to install a custom firmware and glue all the necessary code together.
Not anymore, with the recent release of the PARROT Minidrones Support Package.
Today I will describe my first experience using this package.
To get started, open the Add-On Explorer from the MATLAB toolstrip.
In the Explorer, search for "PARROT Minidrone", click Install, and follow the instructions. Once the package is installed, the installer will guide you through the hardware setup.
This setup will first update the minidrone firmware. Notice that once the firmware is updated, you will not be able to fly the minidrone from the smartphone app anymore. As one of my colleagues likes to say: When you update the firmware, you are converting a toy into an experimental device.
If you want to bring your minidrone back to "toy mode", you will need to go to the PARROT website and follow the instructions to reset the original firmware.
Once the firmware is updated, you will need to connect to the minidrone through Bluetooth. Once again, the Hardware Setup window will guide you through all the steps:
This example is a full simulation of a PARROT minidrone. As you can imagine, we will not generate code for this entire model. What we want is generating code for the model flightControlSystem.slx, which is referenced by the FCS block.
In the Simulink Project click on the shortcut named Set PARROT Target
This will setup a few things in the model configuration to make the generated code compatible with the minidrone.
In the model, click the Build Button to generate code. Once the code generation is complete, go to the MATLAB prompt to connect to the minidrone, and start execution of the code.
For a first test, the line p.setPowerGain(20) is probably a good idea. It will instruct the drone to use 20% of the power available. That way, the drone will not fly, but the motors will move to confirm that the code is running.
The way things work, the customized firmware expects a library with a specific function and signature. In the example model, there are two bus objects specified on the two root-level Inport matching this expected signature. As output, a vector of 4 power commands, one per motor, is expected.
To familiarize yourself with all the sensors available, I recommend enabling MAT-file logging in the model configuration, and use To Workspace blocks in the model to log the sensors signals. After your flight terminates, you will then be able to exeute p.getMatFile to retrieve the logged signals from the drone and analyze them.
My First flight
Confirm that I could change the model and see the effect, I used a Signal Builder to command the drone to fly at a fixed height and move left and right. Here is what it looks like in action:
Now it's your turn
Install the Simulink Support Package for PARROT Minidrones and let us know if you are able to improve the stability of the flight controller, or implement cool features like line or target tracking using the downward pointing camera.
If you want to learn more on that topic, I also recommend registering for the upcoming webinar on Programming Drones with Simulink that will be held on December 7th.
10 CommentsOldest to Newest
did you have any issues updating the firmware? I am trying to do this type of project but can’t get past the firmware update.
Hi, I am having trouble at opening the example of the Simulink Model. I got this message ‘Undefined function or variable ‘asbQuadcopterStart’.’.
I am sure that the aerospace toolbox is installed on my computer. My version of the Matlab is 2017b. Do you know how to open it?
@ChangKi: The quadrotor example is included with the Aerospace Blockset, which is different from the Aerospace Toolbox.
@John Judge: I recommend contacting technical support, we should be able to help you with that:
@Guy Rouleau Thanks, I got the Aerospace Blockset, then I updated firmware. But, I got a new problem. I modified the signal builder then I deployed the ‘flight control system’ on the parrot minidrone, but the drone does not move. I tested on the 3D simulation, it moved depends on the signal builder. Is there any possible reason for this problem?
@ChangKi Sung: The Signal builder is in the top model, used only for simulation. You can either send command to the drone using the parrotminidrone object, or modify the flightControl model to specify commands there.
I’m working on Parrot RS Mini-drone, and I want to use the camera on it to process a line following or recognition of geometric shapes. Any body have any documentation attached to how to use OpticalFlowData signal in Simulink?
Thanks for the question and interest in using the down-facing camera to process line following or object recognition algorithms. We are currently investigating this question and considering possible use cases. It would be great to hear more about your use case and make sure to capture any additional requirements. Please send me a private message through my File Exchange profile.
Have you tried to control using the Joy-stick Controller??
I am working on Parrot Rolling Spider drone. I want to control the drone through the Joy-stick controller. So, I modified the flightControl model to specify commands, but I found that the rolling spider drone is not stable if I use the joy-stick controller in both simulation and testing. The drone is moving left and right in the simulation if I change the VSS_COMMAND equal to 1. In addition, the drone is not getting the reference input from the joy-stick controller on testing. However, the drone is receiving the reference input from the joy-stick controller on simulation. (* I copied all the blocks in the Joystick block into the flightControlSystem block, then connected to the bus instead of input-port 1.)
Hi, how to obtain smooth landing? I am able to perform the experiment which is explained in the ” webinar on Programming Drones with Simulink”, but after finishing the task my quadcopter is not landing smoothly. How to achieve a smooth landing? (https://www.youtube.com/watch?v=vM9Iaz79RF0)