MATLAB Answers

0

How to interface parrot mambo drone and Vicon using Simulink?

Asked by Jasvir Virdi on 31 Mar 2019
Latest activity Answered by Omar Shadeed on 1 May 2019
Hello,
I have tried searching an answer to this question, but haven't found anywhere. Please could anyone give any ideas.
Currently, I am using the models that are there on Vicon's website and am able to successfully receive data from vicon to my laptop. However, when I use UDP send to send this data to the drone, I feel it is not doing it in real time. The drone receives the data (using UDP receive at drone side) but there is a rate issue. I have attached the models for your reference.
I am still runnning the same control algorithms that you have provided for "asbQuadcopterStart". I have just changed the estimator and the only change is that the x,y and z coordinates are given from vicon now.
Since this is a 2 channel communication (vicon to laptop to drone), is there any way to directly send data from vicon to drone?
I tried the following approach. I uploaded the udp one on the drone. It uploaded successfully but when I pressed the start button on the flight control interface, it did not run and it said there is bluetooth connection error. I tried uploading the second model which receives data using Vicon SDK. That does not complie successfully and it shows some error.
Please could you suggest anything on this.
Jasvir

  0 Comments

Sign in to comment.

4 Answers

Omar Shadeed 님의 답변 22 Apr 2019

Hi Jasvir,
Actually it's been 5 days and I'm trying to find out a solution for this problem. There's a way to obtaing the Vicon data not by using udp recieve but by running the simulation in real time and using packet input block instead of udp recioeve (the one provided by Vicon model), however, packet input works only when the Code generation System target file is sldrt.tlc or sldrtrt.tlc and the parrot's model works only when the Code generation System target file is ert.tlc (Embeded Coder).
Please let me know if you got any new ideas to fix this problem.
Thanks,

  1 Comment

Hi Omar,
I was able to fix the issue. I used the parrot mambo udp receive block, that MATLAB provides , to receive the data being sent by vicon.
In my case, firstly, I used the vicon data stream SDK simulink model that is there on vicon's website to send the data from Vicon's host pc to my pc. Then, I used the udp send block on my laptop to send this information to the drone (you will have to have a udp receive block on the drone side).
The following links provide a good reference to what I am talking about.
Hope these help
Jasvir

Sign in to comment.


Omar Shadeed 님의 답변 23 Apr 2019

Hi Jasvir,
Thanks a lot for your reply!
I'm actually doing the same thing, so I have two simulink models one of them is the one provided by Vicon to stream the data from the tracker to my laptop using udp and the other one is the "asbQuadcopterStart" model. So in the Vicon's model I'm sending the data to the parrot using TCP/IP send block as shown in the screenshot attached and on the parrot's model I'm using a udp recieve block to obtain the data. Now I have two problems, the first one is the data obtained on the parrot by the udp recieve block is not continuous meaning that it gives some data and then zeros for like 5 or 6 cycles and then data again, so in your case how did you solve this problem? The other problem is when I biuld the model on the parrot I can't run the Vicon's model until I press start on the Parrot's flight interface because the TCP/IP block gives an error otherwise. Starting the Parrot first means there will be around 2 seconds where the Parrot flies without any feedback until the Vicon model initializes and starts sending the data to the Parrot.
I would really appreciate your help.
Thanks, Vicon Data.png

  1 Comment

Hi Omar,
I was also initially using the UDP simulink model that is there on Vicon's site and it was not working for me. There was delay in receiving position information like you mentioned. Currently, I have switched to TCP/IP simulink model that is there on Vicon's webstie (uses DataStream SDK) to send data from tracker to my pc.
I am then using specific UDP send/receive block to send data from my pc to drone.
The one that you are using (as shown in image) did not work for me. When I tried using this, I got a delay in receiving the data, which is not good for real time implmentation. Also, I don't use the TCP/IP send/receive blocks as it was not working for me.
I switched to the UDP send/receive block. Hope this helps
Jasvir

Sign in to comment.


Omar Shadeed 님의 답변 24 Apr 2019

Hi Jasvir,
I have switched to the DSSDK model to obtain the data from the tracker as you suggested (shown in the screenhot attached). I still couldnt run the model because I'm using a Mac so I requested a service from Mathworks to solve it. I just have a couple of questions regarding your model, firstly are you using TCP/IP send block or udp send block to send the data to the parrot and at what sample rate you put the send block? Secondly, in the parrrot model do you build the model in the normal or the external mode because if you run the DSSDK model first it will give an error saying the port specified in the udp send is not available and if you run the parrot model first to make the port available that means around 2 seconds will pass and the parrot has no data (no Feedback) which means it will collide, so how did you overcome this problem?
Thanks alot for your help. DSSDK and UDP send.png

  1 Comment

Hi Omar,
I am using UDP blocks to communicate between drone and pc.
I am running in normal mode. I run the DSSDK model first and then execute the flight controller. I think the error that you mentioned when running in normal mode might be happening because you are using TCP/IP blocks. (It should not be happening though).
In my case, since I have been using UDP right from the start, I did not face that kind of issue.
Jasvir

Sign in to comment.


Omar Shadeed 님의 답변 1 May 2019

Hi Jasvir,
Thanks alot for your help ! I could stream the data to the parrot using the udp send and recieve blocks. For the velocities and the orientation rates feedback I took the discrete derivative of the states that Vicon provides and filtered the output with a low- pass filter then send it to the parrot with the udp block but the problem is the velovities data still oscillates and that makes the drone tend to swing in the hovering mode. Do you have any suggestions to solve this problem ?
Thanks,

  0 Comments

Sign in to comment.