# AprilTag relocalization issues

Source: https://forum.modalai.com/topic/2237/apriltag-relocalization-issues
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2023-06-08 11:05:29 UTC by planch98
Replies: 0 · Views: 459

## planch98 · 2023-06-08 11:05:29 UTC

Hi,

I'm trying to setup the tag-detector module to perform relocalization with fixed apriltags. I've enabled the service through the command: voxl-configure-tag-detector and setup the files according to the guide, even though some files and parameters names are different.

The command voxl-vision-hub -m detects properly the distances between camera and tag.
Also by running voxl-vision-hub -p it seems that the coordinates that the scripts returns are correct.
However, when I tried to start the drone offset from the origin and I framed the tag nothing happened. I am expecting that the odometry of the drone shifts to the fixed frame coordinate.

How can I solve the issue?

Here below all the information that I think could be relevant:

voxl-version output:
--------------------------------------------------------------------------------
system-image: 1.4.1-M0054-14.1a-perf
kernel:       #1 SMP PREEMPT Thu Oct 13 17:48:16 UTC 2022 4.19.125
--------------------------------------------------------------------------------
hw version:   M0054
--------------------------------------------------------------------------------
voxl-suite:   
--------------------------------------------------------------------------------
Packages:
Repo:  http://voxl-packages.modalai.com/ qrb5165 staging
Last Updated: 2023-05-31 14:22:56
List:
	libmodal-cv            0.3.1-202305281402
	libmodal-exposure      0.0.8-202305241844
	libmodal-journal       0.2.2-202211021731
	libmodal-json          0.4.3-202209281920
	libmodal-pipe          2.8.4-202305292215
	libqrb5165-io          0.2.0-202212220203
	libvoxl-cci-direct     0.1.5-202210121755
	libvoxl-cutils         0.1.1-202210072352
	mv-voxl                0.1-r0
	qrb5165-bind           0.1-r0
	qrb5165-dfs-server     0.1.0-202210072209
	qrb5165-imu-server     0.6.0-202303302223
	qrb5165-slpi-test-sig  01-r0
	qrb5165-system-tweaks  0.1.7-202304211703
	qrb5165-tflite         2.8.0-2-202210071637
	voxl-camera-server     1.5.4
	voxl-ceres-solver      1.14.0-9-202208221901
	voxl-configurator      0.2.3-202305261144
	voxl-cpu-monitor       0.4.5-202305271751
	voxl-eigen3            3.4.0-202210121638
	voxl-esc               1.1.1
	voxl-jpeg-turbo        2.1.3-4-202305271611
	voxl-lepton-server     1.1.0
	voxl-libuvc            1.0.7
	voxl-mapper            0.1.9-202304271751
	voxl-mavcam-manager    0.3.0
	voxl-mavlink-server    1.0.5
	voxl-modem             1.0.4-202305251139
	voxl-mongoose          7.7.0-1-202210072105
	voxl-mpa-to-ros        0.3.6-202304141005
	voxl-mpa-tools         1.0.1-202305021817
	voxl-nlopt             2.5.0-4-202210072358
	voxl-opencv            4.5.5-1-202305271610
	voxl-portal            0.5.8-202305271939
	voxl-qvio-server       0.9.2-202305041224
	voxl-slpi-uart-bridge  1.0.1-202304261509
	voxl-streamer          0.6.1-202305271548
	voxl-tag-detector      0.0.4-202206302112
	voxl-tflite-server     0.3.1-202209141826
	voxl-utils             1.3.0-202304261309
	voxl-uvc-server        0.1.4
	voxl-vision-hub        1.6.5
	voxl-voxblox           1.1.3-202209261707
	voxl2-system-image     1.4.1-r0
	voxl2-wlan             1.0-r0
--------------------------------------------------------------------------------

/etc/modalai/voxl-vision-hub.conf:

{
	"config_file_version":	1,
	"en_localhost_mavlink_udp":	false,
	"localhost_udp_port_number":	14551,
	"en_vio":	true,
	"vio_pipe":	"qvio",
	"secondary_vio_pipe":	"mvio",
	"en_reset_vio_if_initialized_inverted":	true,
	"vio_warmup_s":	3,
	"send_odom_while_failed":	false,
	"horizon_cal_tolerance":	0.5,
	"offboard_mode":	"figure_eight",
	"follow_tag_id":	0,
	"figure_eight_move_home":	true,
	"robot_radius":	0.300000011920929,
	"collision_sampling_dt":	0.1,
	"max_lookahead_distance":	1,
	"en_tag_fixed_frame":	true,
	"fixed_frame_filter_len":	5,
	"en_transform_mavlink_pos_setpoints_from_fixed_frame":	true,
	"en_voa":	true,
	"voa_upper_bound_m":	-0.15000000596046448,
	"voa_lower_bound_m":	0.15000000596046448,
	"voa_voa_memory_s":	1,
	"voa_max_pc_per_fusion":	100,
	"voa_pie_max_dist_m":	20,
	"voa_pie_min_dist_m":	0.25,
	"voa_pie_under_trim_m":	1,
	"voa_pie_threshold":	3,
	"voa_send_rate_hz":	20,
	"voa_pie_slices":	36,
	"voa_pie_bin_depth_m":	0.15000000596046448,
	"voa_inputs":	[{
			"enabled":	true,
			"type":	"point_cloud",
			"input_pipe":	"dfs_point_cloud",
			"frame":	"stereo_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	true,
			"type":	"point_cloud",
			"input_pipe":	"stereo_front_pc",
			"frame":	"stereo_front_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	true,
			"type":	"point_cloud",
			"input_pipe":	"stereo_rear_pc",
			"frame":	"stereo_rear_l",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}, {
			"enabled":	true,
			"type":	"tof",
			"input_pipe":	"tof",
			"frame":	"tof",
			"max_depth":	6,
			"min_depth":	0.15000000596046448,
			"cell_size":	0.079999998211860657,
			"threshold":	3,
			"x_fov_deg":	106.5,
			"y_fov_deg":	85.0999984741211,
			"conf_cutoff":	125
		}, {
			"enabled":	true,
			"type":	"rangefinder",
			"input_pipe":	"rangefinders",
			"frame":	"body",
			"max_depth":	8,
			"min_depth":	0.300000011920929,
			"cell_size":	0.079999998211860657,
			"threshold":	4,
			"x_fov_deg":	68,
			"y_fov_deg":	56,
			"conf_cutoff":	0
		}]
}

/etc/modalai/voxl-tag-detector.conf :

{
	"detector_0":	{
		"enable":	true,
		"input_pipe":	"tracking",
		"en_fast_mode":	true,
		"n_threads":	1,
		"en_undistortion":	true,
		"undistort_scale":	0.600000023841858,
		"overlay_name":	"tracking_tag_overlay",
		"lens_cal_file":	"/data/modalai/opencv_tracking_intrinsics.yml",
		"skip_n_frames":	5
	},
	"detector_1":	{
		"enable":	false,
		"input_pipe":	"stereo",
		"en_fast_mode":	true,
		"n_threads":	1,
		"en_undistortion":	true,
		"undistort_scale":	0.899999976158142,
		"overlay_name":	"stereo_tag_overlay",
		"lens_cal_file":	"/data/modalai/opencv_stereo_intrinsics.yml",
		"skip_n_frames":	5
	},
	"detector_2":	{
		"enable":	false,
		"input_pipe":	"extra",
		"en_fast_mode":	true,
		"n_threads":	1,
		"en_undistortion":	false,
		"undistort_scale":	1,
		"overlay_name":	"extra_tag_overlay",
		"lens_cal_file":	"/data/modalai/opencv_extra_intrinsics.yml",
		"skip_n_frames":	5
	}
}

/etc/modalai/tag_locations.conf:
{
	"locations":	[{
			"id":	0,
			"name":	"prova0",
			"loc_type":	"fixed",
			"size_m":	0.147,
			"T_tag_wrt_fixed":	[10, 20, 0],
			"R_tag_to_fixed":	[[0, -1, 0], [1, 0, 0], [0, 0, 1]]
		},
		{
                        "id":   1,
                        "name": "prova1",
                        "loc_type":     "fixed",
                        "size_m":       0.147,
                        "T_tag_wrt_fixed":      [5, 1, 0],
                        "R_tag_to_fixed":       [[0, -1, 0], [1, 0, 0], [0, 0, 1]]
                }],
	"default_size_m":	0.40000000596046448
}

voxl-inspect-services:

 Service Name         |  Enabled  |   Running   |  CPU Usage
---------------------------------------------------------------
 modallink-relink     | Disabled  | Not Running |  
 voxl-camera-server   |  Enabled  |   Running   |     0.0
 voxl-cpu-monitor     |  Enabled  |   Running   |     0.0
 voxl-dfs-server      | Disabled  | Not Running |  
 voxl-imu-server      |  Enabled  |   Running   |     0.0
 voxl-lepton-server   | Disabled  | Not Running |  
 voxl-mapper          | Disabled  | Not Running |  
 voxl-mavcam-manager  |  Enabled  |   Running   |     0.0
 voxl-mavlink-server  |  Enabled  |   Running   |     0.0
 voxl-modem           | Disabled  | Not Running |  
 voxl-portal          |  Enabled  |   Running   |     0.0
 voxl-qvio-server     |  Enabled  |   Running   |     0.0
 voxl-softap          | Disabled  | Not Running |  
 voxl-static-ip       | Disabled  | Not Running |  
 voxl-streamer        |  Enabled  |   Running   |     0.0
 voxl-tag-detector    |  Enabled  |   Running   |     0.0
 voxl-tflite-server   | Disabled  | Not Running |  
 voxl-time-sync       | Disabled  | Not Running |  
 voxl-uvc-server      | Disabled  | Not Running |  
 voxl-vision-hub      |  Enabled  |   Running   |     0.0
 voxl-wait-for-fs     |  Enabled  |  Completed  |  

The same happens when running the script on another board with another version reported here below. Other parameters are the same.

voxl-version 
--------------------------------------------------------------------------------
system-image: 1.4.1-M0054-14.1a-perf
kernel:       #1 SMP PREEMPT Thu Oct 13 17:48:16 UTC 2022 4.19.125
--------------------------------------------------------------------------------
hw version:   M0054
--------------------------------------------------------------------------------
voxl-suite:   0.9.5
--------------------------------------------------------------------------------
Packages:
Repo:  http://voxl-packages.modalai.com/ ./dists/qrb5165/sdk-0.9/binary-arm64/
Last Updated: 2023-05-26 15:27:09
List:
	libmodal-cv              0.2.3
	libmodal-exposure        0.0.7
	libmodal-journal         0.2.1
	libmodal-json            0.4.3
	libmodal-pipe            2.8.2
	libqrb5165-io            0.1.0
	libvoxl-cci-direct       0.1.5
	libvoxl-cutils           0.1.1
	mv-voxl                  0.1-r0
	qrb5165-bind             0.1-r0
	qrb5165-dfs-server       0.1.0
	qrb5165-imu-server       0.5.0
	qrb5165-slpi-test-sig    01-r0
	qrb5165-system-tweaks    0.1.5
	qrb5165-tflite           2.8.0-2
	voxl-bind                0.0.1
	voxl-camera-calibration  0.2.3
	voxl-camera-server       1.3.5
	voxl-cpu-monitor         0.3.0
	voxl-docker-support      1.2.4
	voxl-gphoto2-server      0.0.10
	voxl-jpeg-turbo          2.1.3-4
	voxl-libgphoto2          0.0.4
	voxl-libuvc              1.0.7
	voxl-logger              0.3.4
	voxl-mavlink             0.1.0
	voxl-mavlink-server      0.3.0
	voxl-modem               0.16.1
	voxl-mongoose            7.7.0-1
	voxl-mpa-to-ros          0.3.6
	voxl-mpa-tools           0.7.6
	voxl-opencv              4.5.5-1
	voxl-portal              0.5.0
	voxl-px4                 1.12.31
	voxl-px4-imu-server      0.1.2
	voxl-qvio-server         0.8.2
	voxl-remote-id           0.0.5
	voxl-streamer            0.4.1
	voxl-suite               0.9.5
	voxl-tag-detector        0.0.4
	voxl-tflite-server       0.3.1
	voxl-utils               1.2.2
	voxl-uvc-server          0.1.3
	voxl-vision-px4          1.4.0
	voxl2-system-image       1.4.1-r0
	voxl2-wlan               1.0-r0
--------------------------------------------------------------------------------
