How to collect messages from all topics and put them into a csv file?
Hello everyone!
I have a .bag file with recorded messages from 4 different sensors (2xIMU, 2xINEMO), which have been worked simultaneously. I need to collect all messages from all sensors' topics and put them into one .csv file to do further research. So I want to get a table like this:
(rosbagTimestamp, IMU_1_data, IMU_2_data, INEMO_1_data, INEMO_2_data)
So how can I get such table with synchronically collected messages (data) from all topics?
Edit: Would the solution provided by message_filters.ApproximateTimeSynchronizer solve the problem?
There is no reason why the four sensors you're using would be synchronised like this, so you would not be able to represent them this way. If you could tell us what type of sensor you're using then we might be able to help you.
Sorry for that incompleteness. There are 2 IMUs and 2 INEMOs that are working simultaneously during a surgical operation. So the information from all those sensors for each time step is required for further analyse of the accomplished operation.
The problem is the 4 IMUs will not be sampled at exactly the same time intervals, so you'll be able to collect 4 sensor readings at almost the same time but not exactly the same time. So if you try and represent 4 readings with a single time stamp you'll be introducing temporal errors.
Okay, do any workarounds exist for that problem? E.g. timing approximation, i.e. to sample sensors' data not every millisecond, but every second or something like that.. I am pretty sure that someone has already struggled with such problems.