Class FieldMapJson

java.lang.Object
frc.spectrumLib.vision.FieldMapJson

public final class FieldMapJson extends Object
A layout as WPILib AprilTagFieldLayout JSON, for a coprocessor to load.

Written here rather than by WPILib's serializer, which re-derives each quaternion: it writes the 2026 fields' -0.0 components as 0.0. FieldMapHash formats those as -0.0000 and 0.0000, so a coprocessor that hashed WPILib's output would never match the robot. This writes the numbers the robot hashes.

  • Method Details

    • of

      public static String of(AprilTagFieldLayout layout)
      The layout as JSON: {"tags":[{"ID","pose":{"translation":{x,y,z},"rotation": {"quaternion":{W,X,Y,Z}}}}],"field":{"length","width"}}, tags sorted by ID.
      Parameters:
      layout - the field map
      Returns:
      the JSON text