class frc_apriltags.Utilities.AprilTagFieldLayout(tags: Sequence[AprilTag], fieldLength: float, fieldWidth: float, isRed: bool = False)

Bases: object

A class to store the positions of all known AprilTags

Parameters:
  • tags – A list of all known tags.

  • fieldLength – The length (y) of the field, in meters.

  • fieldWidth – The width (x) of the field, in meters.

  • isRed – If you are on the red alliance.

class Origin(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

kBlueAllianceWallRightSide = 'BlueWall'
kRedAllianceWallRightSide = 'RedWall'
enableLogging()

Enables logging for this class.

classmethod fromJson(name: str, isRed: bool)

Generates an field with AprilTags from the WPILib json file.

Parameters:
  • name – The name of the json file in the year-gamename format.

  • isRed – If you are on the red alliance.

getTagPose(id: int) Pose3d

Returns the Pose3d of the selected tag.

Returns:

A WPILib Pose3d object.

getTags()

Returns all the created tags

Returns:

All the tags on the field.

setOrigin(origin)

Sets the origin depending on the alliance color. The origins are calculated from the field dimensions. This transforms the Pose3d’s returned by getTagPose() to return the correct pose relative to a predefined coordinate frame.

Parameters:

origin – The predefined origin.