MATLAB Answers

Problem in detecting line in parrot mini drone

6 views (last 30 days)
Aradhya Anil Tare
Aradhya Anil Tare on 16 Jul 2019
Commented: Aradhya Anil Tare on 18 Jul 2019
In the video series, you have used Stateflow for developing the logic of the drone.
As the drone is flying at a height of 1.1 m, the large section of the line is below the drone, as we tried to detect the red colour only not line (as shown in the first screenshot).
Therefore, when I run the model, the drone is following the straight line properly but when there is a turn. The drone moves straight as the red colour is in the frame but after 2 seconds the threshold for total white pixels becomes less than 1400 therefore, it won't detect the colour and it will try to turn depending on the algorithm (in my case I've programmed such as it will rotate in a clockwise direction but as it rotates little bit the threshold increase beyond 1400. so it again gives '1' in the output.
To overcome this problem I tried to use 'resize block' but it's showing an error that is shown in the second screenshot.
and one more thing, can you please tell me how can I detect line in the simulation ( image taken from simulation not from camera) ?
Thank you in advance.
Regards,
Aradhya Tare.
Screenshot (20).png
Screenshot (21).png

Answers (1)

Maitreyee Mordekar
Maitreyee Mordekar on 16 Jul 2019
Hello Aradhya,
The input to the PARROT Image Coversion block has to be a 4*9600 image. So, adding a resize block there would certainly show this error.
You have to design the algorithm in a way that the drone takes a turn and keeps following the line. So, I may not be able to help you on exactly what approach can be used there.
You can consider changing the value of the constants or may be see if Computer Vision Toolbox helps: https://in.mathworks.com/help/vision/index.html
The algorithm that you would design in simulations can be directly used on the hardware by changing certain parameters. So what you implement in simulations would be what you would deploy on the hardware. If you want the image from the camera in simulations, it would be the image which is located at the output of the PARROT Image Conversion block.
Do note that the algorithm that you submit will be evaluated on different tracks with various number of track sections; not only the one in the examples.
I hope this helps.
-Maitreyee

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by