0.2.0
Loading...
Searching...
No Matches
UlogFileFormat.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
14
15#include <array>
16#include <cstdint>
17#include <vector>
18#include <string>
19
20namespace NAV::vendor::pixhawk
21{
22#ifndef __clang__
23 #pragma pack(push, 1) // Syntax for gcc for #pragma pack
24#endif
25// --------------------------------------------------------------- Header ------------------------------------------------------------------
28{
29 std::array<char, 7> fileMagic{};
30 char version{ 0 };
31 uint64_t timeStamp{};
32};
33
34// --------------------------------------------------------- Definitions Section ---------------------------------------------------
37{
38 uint16_t msg_size{ 0 };
39 char msg_type{ 0 };
40};
41
44{
46 std::array<uint8_t, 8> compat_flags{};
47 std::array<uint8_t, 8> incompat_flags{};
48 std::array<uint64_t, 3> appended_offsets{};
49};
50
57
60{
62 uint8_t key_len{ 1 };
63 std::string key;
64 std::string value;
65};
66
69{
71 uint8_t is_continued{ 0 };
72 uint8_t key_len{ 0 };
73 std::string key;
74 std::string value;
75};
76
79{
81 uint8_t default_types{ 0 };
82 uint8_t key_len{ 0 };
83 std::string key;
84 std::string value;
85};
86
87// ------------------------------------------------------------ Data Section --------------------------------------------------------
88
91{
93 uint8_t multi_id{ 0 };
94 uint16_t msg_id{ 0 };
95 std::string msg_name;
96};
97
104
107{
109 uint16_t msg_id{ 0 };
110 std::string data;
111};
112
115{
117 uint8_t log_level{ 0 };
118 uint64_t timestamp{ 0 };
119 std::string message;
120};
121
124{
126 uint8_t log_level{ 0 };
127 uint16_t tag{ 0 };
128 uint64_t timestamp{ 0 };
129 std::string message;
130};
131
133enum class ulog_tag : uint16_t
134{
135 unassigned,
141 watchdog,
142 io_service,
143 cbuf,
144 ulg
145};
146
149{
151 std::array<uint8_t, 8> syncMsg{};
152};
153
160
161#ifndef __clang__
162 #pragma pack(pop)
163#endif
164
165} // namespace NAV::vendor::pixhawk
ulog_tag
tag attributes of message_logging_tagged_s
Definition UlogFileFormat.hpp:134
@ camera_handler
Camera handler.
@ mavlink_handler
MAVLink handler.
@ serial_handler
Serial handler.
Subscribed log message with name and ID. This must come before the first corresponding message_data_s...
Definition UlogFileFormat.hpp:91
uint8_t multi_id
the same message format can have multiple instances, for example if the system has two sensors of the...
Definition UlogFileFormat.hpp:93
std::string msg_name
message name to subscribe to. Must match one of the message_format_s definitions
Definition UlogFileFormat.hpp:95
message_header_s header
msg header
Definition UlogFileFormat.hpp:92
uint16_t msg_id
unique id to match message_data_s data. The first use must set this to 0, then increase it....
Definition UlogFileFormat.hpp:94
contains logged data
Definition UlogFileFormat.hpp:107
uint16_t msg_id
unique id to match message_data_s data.
Definition UlogFileFormat.hpp:109
std::string data
contains the logged binary message as defined by message_format_s
Definition UlogFileFormat.hpp:110
message_header_s header
msg header
Definition UlogFileFormat.hpp:108
dropout (lost logging messages) of a given duration in ms. Dropouts can occur e.g....
Definition UlogFileFormat.hpp:156
uint16_t duration
duration of dropout
Definition UlogFileFormat.hpp:158
message_header_s header
msg header
Definition UlogFileFormat.hpp:157
format definition for a single (composite) type that can be logged or used in another definition as a...
Definition UlogFileFormat.hpp:53
std::string format
plain-text string with the following format: message_name:field0;field1;
Definition UlogFileFormat.hpp:55
message_header_s header
msg header
Definition UlogFileFormat.hpp:54
The Definitions and Data sections consist of a stream of messages. Each starts with this header.
Definition UlogFileFormat.hpp:37
uint16_t msg_size
size of the message in bytes without the header (hdr_size= 3 bytes)
Definition UlogFileFormat.hpp:38
char msg_type
defines the content and is one of the following
Definition UlogFileFormat.hpp:39
Information message.
Definition UlogFileFormat.hpp:60
std::string key
key, e.g. 'char[value_len] sys_name'
Definition UlogFileFormat.hpp:63
std::string value
value, e.g. 'PX4'
Definition UlogFileFormat.hpp:64
uint8_t key_len
length of 'key'
Definition UlogFileFormat.hpp:62
message_header_s header
msg header
Definition UlogFileFormat.hpp:61
Logged string message, i.e. printf output.
Definition UlogFileFormat.hpp:115
uint64_t timestamp
timestamp
Definition UlogFileFormat.hpp:118
uint8_t log_level
same as in the Linux kernel
Definition UlogFileFormat.hpp:117
message_header_s header
msg header
Definition UlogFileFormat.hpp:116
std::string message
log message
Definition UlogFileFormat.hpp:119
Tagged Logged string message.
Definition UlogFileFormat.hpp:124
message_header_s header
msg header
Definition UlogFileFormat.hpp:125
uint64_t timestamp
timestamp
Definition UlogFileFormat.hpp:128
uint8_t log_level
same as in the Linux kernel
Definition UlogFileFormat.hpp:126
std::string message
log message
Definition UlogFileFormat.hpp:129
uint16_t tag
id representing source of logged message string. It could represent a process, thread or a class depe...
Definition UlogFileFormat.hpp:127
unsubscribe a message, to mark that it will not be logged anymore
Definition UlogFileFormat.hpp:100
uint16_t msg_id
unique id to match message_data_s data.
Definition UlogFileFormat.hpp:102
message_header_s header
msg header
Definition UlogFileFormat.hpp:101
synchronization message so that a reader can recover from a corrupt message by searching for the next...
Definition UlogFileFormat.hpp:149
message_header_s header
msg header
Definition UlogFileFormat.hpp:150
std::array< uint8_t, 8 > syncMsg
synchronization message
Definition UlogFileFormat.hpp:151
The header is a fixed-size section and has the following format (16 bytes)
Definition UlogFileFormat.hpp:28
char version
ULog version (currently only 1, see https://docs.px4.io/master/en/dev_log/ulog_file_format....
Definition UlogFileFormat.hpp:30
uint64_t timeStamp
denotes the start of the logging in microseconds
Definition UlogFileFormat.hpp:31
std::array< char, 7 > fileMagic
identifier that contains 'U', 'L', 'o' and 'g' chars
Definition UlogFileFormat.hpp:29
Flag bitset message. This message must be the first message, right after the header section,...
Definition UlogFileFormat.hpp:44
std::array< uint8_t, 8 > incompat_flags
incompatible flag bits
Definition UlogFileFormat.hpp:47
std::array< uint8_t, 8 > compat_flags
compatible flag bits
Definition UlogFileFormat.hpp:46
std::array< uint64_t, 3 > appended_offsets
File offsets (0-based) for appended data.
Definition UlogFileFormat.hpp:48
message_header_s header
msg header
Definition UlogFileFormat.hpp:45
Information message multi. The same as the information message, except that there can be multiple mes...
Definition UlogFileFormat.hpp:69
uint8_t is_continued
can be used for arrays
Definition UlogFileFormat.hpp:71
uint8_t key_len
length of 'key'
Definition UlogFileFormat.hpp:72
message_header_s header
msg header
Definition UlogFileFormat.hpp:70
std::string key
key, e.g. 'char[value_len] sys_name'
Definition UlogFileFormat.hpp:73
std::string value
value, e.g. 'PX4'
Definition UlogFileFormat.hpp:74
parameter default message. If a parameter dynamically changes during runtime, this message can also b...
Definition UlogFileFormat.hpp:79
message_header_s header
msg header
Definition UlogFileFormat.hpp:80
uint8_t default_types
default types (TODO: Validate default value)
Definition UlogFileFormat.hpp:81
std::string value
value
Definition UlogFileFormat.hpp:84
std::string key
key
Definition UlogFileFormat.hpp:83
uint8_t key_len
length of 'key'
Definition UlogFileFormat.hpp:82