A simple ROS package to log numeric data such as doubles, std vectors, Eigen matrices and vectors.
Include this header wherever you want to access the logger:
#include <rt_logger/rt_logger.h>
Add a real time publisher to the logger:
rt_logger::RtLogger::getLogger().addPublisher("/topic_name",data_to_publish)
Note: This operation is not real time safe! If you are using a real time controller from ros-control, perform this operation in the init of the controller.
Finally, add this line in the main loop of your code to publish the data:
rt_logger::RtLogger::getLogger().publish(ros_time)
Check out this test for more examples.
First, be sure to have scipy and numpy installed:
sudo apt-get update && sudo apt-get install python-scipy python-numpy -y
Create the publishers with rt_logger and record the topics with rosbag, see the command line here
Use this script to extract the .mat files from the bag files:
./read_bag.py -b test.bag
This command will create a mat file for each topic in the bag. To see the available options type:
./read_bag.py -h