AprilTags nedir?

Jenerik robotlara iliştirilmiş AprilTag güvenilir hedeflerinin gösterimi.

AprilTags, birçok farklı uygulama için düşük ek yük, yüksek doğrulukta yerelleştirme sağlamak üzere Michigan Üniversitesi’ndeki araştırmacılar tarafından geliştirilmiş bir görsel etiketler sistemidir.

Etiket sistemi ve yaratıcılarıyla ilgili detaylı bilgiye ilgili internet sitesinden ulaşılabilir. <https://april.eecs.umich.edu/software/apriltag>`__ Bu belge FIRST robotik ile ilgili amaçlar için içeriği özetlemeyi amaçlar.

FRC uygulaması

FRC şartlarında, AprilTag’ler, robotunuzun sahada nerede olduğunu bilmesine yardımcı olmak için yararlıdır, böylece robotunuzu bir hedef konumuna hizalayabilir.

AprilTag’ler 2011’den beri geliştirilmektedir ve saptama sağlamlığını ve hızını artırmak için yıllar içinde geliştirilmiştir.

2023’ten itibaren FIRST, bir dizi etiket sağlıyor. <https://www.firstinspires.org/robotics/frc/blog/2022-2023-approved-devices-rules-preview-and-vision-target-update>`__alana dağılmış, her biri bilinen bir :term`poz`da.

Etiketlerin tamamı 16h5 ailesindendir.

Not

Bu belgedeki resimlerin çoğu, aslında FRC için kullanılan 16h5’e benzeyen (ancak aynı olmayan) 36h11 ailesindendir. Tüm temel kavramlar aynıdır.

What is the 16h5 family?

The AprilTag library implementation defines standards on how sets of tags should be designed. Some of the possible tag families are described here.

FIRST has chosen the 16h5 family for 2023. This family of tags is made of a 4x4 grid of pixels, each representing one bit of information. An additional black and white border must be present around the outside of the bits.

\(2^{16} = 65536\) teorik olası etiket varken aslında sadece 30 tanesi kullanılmaktadır. Bunlar şu sebepler için seçilir:

  1. Bazı bit çevirmelerine karşı dikkatli olun (IE, bir bitin renginin yanlış tanımlandığı sorunlar).

  2. Etiket olmayan şeylerde bulunması muhtemel “basit” geometrik desenleri içermez. (IE, kareler, çizgiler vb.)

  3. Geometrik desenin, hangi yolun yukarı olduğunu her zaman anlayabilmeniz için yeterince asimetrik olduğundan emin olun.


Tüm etiketler, etiketin ana “gövdesi” 6 inç uzunluğunda olacak şekilde yazdırılacaktır.

Bir FRC AprilTag referans hedefinin boyutlarını gösteren diyagram.

Evde kullanım için, etiket dosyalarının çıktısı alınabilir ve çalışma alanınızın etrafına yerleştirilebilir. İşleme algoritması etiketlerin düz olduğunu varsaydığından, etiketin düz kalmasını sağlamak için bunları sert bir destek malzemesine monte edin.

Yazılım Desteği

The main repository for the source code that detects and decodes AprilTags is located here.

WPILib, FRC için yeni özellikler eklemek üzere depoyu ayırdı. Bunlar içerilir:

  1. Raspberry Pi ve roboRIO dahil olmak üzere , yaygın FRC hedefleri için kaynak kodu oluşturmak

  2. Java’dan işlevselliğini çağırmaya izin vermek için Java Yerel Arayüz (JNI) desteği ekleme

  3. Gradle & Maven yayınlama desteği

İşleme Tekniği

Çoğu FRC ekibinin bir kamera görüntüsünde AprilTag’leri tanımlamak için kendi kodlarını uygulaması gerekmese de, temeldeki kitaplıkların nasıl çalıştığının temellerini bilmek yararlıdır.

Original, unprocessed image

An image from a camera is simply an array of values, corresponding to the color and brightness of each pixel.

Usage

2D Alignment

A simple strategy for using targets is to move the robot until the target is centered in the image. Assuming the field and robot are constructed such that the gamepiece, scoring location, vision target, and camera are all aligned, this method should proved a straightforward method to automatically align the robot to the scoring position.

Using a camera, identify the centroid of the AprilTags in view. If the tag’s ID is correct, apply drivetrain commands to rotate the robot left or right until the tag is centered in the camera image.

This method does not require calibrating the camera or performing the homography step.

3D Alignment

../../../../_images/homography.png

A more advanced usage of AprilTags is to use their corner locations to help perform on-field localization.

Each image is searched for AprilTags using the algorithm described on this page. Using assumptions about how the camera’s lense distorts the 3d world onto the 2d array of pixels in the camera, an estimate of the camera’s position relative to the tag is calculated. A good camera calibration is required for the assumptions about its lens behavior to be accurate.

The tag’s ID is also decoded. from the image. Given each tag’s ID, the position of the tag on the field can be looked up.

Knowing the position of the tag on the field, and the position of the camera relative to the tag, the 3D geometry classes can be used to estimate the position of the camera on the field.

If the camera’s position on the robot is known, the robot’s position on the field can also be estimated.

These estimates can be incorporated into the WPILib pose estimation classes.

2D to 3D Ambiguity

The process of translating the four known corners of the target in the image (two-dimensional) into a real-world position relative to the camera (three-dimensional) is inherently ambiguous. That is to say, there are multiple real-world positions that result in the target corners ending up in the same spot in the camera image.

Humans can often use lighting or background clues to understand how objects are oriented in space. However, computers do not have this benefit. They can be tricked by similar-looking targets:

First optical illusion example of planar ambiguity First optical illusion example of planar ambiguity Second optical illusion example of planar ambiguity Third optical illusion example of planar ambiguity

Resolving which position is “correct” can be done in a few different ways:

  1. Use your odometry history from all sensors to pick the pose closest to where you expect the robot to be.

  2. Reject poses which are very unlikely (ex: outside the field perimeter, or up in the air)

  3. Ignore pose estimates which are very close together (and hard to differentiate)

  4. Use multiple cameras to look at the same target, such that at least one camera can generate a good pose estimate

  5. Look at many targets at once, using each to generate multiple pose estimates. Discard the outlying estimates, use the ones which are tightly clustered together.

Adjustable Parameters

Decimation factor impacts how much the image is down-sampled before processing. Increasing it will increase detection speed, at the cost of not being able to see tags which are far away.

Blur applies smoothing to the input image to decrease noise, which increases speed when fitting quads to pixels, at the cost of precision. For most good cameras, this may be left at zero.

Threads changes the number of parallel threads which the algorithm uses to process the image. Certain steps may be sped up by allowing multithreading. In general, you want this to be approximately equal to the number of physical cores in your CPU, minus the number of cores which will be used for other processing tasks.

Detailed information about the tunable parameters can be found here.

Further Learning

The three major versions of AprilTags are described in three academic papers. It’s recommended to read them in order, as each builds upon the previous: