Package trclib.archive
Class TrcTankMotionProfile
java.lang.Object
trclib.archive.TrcTankMotionProfile
This class implements a motion profile for tank drive that consists of paths for the left and right wheels.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTrcTankMotionProfile
(TrcWaypoint[] leftPoints, TrcWaypoint[] rightPoints) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
This method returns a copy of this motion profile.This method returns the an array of waypoints for the left wheel path.double
This method returns the minimum time step in the motion profile.int
This method determines the number of waypoints in the motion profile.This method returns the an array of waypoints for the right wheel path.static TrcTankMotionProfile
loadProfileFromCsv
(String leftPath, String rightPath) This method loads the left and right path waypoints from CSV files on external file system.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.void
scale
(double worldUnitsPerEncoderTick, double timeStep) This method scales the motion profile by distance and time.
-
Field Details
-
leftPath
-
rightPath
-
-
Constructor Details
-
TrcTankMotionProfile
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
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
This method returns the an array of waypoints for the left wheel path.- Returns:
- array of waypoints.
-
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
This method returns a copy of this motion profile.- Returns:
- a copy of this motion profile.
-