Class TrcTankMotionProfile

java.lang.Object
trclib.archive.TrcTankMotionProfile

public class TrcTankMotionProfile extends Object
This class implements a motion profile for tank drive that consists of paths for the left and right wheels.
  • Field Details

    • leftPath

      private final TrcPath leftPath
    • rightPath

      private final TrcPath rightPath
  • Constructor Details

    • TrcTankMotionProfile

      public TrcTankMotionProfile(TrcWaypoint[] leftPoints, TrcWaypoint[] rightPoints)
      Constructor: Create an instance of the object.
      Parameters:
      leftPoints - specifies an array of waypoints for the left wheels.
      rightPoints - specifies an array of waypoints for the right wheels.
  • Method Details

    • loadProfileFromCsv

      public static TrcTankMotionProfile loadProfileFromCsv(String leftPath, String rightPath, boolean loadFromResources)
      This method loads the left and right path waypoints from CSV files either on external file system or embedded in resources.
      Parameters:
      leftPath - specifies the left CSV path on the external file system or CSV name embedded in resources.
      rightPath - specifies the right CSV path on the external file system or CSV name embedded in resources.
      loadFromResources - specifies true if the CSV file is embedded in resources, false if on file system.
      Returns:
      created motion profile.
    • loadProfileFromCsv

      public static TrcTankMotionProfile loadProfileFromCsv(String leftPath, String rightPath)
      This method loads the left and right path waypoints from CSV files on external file system.
      Parameters:
      leftPath - specifies the left CSV path on the external file system.
      rightPath - specifies the right CSV path on the external file system.
      Returns:
      created motion profile.
    • getLeftPoints

      public TrcWaypoint[] getLeftPoints()
      This method returns the an array of waypoints for the left wheel path.
      Returns:
      array of waypoints.
    • getRightPoints

      public TrcWaypoint[] getRightPoints()
      This method returns the an array of waypoints for the right wheel path.
      Returns:
      array of waypoints.
    • getNumPoints

      public int getNumPoints()
      This method determines the number of waypoints in the motion profile.
      Returns:
      number of waypoints in the motion profile.
    • getMinTimeStep

      public double getMinTimeStep()
      This method returns the minimum time step in the motion profile.
      Returns:
      minimum time step.
    • scale

      public void scale(double worldUnitsPerEncoderTick, double timeStep)
      This method scales the motion profile by distance and time.
      Parameters:
      worldUnitsPerEncoderTick - specifies the number of world units in a single encoder tick.
      timeStep - specifies the speed denomination in seconds.
    • copy

      public TrcTankMotionProfile copy()
      This method returns a copy of this motion profile.
      Returns:
      a copy of this motion profile.