Apriltags
-
Hello!
I'm trying to use apriltag relocalization on my M500 drone for indoor localization. I'm doing some tests with a few tags and I see the position is correct according to the read tag when I run the command:voxl-vision-px4 -p
Once I confirm the configuration of the apriltags is correct, I wanted to send this data to PX4 so it corrects the position regarding the apriltags. To do that I have activate the flag
"en_transform_mavlink_pos_setpoints_from_fixed_frame": true,
set in the file /etc/modalai/voxl-vision-px4.conf and I try to read the local position but it seems it is not reading the tag because it does not correct the position.
I have also changed the parameter"fixed_frame_filter_len": 5
to 1 so local-to-fixed frame relation is completely determined by the most recent tag detection but I don't see any improvement.
I guess I not sending the apriltag information properly to PX4 and I would really appreciate some advise.
If this is the way to send the apriltag data to PX4, maybe there is a way to customize the EFK so apriltag has a bigger impact on the localization but looking at the documentation I couldn't find any information.Any idea what could be happening? Thank you in advance!
-
Hello,
The local position as reported by voxl-inspect-pose -l is always in local frame which is based purely on VIO without relocalization. fixed-frame position as reported by voxl-inspect-pose -f includes the relocalization.
PX4 is only ever aware of local frame as EKF2 does not handle discontinuities in video odometry, at least not at the time this was developed. Any relocalization is done inside voxl-vision-px4 by transforming desired setpoints in fixed frame to the equivalent setpoint in local frame before being sent to PX4.
This process is done here: https://gitlab.com/voxl-public/modal-pipe-architecture/voxl-vision-px4/-/blob/master/src/geometry.c#L607
I would also recommend setting the filter length back to the default. Having it at 1 will cause jerkiness each time an apriltag is reported due to the slight noise of the apriltag detection and pose estimate.
Best,
James -
@James-Strawson said in Apriltags:
xl-inspect-pose -l
Thank you for your help, James.
I was trying to test the package voxl-inspect-pose that you propose but I was having a problem with the camera and other packages, so I decided to flash the board.
I have loaded the image voxl_platform_3-3-0-0.4.6-b and I have successfully calibrated the tracking camera again. However, now when I try to validate the configuration of voxl-tag-detector package, it seems is not working properly because the location for the apriltag is not correct.To give more context. These are my configuration files:
- /etc/modalai/voxl-tag-detector.conf
/** * This file contains configuration parameters for voxl-tag-detector. * You can specify up to 3 cameras to do detection on simultaneously. * For the stereo camera pair, only the left camera is used. */ { "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
/** * Apriltag Location Configuration File * This file is used by voxl-tag-detector * * A tag can be flagged by the user as fixed, static, or dynamic. * * - fixed: The tag is at a known location in space as described by the * T_tag_wrt_fixed vector and R_tag_to_fixed rotation matrix. These fixed * tags are used by voxl-vision-px4 for apriltag relocalization. * * - static: A static tag can be trusted to be static (not moving) but does not * have a known location. For example, a landing pad. * * - dynamic: A dynamic tag can be expected to be in motion such as an object * to be tracked or followed dynamically. * * * If the tag is fixed then you must specify its location and rotation relative * to the fixed reference frame. Otherwise the translation and rotation * parameters can be ignored. * * The name parameter is currently only used for info prints but can be helpful * for the user to keep track of what tag is which. * * Each tag must have its size listed. Tags not listed will be assumed to have * size equal to the default_size. * * Currently only 36h11 apriltags are supported */ { "locations": [{ "id": 1, "name": "default_name", "loc_type": "unknown", "size_m": 0.106, "T_tag_wrt_fixed": [2, 2, 0], "R_tag_to_fixed": [[0, -1, 0], [1, 0, 0], [0, 0, 1]] }, { "id": 2, "name": "default_name", "loc_type": "unknown", "size_m": 0.106, "T_tag_wrt_fixed": [5, 5, 0], "R_tag_to_fixed": [[0, -1, 0], [1, 0, 0], [0, 0, 1]] }], "default_size_m": 0.106 }
I'm using two apriltags (tag 1 and tag 2, squares of 10.6 cm side) as a test to validate the configuration. When I run voxl-tag-detector -d to debug this is the ouput:
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.106 #0: id: 1 name: default_name loc_type: unknown size_m: 0.106 T_tag_wrt_fixed: 2.0 2.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 #1: [12/202] id: 2 name: default_name loc_type: unknown size_m: 0.106 T_tag_wrt_fixed: 5.0 5.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 exising instance of voxl-tag-detector found, attempting to stop it found cam matrix with name 'M' for detector #0 detector #0 is fisheye waiting for cam pipe tracking detector #0 connected to camera pipe tracking detector #0 initializing rectification map lens #0: fx:284.22 fy:283.34 cx:341.44 cy:231.37 lens #0: fxrect:170.53 fyrect:170.00 detector #0 done initializing rectification map detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.40 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.15 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.15 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.42 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.40 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.55 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.03 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.07 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 58.54 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.27 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.87 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.17 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.49 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.31 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.04 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 59.49 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 47.69 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 48.49 detector #0 id: 1 XYZ: 0.01 -0.01 0.13 ham: 0 margin: 62.21 detector #0 id: 1 XYZ: 0.02 -0.01 0.13 ham: 0 margin: 61.70 detector #0 id: 1 XYZ: 0.02 -0.01 0.14 ham: 0 margin: 50.28 detector #0 found 0 apriltags detector #0 id: 1 XYZ: 0.00 -0.13 0.20 ham: 0 margin: 68.84 detector #0 id: 2 XYZ: 0.01 -0.00 0.12 ham: 0 margin: 44.93 detector #0 id: 2 XYZ: 0.01 -0.00 0.12 ham: 0 margin: 30.21 detector #0 id: 1 XYZ: -0.09 -0.21 0.27 ham: 0 margin: 82.49 detector #0 id: 2 XYZ: 0.01 -0.00 0.12 ham: 0 margin: 48.51 detector #0 id: 1 XYZ: -0.09 -0.18 0.30 ham: 0 margin: 71.74 detector #0 id: 2 XYZ: 0.01 -0.00 0.13 ham: 0 margin: 47.61 detector #0 id: 2 XYZ: 0.01 -0.00 0.12 ham: 0 margin: 32.44 detector #0 id: 2 XYZ: 0.01 -0.00 0.12 ham: 0 margin: 32.16 detector #0 id: 2 XYZ: 0.01 -0.00 0.13 ham: 0 margin: 54.01 detector #0 id: 2 XYZ: 0.01 -0.00 0.13 ham: 0 margin: 53.53
I continue on the following post.
-
As you can see it is loading the proper configuration for the location of the tags and the camera to use (just the tracking camera) but the output is not showing the proper position in XYZ. I also checked that the voxl-vision-px4 package wasn't able to read the proper position of the tags using
voxl-vision-px4 -p
(like I did in the past) and this is the output:yocto:~$ voxl-vision-px4 -p [404/869] loading our own config file ================================================================= Parameters as loaded from config file: qgc_ip: 192.168.8.60 en_localhost_mavlink_udp 1 en_secondary_qgc: 0 secondary_qgc_ip: 192.168.1.214 qgc_udp_port_number: 14550 localhost_udp_port_number: 14551 udp_mtu: 512 en_vio: 1 en_voa: 0 en_send_vio_to_qgc: 0 en_send_voa_to_qgc: 0 en_set_clock_from_gps: 1 en_force_onboard_mav1_mode: 1 en_reset_px4_on_error: 1 qvio_auto_reset_quality: 0.000500 en_adsb: 0 adsb_uart_bus: 7 adsb_uart_baudrate: 57600 px4_uart_bus: 5 px4_uart_baudrate: 921600 offboard_mode: off follow_tag_id: 0 en_tag_fixed_frame: 1 fixed_frame_filter_len: 5 en_transform_mavlink_pos_setpoints_from_fixed_frame:1 ================================================================= loading extrinsics config file exising instance of voxl-vision-px4 found, attempting to stop it starting geometry module starting px4 monitor starting uart mavlink Successfully opened mavparser Detected PX4 Mavlink SYSID 106 starting udp mavlink Adding manual QGC IP address to udp connection list: 192.168.8.60 Added new UDP connection to 192.168.8.60 starting px4 shell starting fixed pose input starting vio manager starting tag manager Init complete, entering main loop Connected to voxl-tag-detector Connected to voxl-qvio-server done updating transforms to use imu: imu1 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 PX4 Connected over UART with sysid 106 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 -0.00 detected system time has already been set T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: -0.00 -0.04 0.00 T_body_wrt_fixed: -0.00 0.00 -0.10 RPY: 0.00 -0.04 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.01 -0.10 RPY: 0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.02 -0.10 RPY: -0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.02 -0.10 RPY: -0.00 -0.03 0.00 T_body_wrt_fixed: -0.01 0.02 -0.10 RPY: -0.01 -0.02 0.00 T_body_wrt_fixed: -0.02 0.02 -0.10 RPY: -0.01 -0.02 0.00 T_body_wrt_fixed: -0.02 0.01 -0.10 RPY: -0.01 -0.02 0.00 T_body_wrt_fixed: -0.02 0.01 -0.10 RPY: -0.03 -0.02 0.00 T_body_wrt_fixed: -0.02 0.01 -0.10 RPY: -0.03 -0.02 0.00 T_body_wrt_fixed: -0.02 0.01 -0.10 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.03 0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.03 0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.03 0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.03 0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.04 -0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.04 -0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.04 -0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.04 -0.00 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.05 -0.01 -0.09 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.05 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.05 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.06 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.06 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.06 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.07 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.07 -0.01 -0.08 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.07 -0.01 -0.07 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.08 -0.01 -0.07 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.08 -0.02 -0.07 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.08 -0.02 -0.07 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.09 -0.02 -0.07 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.09 -0.02 -0.06 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.09 -0.02 -0.06 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.10 -0.02 -0.06 RPY: -0.03 -0.03 -0.00 T_body_wrt_fixed: -0.10 -0.02 -0.06 RPY: -0.03 -0.02 -0.00 T_body_wrt_fixed: -0.11 -0.02 -0.06 RPY: -0.03 -0.02 -0.00 T_body_wrt_fixed: -0.11 -0.02 -0.06 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.11 -0.02 -0.06 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.12 -0.02 -0.06 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.12 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.12 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.13 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.13 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.14 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.14 -0.02 -0.05 RPY: -0.02 -0.02 -0.00 T_body_wrt_fixed: -0.14 -0.02 -0.05 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.15 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.15 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.16 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.16 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.16 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.17 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.17 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.18 -0.02 -0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.18 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.19 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.19 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.20 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.20 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.21 -0.02 -0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.21 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.22 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.22 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.23 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.23 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.24 -0.01 -0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.25 -0.01 -0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.25 -0.01 -0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.26 -0.01 -0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.26 -0.01 -0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.27 -0.01 -0.00 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.27 -0.01 -0.00 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.28 -0.01 -0.00 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.28 -0.01 0.00 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.29 -0.01 0.00 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.30 -0.01 0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.30 -0.01 0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.31 -0.01 0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.31 -0.01 0.01 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.32 -0.00 0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.33 -0.00 0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.33 -0.00 0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.34 -0.00 0.02 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.35 -0.00 0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.35 -0.00 0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.36 -0.00 0.03 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.37 0.00 0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.37 0.00 0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.38 0.00 0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.39 0.00 0.04 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.39 0.00 0.05 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.40 0.00 0.05 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.41 0.01 0.05 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.41 0.01 0.05 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.42 0.01 0.06 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.43 0.01 0.06 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.44 0.01 0.06 RPY: -0.02 -0.01 -0.00 T_body_wrt_fixed: -0.44 0.01 0.07 RPY: -0.02 -0.01 -0.00 VIO reported failure T_body_wrt_fixed: -0.42 0.01 0.05 RPY: -0.02 -0.02 0.00 T_body_wrt_fixed: -0.42 0.01 0.05 RPY: -0.02 -0.02 0.00
And I get the same behaviour, no proper read of apriltags. After running both packages I see the services are not running.
I have also checked the VIO executing voxl-inspect-qvio and everything seems ok.
Do you think it could be a problem of the calibration of the camera?
Maybe I'm missing other configuration but I achieved this point in the past so I'm not sure what could be happing.
I would really appreciate some advise. Thank you! -
Hello,
voxl-suite 0.4.6 is a little outdated now. You should be able to run opkg update and opkg upgrade to update to voxl-suite 0.5.0.
voxl-tag-detector and voxl-vision-px4 are meant to run as services in the background. If you launch them manually from the command line you will see something like:
existing instance of voxl-tag-detector found, attempting to stop it
Since two instances of the binary shouldn't run at the same time, it stops the background service first before continuing. The service would then need to be started again in the background with systemctl start voxl-tag-detector. Alternatively you can use the voxl-inspect-* tools which simply print output data published by the service without stopping the service. voxl-inspect-tags will show when tags are detected similar to voxl-tag-detector -d but in a less invasive way.
https://docs.modalai.com/voxl-inspect-tags/
Similarly, voxl-inspect-pose will show the local and fixed-frame locations of the drone without needing to launch voxl-vision-px4 manually which also kills the background instance of voxl-vision-px4.
10.6cm is very small for an Apriltag and it is unlikely the tracking camera will be able to identify it from the air. I see you are holding it very close (13cm) away in your debug prints. We typically use tags around 40cm large such that they can be seen from 2+ meters away with the wide fisheye lens.
Note that when the tags are detected, the output of voxl-inspect-tags and voxl-vision-px4 --debug-tag-cam will both print the location and rotation of the tag's coordinate frame with respect to the camera's coordinate frame. This relation has nothing to do with VIO or world/body coordinate frames. voxl-tag-detector only has the camera input stream available and is unaware of the camera's mounting position on the drone, or the drone's location in space. All coordinate transforms are done in voxl-vision-px4.
Running voxl-vision-px4 --debug-tag-local will show where it thinks the tag is with respect to the local coordinate frame (centered wherever VIO initialized). If the tag does not move, you should be able to move the drone around and the predicted location of the tag in local frame should remain mostly constant with a little noise from the detection error. (assuming the tag remains in view of the camera). I recommend running voxl-inspect-tags simultaneously in another window to ensure the tag is detected while doing this.
Although this video is based on an older software stack, the geometry and coordinate frames referenced have not changed. I hope this helps a little in understanding the debug outputs.
Let me know if this helps,
James -
Hello James,
Thank you for the advise. Unfortunately, I was not able to integrate voxl-tag-detector successfully.
Following your advise, I have updated voxl-suite to version 0.5.0 and I'm using bigger tags (17 cm side, similar to the size I see on the youtube video tutorial). I have done the following validations:-
Confirm the translation from tag (fixed frame) and camera is correct using voxl-inspect-tags. I can see the detected tag and if I move this I can see the change respect the camera frame. You can see the test here: https://mega.nz/file/lFZR1aJT#gSHf1sbKcQlhccJCSm45VDW2vipboTHdSlfrovpgtIE
-
Confirm the relation of the local frame and tag frame. I move the drone around the tag and I confirm the predicted location is constant. You can see the test here: https://mega.nz/file/wcp0FQiB#LeFZpCXG1ByPOzlq9VGfZhzgOJcIT0OmLCzY0_uktXo
While I'm reading the position of the local frame I also validated the tag is been read from voxl-portal. It is proven the local pose remain constant. -
Like in the tutorial (https://youtu.be/0j7CjmDvluM) I tried to confirm the odometry of the body respect the fixed frame (tag). I've done the same experiment but the position is not corrected by the tag. You can see the procedure here: https://mega.nz/file/FJg2VRaT#oh-wAnkhdNHYH97p3FMmIPTOxqCizJkxEGOB5M-D5No
Here is my configuration of /etc/modalai/voxl-vision-px4.conf:
/** * VOXL Vision PX4 Configuration File * */ { "qgc_ip": "192.168.1.46", "en_localhost_mavlink_udp": true, "en_secondary_qgc": false, "secondary_qgc_ip": "192.168.1.214", "qgc_udp_port_number": 14550, "localhost_udp_port_number": 14551, "udp_mtu": 512, "en_vio": true, "en_voa": false, "en_send_vio_to_qgc": false, "en_send_voa_to_qgc": false, "en_set_clock_from_gps": true, "en_force_onboard_mav1_mode": true, "en_reset_px4_on_error": true, "qvio_auto_reset_quality": 0.00050000002374872565, "auto_level_horizon_tol": 0.300000011920929, "voa_upper_bound_m": 1.25, "voa_lower_bound_m": 1.25, "en_adsb": false, "adsb_uart_bus": 7, "adsb_uart_baudrate": 57600, "px4_uart_bus": 5, "px4_uart_baudrate": 921600, "offboard_mode": "off", "follow_tag_id": 4, "en_tag_fixed_frame": true, "fixed_frame_filter_len": 5, "en_transform_mavlink_pos_setpoints_from_fixed_frame": true, "horizon_cal_tolerance": 0.300000011920929 }
and /etc/modalai/tag_locations.conf
{ "locations": [{ "id": 4, "name": "default_name", "loc_type": "unknown", "size_m": 0.17, "T_tag_wrt_fixed": [0, 0, 0], "R_tag_to_fixed": [[0, -1, 0], [1, 0, 0], [0, 0, 1]] }, { "id": 3, "name": "default_name", "loc_type": "unknown", "size_m": 0.17, "T_tag_wrt_fixed": [0, 4.8, 0], "R_tag_to_fixed": [[0, -1, 0], [1, 0, 0], [0, 0, 1]] }], "default_size_m": 0.17 }
I don't know if I'm not properly setting the configuration files or I don't understand how the package works. I've been working with the package before and I was able to reproduce the test of the 3rd point (body respect fixed frame).
Am I doing something wrong in my procedure?Once I have this last point working, since voxl-vision-px4 would handle the transformation from fixed to local frame and the flag
"en_transform_mavlink_pos_setpoints_from_fixed_frame"
is activated, the relocalization of the tag should be already included in the local pose. Is this correct?Thank you in advance!
-
-
Hello, thanks for the videos. I just noticed in /etc/tag_locations.conf your tags are listed as having an "unknown" location type. Change the location type (loc_type) from "unknown" to "fixed" and they will be accepted as valid for fixed-frame relocalization.
an environment may contain moving tags, or tags with unknown location. Therefore it in unsafe to assume every tag is in a fixed location. The header at the top of that configuration file explains in a little more detail:
* A tag can be flagged by the user as fixed, static, or dynamic. * * - fixed: The tag is at a known location in space as described by the * T_tag_wrt_fixed vector and R_tag_to_fixed rotation matrix. These fixed * tags are used by voxl-vision-px4 for apriltag relocalization. * * - static: A static tag can be trusted to be static (not moving) but does not * have a known location. For example, a landing pad. * * - dynamic: A dynamic tag can be expected to be in motion such as an object * to be tracked or followed dynamically. * * * If the tag is fixed then you must specify its location and rotation relative * to the fixed reference frame. Otherwise the translation and rotation * parameters can be ignored.
I'll update the public docs to make this process easier to get going.
Best,
James -
Thank you James!
Finally I got the voxl-tag-detector up and running changing the loc_type in the /etc/modalai/tag_locations.conf file from "unknown" to "fixed".