Vision - AvionCargo-UL/SkyAvionics GitHub Wiki

Package purpose

The purpose of the vision package is to provide functionality for accessing the camera feed, applying filters, detecting ArUco markers, and returning the detected markers.

VisionThread

The VisionThread class serves as the entry point and main loop for the vision package. Its primary responsibility is to continuously retrieve the camera feed and provide the current frame to the ArucoDetector for marker detection.

Responsibilities

  • Camera Feed: Captures live video frames from the camera.
  • Frame Processing: Passes the captured frames to the ArucoDetector to detect ArUco markers in real-time.
  • Continuous Loop: Runs in a loop to process frames continuously until the application stops the thread.

:warning: For the moment, thread is not able to return arUco markers to the main thread.

ArucoAngleResolver

The ArucoAngleResolver class serves to calculate angle of the arUco code based on the camera point of view.

Usage

In order to operate this class, you will need to pass the camera_distortion and camera_matrix.

[!TIP] See How to configure camera section to know about these two parameters.

Why flipping axis ?

TAG:                    CAMERA:

      A y                     X--------> x
      |                       | frame center
      |                       |
      | tag center            |
      O---------> x           V y

In order to have the same orientation as our camera, we flip the tag coordinate representation using the code from __create_flip_orientation_matrix method.

flip_rotation_matrix[0, 0] = 1.0
flip_rotation_matrix[1, 1] = -1.0
flip_rotation_matrix[2, 2] = -1.0