Main Content

readIMU

Read IMU data from Ouster PCAP file

Since R2024b

    Description

    imuData = readIMU(ousterReader) reads all the inertial measurement unit (IMU) data from the Ouster® PCAP file, and returns a structure that contains accelerometer and gyroscope measurements.

    example

    [imuData,tform] = readIMU(ousterReader) additionally returns the transformation matrix from the IMU coordinate frame to the lidar coordinate frame.

    Examples

    collapse all

    Download a ZIP file containing an Ouster packet capture (PCAP) file and the corresponding calibration file, and then unzip the file.

    zipFile = matlab.internal.examples.downloadSupportFile("lidar","data/ouster_RoadIntersection.zip");
    saveFolder = fileparts(zipFile);
    pcapFileName = [saveFolder,filesep,'ouster_RoadIntersection',filesep,'ouster_RoadIntersection.pcap'];
    calibFileName = [saveFolder,filesep,'ouster_RoadIntersection',filesep,'OS1-128U.json'];
    if ~(exist(pcapFileName,"file") && exist(calibFileName,"file"))
        unzip(zipFile,saveFolder);
    end

    Create an ousterFileReader object using the PCAP and calibration files, and read the IMU data.

    ousterReader = ousterFileReader(pcapFileName,calibFileName);
    imuData = readIMU(ousterReader);

    Display the first three accelerometer readings.

    imuData.AccelerometerReadings(1:3,:)
    ans=3×1 timetable
           Time                Acceleration          
        __________    _______________________________
    
        576.64 sec    0.21555     0.58917      9.7837
        576.65 sec    0.22992    -0.40955      9.8387
        576.66 sec    0.23471    -0.16286       9.719
    
    

    Display the first three gyroscope readings.

    gyroReadings = imuData.GyroscopeReadings(1:3,:)
    gyroReadings=3×1 timetable
           Time                  AngluarVelocity            
        __________    ______________________________________
    
        576.64 sec    -0.0099869      0.033689     -0.012117
        576.65 sec    -0.0082558      0.025167    -0.0066579
        576.66 sec    -0.0049268      0.025167     -0.010919
    
    

    Input Arguments

    collapse all

    Ouster file reader, specified as ousterFileReader object.

    Output Arguments

    collapse all

    IMU data, returned as a structure with these fields:

    FieldDescription
    AccelerometerReadings

    Raw accelerometer readings, returned as an M-by-1 timetable. M is the number of measurements. The first column of the table specifies timestamps, and the rest of the columns specify raw accelerometer readings along the x-, y-, and z-axes. Units are in m/s2.

    GyroscopeReadings

    Raw gyroscope readings, returned as an M-by-1 timetable. M is the number of measurements. The first column of the table specifies timestamps, and the rest of the columns specify angular velocities along the x-, y-, and z-axes. Units are in rad/s.

    IMU-to-lidar coordinate transformation, returned as a rigidtform3d object.

    Version History

    Introduced in R2024b