# External calibration file not well formed\_SLAM (online) Error

**URL:** https://discourse.paraview.org/t/external-calibration-file-not-well-formed-slam-online-error/16509
**Category:** LidarView, Lidar, and SLAM
**Created:** [April 21, 2025, 3:42am UTC](https://discourse.paraview.org/t/external-calibration-file-not-well-formed-slam-online-error/16509 "2025-04-21T03:42:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![uasdev](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/u/a9adbd/32.png) [@uasdev](https://discourse.paraview.org/u/uasdev)
#### Post date: [April 21, 2025, 3:42am UTC](https://discourse.paraview.org/t/external-calibration-file-not-well-formed-slam-online-error/16509/1 "2025-04-21T03:42:35Z")

</div>

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:

```auto
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](https://gitlab.kitware.com/keu-computervision/slam/-/blob/master/paraview_wrapping/Plugin/doc/How_to_SLAM_with_LidarView.md#calibration).

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

---

<div class="post-metadata">

### Author: ![Tong\_Fu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/tong_fu/32/13154_2.png) [@Tong\_Fu](https://discourse.paraview.org/u/Tong_Fu)
#### Post date: [April 22, 2025, 9:07am UTC](https://discourse.paraview.org/t/external-calibration-file-not-well-formed-slam-online-error/16509/2 "2025-04-22T09:07:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![uasdev](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/u/a9adbd/32.png) [@uasdev](https://discourse.paraview.org/u/uasdev)
#### Post date: [April 23, 2025, 4:11am UTC](https://discourse.paraview.org/t/external-calibration-file-not-well-formed-slam-online-error/16509/3 "2025-04-23T04:11:21Z")

</div>

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).

 ![image](https://discourse.paraview.org/uploads/default/original/3X/f/0/f076e42b4f86fb5531d535ba3b1f102b578c85c1.jpeg)
