Class PoseStore

java.lang.Object
com.crossbotics.ftchelper.util.PoseStore

public final class PoseStore extends Object
Passes the robot's last pose from Autonomous to TeleOp.

Both OpModes run in the same app, so a static value survives between them (until the app restarts). At the end of Auto call save(com.crossbotics.ftchelper.util.FieldPose); in TeleOp INIT call consume().

"static" means the value belongs to the class itself, not to one object, so there is only one copy and it stays while the robot app keeps running, even after the Auto OpMode ends.


 // End of Autonomous:
 PoseStore.save(new FieldPose(x, y, heading));

 // TeleOp INIT:
 FieldPose start = PoseStore.consume();   // null if Auto did not save one
 

For field-centric driving you do not need to call it yourself: DriverHeading takes the saved heading for you. Docs: docs/modules/util.md

  • Method Details

    • save

      public static void save(FieldPose pose)
      Saves a copy of the pose. A null pose is ignored.
      Parameters:
      pose - the robot's pose at the end of Autonomous
    • ageSec

      public static double ageSec()
      Seconds since the pose was saved. Very large if nothing is saved. A pose more than a few minutes old belongs to an earlier match.
    • peek

      public static FieldPose peek()
      Returns a copy of the saved pose and keeps it saved. Null if none.
    • has

      public static boolean has()
      True if a pose is saved.
    • consume

      public static FieldPose consume()
      Returns the saved pose and clears it, so it is used only once. Null if none. Why only once: an old pose from a match long ago must not be used as the start of the next one.
    • clear

      public static void clear()
      Forgets the saved pose.