ardupilotreader
Description
The ardupilotreader
object reads an ArduPilot® dataflash log
file (.bin
). The object stores the file start and end logging times,
available messages, and the total number of messages in the log file.
Creation
Description
reads the ArduPilot dataflash log file from the specified file name or path, and returns
an object containing information about the file.arduObj
= ardupilotreader(filePath
)
Properties
FileName
— Name of ArduPilot dataflash log file
string scalar | character vector
This property is read-only.
Name of ArduPilot dataflash log file, specified as a string scalar or character
vector. The FileName
is the path specified in the
filePath
argument.
Data Types: char
| string
StartTime
— Start time of logging
duration
object
This property is read-only.
Start time of logging offset from the system start time in the ArduPilot dataflash
log file, specified as a duration
object in the
'hh:mm:ss.SSSSSS'
format.
Data Types: duration
EndTime
— Timestamp of last timestamped message
duration
object
This property is read-only.
Timestamp of the last timestamped message logged in the ArduPilot dataflash log
file, specified as a duration
object in the
'hh:mm:ss.SSSSSS'
format.
Data Types: duration
AvailableMessages
— Table of all logged messages
table
This property is read-only.
Summary of all the logged messages, specified as a table that contains the fields:
MsgName
InstanceID
StartTimestamp
LastTimestamp
NumMessages
Data Types: table
NumMessages
— Total number of messages
positive integer
This property is read-only.
Total number of messages in the log file
Data Types: double
Object Functions
readMessages | Read messages from ArduPilot® log file |
readParameters | Read parameter values from ArduPilot® log file |
readLoggedOutput | Read logged output messages from ArduPilot® log file |
Examples
Read Messages from ArduPilot Log File
Load the BIN file.
bin = ardupilotreader('flight.bin');
Read all messages.
msg = readMessages(bin);
Specify the time interval between which to select messages.
d1 = duration([0 1 00],'Format','hh:mm:ss.SSSSSS'); d2 = d1 + duration([0 0 55],'Format','hh:mm:ss.SSSSSS');
Read the attitude message in the time interval [d1 d2]
.
attMsg = readMessages(bin,'MessageName',{'ATT'},'Time',[d1 d2]);
Extract attitude data from the message.
AttData = attMsg.MsgData{1,1}
AttData=534×10 timetable
timestamp TimeUS DesRoll Roll DesPitch Pitch DesYaw Yaw ErrRP ErrYaw AEKF
_______________ _______________ _______ ____ ________ _____ ______ ______ _____ ______ ____
00:01:01.669489 00:01:01.669489 0 0.06 0 0.05 358.94 358.95 0 0 3
00:01:01.769448 00:01:01.769448 0 0.06 0 0.05 358.95 358.96 0 0 3
00:01:01.869408 00:01:01.869408 0 0.06 0 0.05 358.95 358.96 0 0 3
00:01:01.969368 00:01:01.969368 0 0.06 0 0.05 358.95 358.96 0 0 3
00:01:02.069328 00:01:02.069328 0 0.06 0 0.05 358.96 358.97 0 0 3
00:01:02.169288 00:01:02.169288 0 0.06 0 0.05 358.96 358.97 0 0 3
00:01:02.269248 00:01:02.269248 0 0.06 0 0.05 358.96 358.97 0 0 3
00:01:02.369208 00:01:02.369208 0 0.06 0 0.05 358.97 358.98 0 0 3
00:01:02.469168 00:01:02.469168 0 0.06 0 0.05 358.97 358.98 0 0 3
00:01:02.569128 00:01:02.569128 0 0.07 0 0.05 358.97 358.98 0 0 3
00:01:02.669088 00:01:02.669088 0 0.07 0 0.05 358.98 358.99 0 0 3
00:01:02.769048 00:01:02.769048 0 0.07 0 0.05 358.98 358.99 0 0 3
00:01:02.869008 00:01:02.869008 0 0.07 0 0.05 358.98 358.99 0 0 3
00:01:02.968968 00:01:02.968968 0 0.07 0 0.06 358.98 358.99 0 0 3
00:01:03.068928 00:01:03.068928 0 0.07 0 0.06 358.99 359 0 0 3
00:01:03.168889 00:01:03.168889 0 0.07 0 0.06 358.99 359 0 0 3
⋮
Read all parameter values.
params = readParameters(bin)
params=1312×4 timetable
timestamp TimeUS Name Value Default
_______________ _______________ __________________ _____ _______
00:01:01.651163 00:01:01.651163 "FORMAT_VERSION" 120 120
00:01:01.651163 00:01:01.651163 "SYSID_THISMAV" 1 1
00:01:01.651163 00:01:01.651163 "SYSID_MYGCS" 255 255
00:01:01.651163 00:01:01.651163 "PILOT_THR_FILT" 0 0
00:01:01.651163 00:01:01.651163 "PILOT_TKOFF_ALT" 0 0
00:01:01.651163 00:01:01.651163 "PILOT_THR_BHV" 0 0
00:01:01.651163 00:01:01.651163 "SERIAL0_BAUD" 115 115
00:01:01.651163 00:01:01.651163 "SERIAL0_PROTOCOL" 2 2
00:01:01.651163 00:01:01.651163 "SERIAL1_PROTOCOL" 2 2
00:01:01.651163 00:01:01.651163 "SERIAL1_BAUD" 57 57
00:01:01.651163 00:01:01.651163 "SERIAL2_PROTOCOL" 2 2
00:01:01.651163 00:01:01.651163 "SERIAL2_BAUD" 57 57
00:01:01.651163 00:01:01.651163 "SERIAL3_PROTOCOL" 5 5
00:01:01.651163 00:01:01.651163 "SERIAL3_BAUD" 38 38
00:01:01.651163 00:01:01.651163 "SERIAL4_PROTOCOL" 5 5
00:01:01.651163 00:01:01.651163 "SERIAL4_BAUD" 38 38
⋮
Read all logged output messages.
loggedoutput = readLoggedOutput(bin);
Read logged output messages in the time interval [d1 d2]
.
log = readLoggedOutput(bin,'Time',[d1 d2])
log=16×2 timetable
timestamp TimeUS Message
_______________ _______________ _________________________________________________
00:01:01.651163 00:01:01.651163 "ArduCopter V4.3.3 (34e8e02c)"
00:01:01.651163 00:01:01.651163 "d6384d347e3c476ea8702e6a78ef3590"
00:01:01.651163 00:01:01.651163 "Param space used: 323/4096"
00:01:01.651163 00:01:01.651163 "RC Protocol: SITL"
00:01:01.651163 00:01:01.651163 "New mission"
00:01:01.651163 00:01:01.651163 "New rally"
00:01:01.651163 00:01:01.651163 "New fence"
00:01:01.651163 00:01:01.651163 "Frame: QUAD/PLUS"
00:01:01.651163 00:01:01.651163 "GPS 1: detected as u-blox at 230400 baud"
00:01:07.788707 00:01:07.788707 "Mission: 1 WP"
00:01:08.014449 00:01:08.014449 "EKF3 IMU0 MAG0 in-flight yaw alignment complete"
00:01:08.019448 00:01:08.019448 "EKF3 IMU1 MAG0 in-flight yaw alignment complete"
00:01:29.004384 00:01:29.004384 "Reached command #1"
00:01:29.004384 00:01:29.004384 "Mission: 2 WP"
00:01:48.199202 00:01:48.199202 "Reached command #2"
00:01:48.199202 00:01:48.199202 "Mission: 3 WP"
Version History
Introduced in R2024a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)