Class Limelight.FieldMap
java.lang.Object
com.limelightvision.Limelight.FieldMap
- Enclosing class:
Limelight
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 Summary
Modifier and TypeMethodDescriptionstatic Limelight.FieldMapfromDeployFolder(String deployRelativePath) Reads an .fmap field map file from the deploy directory of the robot program (src/main/deployin the robot project).static Limelight.FieldMapfromString(String contents) Wraps .fmap contents.Returns why this field map is or is not usable.booleanisValid()Returns true if this holds a usable field map.intReturns the field map's size in bytes, or 0 when invalid.
-
Method Details
-
fromString
Wraps .fmap contents. Checks theLimelight.MAX_SHARED_MAP_BYTESsize 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
Reads an .fmap field map file from the deploy directory of the robot program (src/main/deployin 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
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
-