Library for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.
Building MatLogger2 from source
Standard cmake workflow:
- git clone the repo to SOURCE_DIR
- create a build folder BUILD_DIR
- cd BUILD_DIR && cmake SOURCE_DIR
- make
- make install
Installing the binary release
- cd SOURCE_DIR/release
- sudo dpkg -i matlogger2-X.Y.Z-Linux.deb
The binary release has been tested only with Ubuntu 16.04
## Linking against MatLogger2
1 find_package(matlogger2 REQUIRED)
2 target_link_libraries(mytarget matlogger2::matlogger2)
Quick start
### Circular-buffer mode
2 #include <matlogger2/matlogger2.h>
6 auto logger = XBot::MatLogger2::MakeLogger("/tmp/my_log");
7 logger->set_buffer_mode(XBot::VariableBuffer::Mode::circular_buffer);
9 for(int i = 0; i < 1e5; i++)
11 Eigen::VectorXd vec(10);
12 Eigen::MatrixXd mat(6,8);
14 logger->add("my_vec_var", vec);
15 logger->add("my_scalar_var", M_PI);
16 logger->add("my_mat_var", mat);
19 } // destructor flushes to disk
### Producer-consumer mode (default)
2 #include <matlogger2/matlogger2.h>
3 #include <matlogger2/utils/mat_appender.h>
7 auto logger = XBot::MatLogger2::MakeLogger("/tmp/my_log");
8 auto appender = XBot::MatAppender::MakeInstance();
9 appender->add_logger(logger);
10 appender->start_flush_thread();
12 for(int i = 0; i < 1e5; i++)
14 Eigen::VectorXd vec(10);
15 Eigen::MatrixXd mat(6,8);
17 logger->add("my_vec_var", vec);
18 logger->add("my_scalar_var", M_PI);
19 logger->add("my_mat_var", mat);
Documentation
Header files are documented with doxygen! An online version is also available.