https://github.com/px4/ulog_cpp
C++ library for reading and writing ULog files
https://github.com/px4/ulog_cpp
Last synced: about 1 year ago
JSON representation
C++ library for reading and writing ULog files
- Host: GitHub
- URL: https://github.com/px4/ulog_cpp
- Owner: PX4
- License: bsd-3-clause
- Created: 2023-08-02T12:29:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T10:10:36.000Z (about 1 year ago)
- Last Synced: 2025-04-10T00:51:33.950Z (about 1 year ago)
- Language: C++
- Size: 2.31 MB
- Stars: 19
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ ULog Library
Streamed C++ [ULog](https://docs.px4.io/main/en/dev_log/ulog_file_format.html) reader and writer library.
## Properties
- Options for keeping log data in memory or processing immediately.
- Pure C++17 without additional dependencies (`SimpleWriter` requires platform-specific `fsync`/`FlushFileBuffers`).
- The reader is ~10 times as fast compared to the [python implementation](https://github.com/PX4/pyulog).
However, the API is more low-level, and if you're just looking for an easy-to-use parsing library, use pyulog.
- Unsupported ULog features:
- Appended data (`DATA_APPENDED`)
- A little endian target machine is required (an error is thrown if this is not the case)
- The reader keeps errors stored, so parsing can be continued and any errors can be read out at the end.
The writer directly throws exceptions (`ulog_cpp::ExceptionBase`).
## Examples
Check the [examples](examples) subdirectory.
## Include in a project
To add the library as a submodule with cmake, use the following steps:
```shell
git submodule add https://github.com/PX4/ulog_cpp.git ulog_cpp
```
Then extend your `CMakeLists.txt` with:
```cmake
add_subdirectory(ulog_cpp)
target_link_libraries(YOUR_PROJECT PUBLIC
ulog_cpp::ulog_cpp
)
```
## Development
For development, install the pre-commit scripts:
```shell
pre-commit install
```
### CI
CI runs a number of checks which can be executed locally with the following commands.
#### clang-tidy
```shell
cd build
make clang-tidy
```
#### Unit tests
```shell
cd build
make run-unit-tests
```
#### Linters (code formatting etc)
These run automatically when committing code. To manually run them, use:
```shell
pre-commit run -a
```