Skip to content

Fitting the calibration model

Sibo Wang edited this page Apr 30, 2025 · 1 revision

Once a calibration scan is done (see Running the calibration scan), the user can use the fit-calibration-model program to fit the calibration parameters. This program is written in Python and it is implemented in tools/src/spotlight_tools/scripts/fit_calibration.py.

The command-line arguments accepted by this program are as follows. This help message can also be printed out by running fit-calibration-model --help.

$ fit-calibration-model --help
usage: fit-calibration-model [-h] [OPTIONS]

Fit the calibration model for the ArUco board.

╭─ options ────────────────────────────────────────────────────────────────────────────╮
│ -h, --help              show this help message and exit                              │
│ --profile-dir STR       Path to the profile directory. (default:                     │
│                         '~/Spotlight/default/')                                      │
│ --arena-width FLOAT     Width of the arena in mm. (default: 48)                      │
│ --arena-height FLOAT    Height of the arena in mm. (default: 72)                     │
│ --aruco-scale-mm FLOAT  Size of each "pixel" (i.e. "block") of the ArUco markers in  │
│                         mm. (default: 0.3)                                           │
│ --aruco-spacing-unitblk INT                                                          │
│                         Spacing between each ArUco marker in "pixel" (i.e. "block"). │
│                         (default: 2)                                                 │
│ --visualize-aruco-detections, --no-visualize-aruco-detections                        │
│                         Whether to visualize the ArUco detections. (default: False)  │
╰──────────────────────────────────────────────────────────────────────────────────────╯

The profile directory must be consistent with the one specified in Running the calibration scan; the arena width, height, ArUco scale, and ArUco spacing parameters must be consistent with those specified in Generating the calibration board.

Upon completion, the program will generate a "calibration_points.csv" file and a "calibration_result.yaml" file under the "calibration" subfolder under the specified profile directory. The calibration parameters, as explained in Calibration algorithm, can be found in "calibration_result.yaml".

Optionally, if the visualizing ArUco detections parameter is enabled, a "aruco_scan_detection" subfolder will be created under "calibration." This subfolder contains the images from the calibration scan with the ArUco detection results visualized. This is useful for debugging if the calibration model has poor performance.

Clone this wiki locally