Hi Federico,
To adapt the Pose Estimation From Asynchronous Sensors example for your own GPS and IMU data from a `.csv` file, you'll need to make several modifications to the example code. The key steps involve loading your data, initializing the filter with appropriate parameters based on your sensors, and then modifying the sensor fusion loop to use your data.
1. Load Your Data
First, you need to load your data from the `.csv` file. Assuming you have already arranged your data into vectors (`ACCx_vec`, `ACCy_vec`, `ACCz_vec`, `GYRx_vec`, `GYRy_vec`, `GYRz_vec`, `MAGx_vec`, `MAGy_vec`, `MAGz_vec`, `gpsLAT_vec`, `gpsLONG_vec`), you can load them directly into MATLAB. If not, you'll need to use `readtable`, `readmatrix`, or similar functions to read your CSV data into MATLAB.
% Example of loading CSV data
data = readtable('your_data_file.csv');
% Extracting specific columns, assuming you know their names or indices
ACCx_vec = data.ACCx;
ACCy_vec = data.ACCy;
ACCz_vec = data.ACCz;
% Continue for other sensors
2. Initialize the Filter
You've already outlined how to initialize the `insfilterMARG` object and set its properties. Make sure the sample rate (`imuFs`) and reference location (`refloc`) accurately reflect your setup.
3. Sensor Fusion Loop
The main loop you've proposed seems to be on the right track, but you need to ensure the variables 'a', 'w', 'm', 'lla', 'Rmag', 'Rpos', 'gpsvel', and 'Rvel' are correctly defined and populated with your data. The variables 'a', 'w', and 'm' should be your accelerometer, gyroscope, and magnetometer measurements, respectively. The 'lla' variable should contain your GPS latitude, longitude, and altitude data. 'Rmag', 'Rpos', 'gpsvel' and 'Rvel' are the noise covariance matrices for the magnetometer, GPS position, GPS velocity, and velocity noise, respectively.
Hope this helps.