How To get multiple mission plan from Q ground control for UAV package delivery example?

7 views (last 30 days)
I wanted to have multple mission plan from QGC block, so that I can simulate multiple UAVs in the same simulation 3D environment.
  2 Comments
Abhishek Singh
Abhishek Singh on 8 Jul 2022
i am trying to modify the UAV package delivery example - https://in.mathworks.com/help/uav/ug/uav-package-delivery.html, where there is a MavLink interface block which is communicating with QGC. I am able to get mission plan for one UAV from Qgroundcontrol and receive the feedback of current state of UAV to Qgroundccontrol.
But, I want to simulate multiple UAVs, each getting it's unique mission plan from QGC; also, receive the feedback of the states of these multiple UAVs in Qgroundcontrol
Vedant Dubey
Vedant Dubey on 31 Aug 2023
Edited: Vedant Dubey on 31 Aug 2023
Hi Abhishek,
Based on the previous suggestion, have you tried using different system IDs on MAVLink deserializer and serializer blocks. Each system ID can correspond to a specific drone.
When you mentioned the below statement:
"But, I want to simulate multiple UAVs, each getting it's unique mission plan from QGC; also, receive the feedback of the states of these multiple UAVs in Qgroundcontrol"
Where specifically are you facing issues? Are you looking for guidance on how to model multiple UAV dynamics or you are unable to see the multiple UAVs in QGC.

Sign in to comment.

Answers (1)

Jianxin Sun
Jianxin Sun on 28 Jun 2022
Moved: Remo Pillat on 1 Oct 2023
Hi Abhishek,
Are you planning to connect to multiple UAVs at the same time in MATLAB/Simulink and obtain their missions?
As long as each UAV you connect to has a unique system ID, you should be able to distinguish them with the MAVLink message he receives. A sample code would look like:
mavlink = mavlinkio("common.xml");
connect(mavlink,"UDP");
uav1 = mavlinkclient(mavlink,1,1);
uav2 = mavlinkclient(mavlink,2,1);
% sub1 only receives message from uav1
sub1 = mavlinksub(mavlink, uav1, NewMessageFcn=@(~, payload)display(payload));
% sub2 only receives message from uav2
sub2 = mavlinksub(mavlink, uav2, NewMessageFcn=@(~, payload)display(payload));
% specify client when sending mavlink messages
msg = createcmd(mavlink.Dialect, "long", 22);
sendmsg(mavlink, msg, uav1);
On Simulink, you could use MAVLink deserializerand serializer blocks to filter different system IDs.
Additionally, you can refer to the MATLAB files in the UAV Package Delivery example to see how we are exchanging data between QGroundControl and simulated UAV in Simulink. Files are in <ExampleFolder>\utilities\MAVLinkMissionProtocolExample, start with MAVLinkInterface.m

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!