Class PathRecorder


  • public class PathRecorder
    extends java.lang.Object
    A utility for recording paths.
    • Constructor Summary

      Constructors 
      Constructor Description
      PathRecorder​(java.lang.String file, Units.LENGTH distanceUnits)
      Creates a new PathRecorder writing to the given file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeFile()
      Closes the path file after recording.
      void flushFile()
      Forces the PathRecorder to update the path file.
      java.lang.String getFilePath()
      Returns the absolute file path of the Path that the PathRecorder is writing to.
      void init()
      Opens the path file and prepares PathRecorder to write to it.
      void recordPoint​(Point2D point)
      Updates the PathRecorder with the current robot position.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathRecorder

        public PathRecorder​(java.lang.String file,
                            Units.LENGTH distanceUnits)
        Creates a new PathRecorder writing to the given file.
        Parameters:
        file - The absolute file path of the file to record to.
        distanceUnits - The units of length to use.
    • Method Detail

      • init

        public void init()
        Opens the path file and prepares PathRecorder to write to it. This method MUST be called before recording a path or the path will never actually be written.
      • closeFile

        public void closeFile()
        Closes the path file after recording.
      • recordPoint

        public void recordPoint​(Point2D point)
        Updates the PathRecorder with the current robot position. PathRecorder will decide if the point should be recorded and also if the file should be updated.
        Parameters:
        point - The current robot position and heading.
      • flushFile

        public void flushFile()
                       throws java.io.IOException
        Forces the PathRecorder to update the path file.
        Throws:
        java.io.IOException - If the file operation fails.
      • getFilePath

        public java.lang.String getFilePath()
        Returns the absolute file path of the Path that the PathRecorder is writing to.
        Returns:
        Path to the currently recording file, as a String.