External calibration file not well formed_SLAM (online) Error

When running the SLAM (online) function, I am receiving the following error:
“Calibration file not well formed → calibration is set to identity
vtkSlam: Calibration has not been loaded. Make sure to calibrate your sensor before using it.”

I am creating my external_calibration_file.mat in python using the following code:

import numpy as np
from scipy.io import savemat

out_fp = "calibration_external_sensor.mat"
matrix = np.array([
    [1.0, 0.0, 0.0, 0.17],
    [0.0, 0.0, 1.0, -0.15],
    [0.0, -1.0, 0.0, -0.33],
    [0.0, 0.0, 0.0, 1.0],
])
savemat(out_fp, {"T_sensor_lidar": matrix})

I followed the procedure and format from this document.

Is this the correct filetype/procedure to create the calibration file?

Hi Alex,
Thank you for testing slam.
SLAM library expects the calibration_external_sensor.mat file to be a text file, not a MATLAB .mat binary file.
If you’d like to generate it from python script, you can use this command:
np.savetxt("calibration_external_sensor.mat", matrix, fmt="%.4f")

Best,
Tong

1 Like

Great, thanks! I no longer get the warning.

Could you help clarify on one more thing…
I am pulling the GNS/IMU data from a drone aircraft. The lidar is under the aircraft, the GPS is on top of the aircraft. Specifically, the GPS is on the top center of the drone, and the lidar is -0.33 meters in z direction, 0.17 m along x axis, and -0.33 m along y axis. However, the lidar is rotated -90 degrees along ITS OWN axis (differs from GPS/Aircraft x-axis) (see attached).

Does my matrix seem correct? I think I am getting confused since the x axis for sensor and x axis for the aircraft do not align (i.e. the x axis for the lidar aligns with the y axis for the aircraft).