Pose

struct Pose

A Pose object is created from a single Apriltag detection. Each Pose objecet contains four separate Pose_single objects, one for each frame of reference between the Apriltag and the robot. We prefer using extra memory instead of recomputing each of the four frames when we need them. The associated camera and tag ID is recorded, as well as the calculated error for the tag detection.

Subclassed by RobotPose

struct Pose_single

A single Pose with a translation vector and rotation matrix. Includes arithmetic and ostream operator overloads.

struct RobotPose : public Pose

A Pose object that describes the robots location in the global frame. Only the global Pose_single object has valid pose data.

struct TagArray

A data structure that organizes Poses based on tag_ids. Includes methods to add tags, clear stale tags and remove all tags. An ordered vector of NUM_TAG_IDS represents each of the possible tag_ids that can be detected, then for each tag_id, an inner vector contains all of the Poses that were detected for this tag_id. The size of the outer vector data is NUM_TAG_IDS, so to get the Poses for a tag with ID i, we must access the vector at index i-1 (data[i-1]).

Public Functions

inline explicit TagArray()

Create an empty TagArray of size NUM_TAG_IDS.

inline void ClearAll()

Remove all tags in the TagArray object.

inline void AddTag(const Pose &tag)

Add a tag to the data structure at the tag_id-1 index in data.

Parameters:

tag – The tag to be added

inline const int GetNumTags()

Get the number of tags in the data structure.

Returns:

The number of tags.

inline int ClearStale()

Remove all tags that are older than 150ms.

Returns:

The number of stale tags removed.