11 #ifndef READ_IMU_DATA_H
12 #define READ_IMU_DATA_H
19 #include <Eigen/Dense>
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 ReadImuData(std::vector<BufferEntryType>* data_out, std::shared_ptr<SensorAbsClass> sensor,
30 const std::string& file_path,
const double& time_offset = 0)
32 std::vector<std::string> expect_entry = {
"t",
"a_x",
"a_y",
"a_z",
"w_x",
"w_y",
"w_z" };
37 unsigned long number_of_datapoints = csv_data[
"t"].size();
38 data_out->resize(number_of_datapoints);
40 for (
size_t k = 0; k < number_of_datapoints; k++)
42 Time time = csv_data[
"t"][k] + time_offset;
44 Eigen::Vector3d linear_acceleration(csv_data[
"a_x"][k], csv_data[
"a_y"][k], csv_data[
"a_z"][k]);
45 Eigen::Vector3d angular_velocity(csv_data[
"w_x"][k], csv_data[
"w_y"][k], csv_data[
"w_z"][k]);
48 data.
set_measurement(std::make_shared<IMUMeasurementType>(linear_acceleration, angular_velocity));
51 data_out->at(k) = current_entry;
The BufferDataType binds the core and sensor state in form of a shared void pointer.
Definition: buffer_data_type.h:36
void set_measurement(std::shared_ptr< void > meas)
Definition: buffer_data_type.h:75
Definition: buffer_entry_type.h:41
Definition: read_csv.h:30
Definition: read_imu_data.h:25
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ReadImuData(std::vector< BufferEntryType > *data_out, std::shared_ptr< SensorAbsClass > sensor, const std::string &file_path, const double &time_offset=0)
Definition: read_imu_data.h:29
std::map< std::string, std::vector< double > > CsvDataType
Definition: read_csv.h:26