# voxl-tag-detector fails to start on V3.3 "Missing lens_cal_file"

Source: https://forum.modalai.com/topic/322/voxl-tag-detector-fails-to-start-on-v3-3-missing-lens_cal_file
Category: Development Drones (https://forum.modalai.com/category/44/development-drones)
Tags: m500
Posted: 2021-07-06 20:02:42 UTC by PawelJ
Replies: 12 · Views: 3158

## PawelJ · 2021-07-06 20:02:42 UTC

I recently reflashed the image for my voxl-m500 to 3.3 and reinstalled the voxl-suite during the process. I've run the voxl-configure-tag-detector service and set it up to run on boot, however I am unable to get it to run. When I try voxl-tag-detector -d I get an error about the lens calibration file missing. Is there something I am missing in the setup process? I have not updated the tag locations to my own yet, and am just trying to get the service running with the default settings. Note that I did change the size of the april tag to match mine.
```
enabling debug mode
loading tag-detector config file
loading apriltag config file
=================================================================
detector #0
    enable:          1
    input_pipe:      tracking
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 1
    undistort_scale: 0.60
    overlay_name:    tracking_tag_overlay
    lens_cal_file:   /data/modalai/opencv_tracking_intrinsics.yml
    skip_n_frames:   5
detector #1
    enable:          0
    input_pipe:      stereo
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 1
    undistort_scale: 0.90
    overlay_name:    stereo_tag_overlay
    lens_cal_file:   /data/modalai/opencv_stereo_intrinsics.yml
    skip_n_frames:   5
detector #2
    enable:          0
    input_pipe:      extra
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 0
    undistort_scale: 1.00
    overlay_name:    extra_tag_overlay
    lens_cal_file:   /data/modalai/opencv_extra_intrinsics.yml
    skip_n_frames:   5
=================================================================
default_size_m:        0.173
#0:
    id:              0
    name:            default_name
    loc_type:        unknown
    size_m:            0.173
    T_tag_wrt_fixed: 0.0  0.0  0.0 
    R_tag_to_fixed:  0.0 -1.0  0.0 
                     1.0  0.0  0.0 
                     0.0  0.0  1.0 
Failed to load lens cal file /data/modalai/opencv_tracking_intrinsics.yml
```
I have also made a corresponding post on the [gitlab issues.](https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-tag-detector/-/issues/1) Any help is greatly appreciated.
Cheers,
Pawel

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 15:24:15 UTC

@PawelJ When you run the install script to flash the system image there is a prompt that asks if you want to preserve the /data partition where the calibration files are stored. Normally you preserve those unless you want to calibrate the cameras yourself. If the calibration files have been deleted then you need to get them replaced. You can run the calibration procedure yourself. The documentation is here: https://docs.modalai.com/calibrate-cameras/

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 15:24:59 UTC

@PawelJ ![cal.png](https://forum.modalai.com/assets/uploads/files/1625671496186-cal.png)

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 15:25:48 UTC

@PawelJ ```%YAML:1.0
---
M: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 2.7874039916528164e+02, 0., 3.3988271378331154e+02, 0.,
       2.7880227185614154e+02, 2.5258101356853410e+02, 0., 0., 1. ]
D: !!opencv-matrix
   rows: 4
   cols: 1
   dt: d
   data: [ -1.4185703635329491e-02, 2.1172901376532889e-02,
       -1.4431453715214168e-02, 3.4931558175981398e-03 ]
width: 640.
height: 480.
distortion_model: fisheye
```

## Reply by PawelJ · 2021-07-07 15:34:36 UTC

@Eric-Katzfey said in [voxl\-tag\-detector fails to start on V3\.3 &quot;Missing lens\_cal\_file&quot;](/post/1512):
> %YAML:1.0
> M: !!opencv-matrix
> rows: 3
> cols: 3
> dt: d
> data: [ 2.7874039916528164e+02, 0., 3.3988271378331154e+02, 0.,
> 2.7880227185614154e+02, 2.5258101356853410e+02, 0., 0., 1. ]
>  !!opencv-matrix
> rows: 4
> cols: 1
> dt: d
> data: [ -1.4185703635329491e-02, 2.1172901376532889e-02,
> -1.4431453715214168e-02, 3.4931558175981398e-03 ]
> width: 640.
> height: 480.
> distortion_model: fisheye

Hello @Eric-Katzfey I have scp'd that file over to the voxl, but the voxl-tag-detector still fails to start running. I try to restart it with `systemctl restart voxl-tag-detector`, but it comes up as `Not Running` in `voxl-inspect-services`. When I try running it in debug mode I get this printout.
```
yocto:~$ voxl-tag-detector -d
enabling debug mode
loading tag-detector config file
loading apriltag config file
=================================================================
detector #0
    enable:          1
    input_pipe:      tracking
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 1
    undistort_scale: 0.60
    overlay_name:    tracking_tag_overlay
    lens_cal_file:   /data/modalai/opencv_tracking_intrinsics.yml
    skip_n_frames:   5
detector #1
    enable:          0
    input_pipe:      stereo
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 1
    undistort_scale: 0.90
    overlay_name:    stereo_tag_overlay
    lens_cal_file:   /data/modalai/opencv_stereo_intrinsics.yml
    skip_n_frames:   5
detector #2
    enable:          0
    input_pipe:      extra
    en_fast_mode:    1
    n_threads:       1
    en_undistortion: 0
    undistort_scale: 1.00
    overlay_name:    extra_tag_overlay
    lens_cal_file:   /data/modalai/opencv_extra_intrinsics.yml
    skip_n_frames:   5
=================================================================
default_size_m:        0.173
#0:
    id:              0
    name:            default_name
    loc_type:        unknown
    size_m:            0.173
    T_tag_wrt_fixed: 0.0  0.0  0.0 
    R_tag_to_fixed:  0.0 -1.0  0.0 
                     1.0  0.0  0.0 
                     0.0  0.0  1.0 
Aborted

```
I recall having to reset the calibration files for the px4 when debugging an earlier problem with your team. I have gone through and recalibrated those sensors already. Unless they are linked ot the px4 parameters, I have not removed any camera calibration files.

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 15:39:49 UTC (in reply to PawelJ)

@PawelJ Yes, I think it is related to the system image flash procedure https://docs.modalai.com/flash-system-image/ It will wipe the /data partition where the calibration files exist unless you tell it not to do that.

## Reply by PawelJ · 2021-07-07 15:40:25 UTC (in reply to Eric Katzfey)

@Eric-Katzfey I did not wipe the /data partition during the reinstall

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 16:09:07 UTC (in reply to PawelJ)

@PawelJ We will investigate this and see why you lost the calibration files when flashing 3.3.0 system image.

## Reply by PawelJ · 2021-07-07 16:21:13 UTC (in reply to Eric Katzfey)

@Eric-Katzfey do you have any suggestions to get this up and running? I am just trying to get the default system features working at the moment. I have added the missing calibration file, but it still appears to be failing.

## Reply by Eric Katzfey (ModalAI staff) · 2021-07-07 16:36:36 UTC (in reply to PawelJ)

@PawelJ Bear with us. Our subject matter experts are out on summer vacation this week.

## Reply by PawelJ · 2021-07-07 20:00:54 UTC

Yes of course, it's the time of year for a vacation :). Just an update....as I was working on some tflite portions of my project I noticed that the `qvio-server` was down now, but was not prior to adding the calibration file. If I run it in debug mode it provides a more helpful printout and shows that there is an error in loading the calibration file.
```
yocto:~$ voxl-qvio-server 
loading qvio config file
=================================================================
imu_name:                         imu1
cam_name:                         tracking
odr_hz:                           30.000
use_camera_height_bootstrap:      1
camera_height_off_ground_m:        0.100
enable_init_while_moving:         1
cam_imu_timeshift_s:               0.002
cam_imu_timeshift_s_uncertainty:   0.001
T_cam_wrt_imu_uncertainty:         0.005  0.005  0.005
R_cam_to_imu_uncertainty:          0.040  0.040  0.040
accl_fsr_ms2:                     156.000
gyro_fsr_rad:                     34.000
accl_noise_std_dev:                0.316
gyro_noise_std_dev:                0.010
cam_noise_std_dev:                100.000
min_std_pixel_noise:               0.500
fail_high_pixel_noise_points:      1.665
limited_imu_bw_trigger:           35.000
gps_imu_time_alignment_s:          0.000
T_gps_wrt_imu:                    -0.115  0.450  0.100
enable_mapping:                   1
enable_gps_vel:                   0
=================================================================
setting scheduler
WARNING Failed to set priority, errno = 1
This seems to be a problem with ADB, the scheduler
should work properly when this is a background process
ERROR failed to set scheduler
loading extrinsics config file
#0:
    parent:                imu1
    child:                 tracking
    T_child_wrt_parent:    0.017   0.015   0.013 
    RPY_parent_to_child:   0.0    45.0    90.0  
    R_child_to_parent:     0.000  -0.707   0.707 
                           1.000   0.000  -0.000 
                          -0.000   0.707   0.707 
tbc:   0.017  0.015  0.013
ombc:  0.614  0.614  1.482 (axis angle)
ombc:  0.000 45.000 90.000 (RPY deg)
loading /data/modalai/opencv_tracking_intrinsics.yml
terminate called after throwing an instance of 'YAML::BadSubscript'
  what():  operator[] call on a scalar
Aborted
```
Here is the what the file looks like
```
%YAML:1.0
M: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.7874039916528164e+02, 0., 3.3988271378331154e+02, 0.,
2.7880227185614154e+02, 2.5258101356853410e+02, 0., 0., 1. ]
D: !!opencv-matrix
rows: 4
cols: 1
dt: d
data: [ -1.4185703635329491e-02, 2.1172901376532889e-02,
-1.4431453715214168e-02, 3.4931558175981398e-03 ]
width: 640.
height: 480.
distortion_model: fisheye
```
Cheers

## Reply by PawelJ · 2021-07-09 23:01:14 UTC

Got the problem sorted out.
```
%YAML:1.0
M: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 2.7874039916528164e+02, 0., 3.3988271378331154e+02, 0.,
       2.7880227185614154e+02, 2.5258101356853410e+02, 0., 0., 1. ]
D: !!opencv-matrix
   rows: 4
   cols: 1
   dt: d
   data: [ -1.4185703635329491e-02, 2.1172901376532889e-02,
       -1.4431453715214168e-02, 3.4931558175981398e-03 ]
   width: 640.
   height: 480.
   distortion_model: fisheye
```
Cheers

## Reply by wilkinsaf · 2025-10-15 17:31:00 UTC (in reply to PawelJ)

If anyone has run into this again, 

ensure you update your `/etc/modalai/voxl-tag-detector.conf` to the tracking camera pipe you would like to do the april tag detection on. 

the "tracking" has gotten update to "tracking_down" or "tracking_front"
