How can I communicate directly with MAVLink over telemetry radio?
20 views (last 30 days)
Show older comments
MathWorks Support Team
on 9 May 2023
Answered: MathWorks Support Team
on 11 May 2023
I want to connect PX4 and MATLAB over MAVLink using a Holybro telemetry antenna without having to interface with QGroundControl. I want to transmit data such as heartbeat, monitoring, desired waypoints, and telemetry. Is this supported, and if so, how can I find and send data over the ports?
Accepted Answer
MathWorks Support Team
on 9 May 2023
To connect via the Holybro antenna via MAVLink, telemetry radio would appear as a serial port on the host PC.
For reading MAVLink data using MATLAB:
1. Read the raw bytes using "serialport" and "read", as demonstrated in the following documentation:
2. Create a "mavlinkdialect" object for parsing messages, as described here:
3. Decode the uint8 buffer using "deserializemsg", demonstrated here:
For reading MAVLink data using Simulink:
1. Read serial port data using a "Serial Receive" block. Set the "COM port", "data length", and "sample time", as described below:
2. Parse the raw serial data into a Simulink bus using a "MAVLink Deserializer" block, as shown here:
Information on sending and reading data such as waypoints directly should be contained in the MAVLink Dialect XML file that you use. If using the dialect "common.xml", you can view this file by executing the following command from the MATLAB Command Window:
>> open common.xml
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!