AprilTags do not work in voxl-vision-px4

  • Hi,
    I tried the inbuild AprilTag feature today but I can't get it to work and I have no idea what is going wrong. I strictly followed the instructions from the walkthrough video / text.

    The related config is very basic:

        "en_apriltag_fixed_frame": true,
        "fixed_apriltags": [
                "tag_id": 1,
                "R_tag_to_fixed": [
                    [0, -1, 0],
                    [1, 0, 0],
                    [0, 0, 1]
                "T_tag_wrt_fixed": [0, 0, 0]
        "en_transform_mavlink_pos_setpoints_from_fixed_frame": true,
        "en_fixed_frame_pipe": false,

    I set the tag-size to 0.16, as each square of the 8x8 tag grid is 2cm. A change of this parameter never had an effect to the detected tag position from voxl-vision-px4, which I find very strange.

    When I run voxl-vision-px4 -p for debug odometry in fixed frame I get lots of out of bounds warnings. A "first-detection" with a followed position "reset" of fixed frame does not happen.

    T_body_wrt_fixed: -0.00  0.00 -0.20  RPY:  0.00  0.00 -0.00
    T_body_wrt_fixed: -0.00  0.00 -0.20  RPY:  0.00  0.00  0.00
    WARNING, apriltag roll/pitch out of bounds

    Sometimes, the tag is detected and the position is set to the fixed frame which is way off. This causes voxl-vision-px4 to diverge within a few seconds, even if the drone does not move at all. It crashes in the end of that process and resets the frame.

    When I run voxl-test-vision-lib -a it prints

    ID:  1 hamming: 0 margin:89.98 XYZ:  0.67  0.06  1.85 RPY: -0.51  0.25  0.25 hz: 13.6

    which seams reasonable, even if there is a rotation offset (btw. This is in the frame of the camera right? The z-axis point 45 deg downwards away from the drone)

    I recalibrated the tracking camera and reset the config multiple times. Any idea what else could be wrong here? Here is a picture of the setup, it is very similar to your walkthrough video, the voxl is about 1 meter away in y and z directions.


    Any suggestions would be greatly appreciated!

  • Thank you for the very detailed report, that is extremely helpful. You were right to notice the translation did not update when you change the tag size. I found the documentation incorrectly listed the config file in which this parameter exists, it should be set in '/etc/modalai/vio_apriltag_app.xml' instead.

    Sorry for the confusion, I've updated the documentation.


    As a heads up, we will soon have a standalone apriltag detection service which will consolidate the tag-size parameter along with the ids, translations, and rotations into its own config file. This should make the setup process less confusing.

  • Thank you, with the correct config file for the tag size, the detected tag positions and rotations in voxl-test-vision-lib -a look quite accurate now!

    Unfortunately, this had no impact on the vio, it is still not detecting any April tag correct and I get lots of:

    WARNING, apriltag roll/pitch out of bounds
    WARNING, apriltag roll/pitch out of bounds

    But maybe this is not AprilTag related, as vio is reporting very high velocities, sometimes without any AprilTag visible:

    T_body_wrt_local: 1738.20 882.29 453.10  RPY:  0.11 -0.09 -0.38  velocity: 39.93 42.38  3.43
    VIO in failed state, restarting

    Most of the time, all values are increasing without any movement until it is in failed state.

    One more thing that comes to my mind, when I stream from the tracking camera (e.g. via the voxl_cam_ros node) it always streams an overexposed image:

    I have to set the exposure parameter down to 0.05 to get a "normal" image. Maybe your vio uses the overexposed images as well leading to strange results.

  • Never mind, I updated all packages and reset all configs and it appears to work great. Maybe a misconfiguration somewhere else.

    Thank you!

  • Glad you got it working, let me know if you have any more questions. Apriltag relocalization is still a fairly new feature with only me and a few other customers really using it extensively so any feedback is appreciated. Thank you!

Log in to reply