Class Limelight.FieldMap

java.lang.Object
com.limelightvision.Limelight.FieldMap
Enclosing class:
Limelight

public static final class Limelight.FieldMap extends Object
An immutable, validated shared field map. It holds the contents of an .fmap file. Create it one time during robot initialization. All file IO and size validation happen at that time. Then publish it at any time with Limelight.setSharedMap(FieldMap):
// robotInit
FieldMap fieldMap = Limelight.FieldMap.fromDeployFolder("field");
Limelight.setSharedMap(fieldMap);

A failed load produces an instance where isValid() is false.

  • Method Details

    • fromString

      public static Limelight.FieldMap fromString(String contents)
      Wraps .fmap contents. Checks the Limelight.MAX_SHARED_MAP_BYTES size cap one time.
      Parameters:
      contents - The .fmap field map file contents
      Returns:
      The wrapped field map. Not valid when null, empty, or too large
    • fromDeployFolder

      public static Limelight.FieldMap fromDeployFolder(String deployRelativePath)
      Reads an .fmap field map file from the deploy directory of the robot program ( src/main/deploy in the robot project). If the read fails, this method prints a warning and returns a field map that is not valid.
      Parameters:
      deployRelativePath - The field map file relative to the deploy directory, for example "field" or "maps/field.fmap". ".fmap" is added when missing
      Returns:
      The loaded field map. Check isValid()
    • isValid

      public boolean isValid()
      Returns true if this holds a usable field map.
      Returns:
      True if this holds a usable field map
    • getLoadStatus

      public Limelight.LoadStatus getLoadStatus()
      Returns why this field map is or is not usable.
      Returns:
      Why this field map is or is not usable
    • sizeBytes

      public int sizeBytes()
      Returns the field map's size in bytes, or 0 when invalid.
      Returns:
      The field map's size in bytes, or 0 when invalid