public class MecanumPathPlanner
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MecanumPathPlanner.MotorType
The location of a motor on the robot for the purpose of determining velocity.
|
Modifier and Type | Field and Description |
---|---|
double[][] |
heading |
double[][] |
leftFrontPath |
double[][] |
leftRearPath |
double[][] |
nodeOnlyPath |
double[][] |
origCenterVelocity |
double[][] |
origLeftFrontVelocity |
double[][] |
origLeftRearVelocity |
double[][] |
origPath |
double[][] |
origRightFrontVelocity |
double[][] |
origRightRearVelocity |
double[][] |
rightFrontPath |
double[][] |
rightRearPath |
double[][] |
smoothCenterVelocity |
double[][] |
smoothLeftFrontVelocity |
double[][] |
smoothLeftRearVelocity |
double[][] |
smoothPath |
double[][] |
smoothRightFrontVelocity |
double[][] |
smoothRightRearVelocity |
Constructor and Description |
---|
MecanumPathPlanner(double[][] path)
Constructor, takes a Path of Way Points defined as a double array of column vectors representing the global
cartesian points of the path in {x,y} coordinates and a third heading coordinate (in degrees).
|
Modifier and Type | Method and Description |
---|---|
void |
calculate(double totalTime,
double timeStep,
double robotTrackWidth,
double robotTrackLength)
This code will calculate a smooth path based on the program parameters.
|
void |
calcWheelPaths(double[][] smoothPath,
double robotTrackWidth,
double robotTrackLength)
Calculates all wheel paths based on robot track width and length
Big O: 2N
|
static double[][] |
doubleArrayCopy(double[][] arr)
Performs a deep copy of a 2 Dimensional Array looping thorough each element in the 2D array
BigO: Order N x M
|
void |
figure8Example() |
static double[] |
getXVector(double[][] arr)
Returns the first column of a 2D array of doubles
|
static double[] |
getYVector(double[][] arr)
Returns the second column of a 2D array of doubles
|
static double[] |
getZVector(double[][] arr)
Returns the third column of a 2D array of doubles
|
double[][] |
inject(double[][] orig,
int numToInject)
Method upsamples the Path by linear injection.
|
int[] |
injectionCounter2Steps(double numNodeOnlyPoints,
double maxTimeToComplete,
double timeStep)
This method calculates the optimal parameters for determining what amount of nodes to inject into the path
to meet the time restraint.
|
static void |
main(java.lang.String[] args) |
static double[][] |
nodeOnlyWayPoints(double[][] path)
reduces the path into only nodes which change direction.
|
static void |
print(double[] path) |
static void |
print(double[][] path)
Prints Cartesian Coordinates to the System Output as Column Vectors in the Form X Y Z
|
void |
setPathAlpha(double alpha) |
void |
setPathBeta(double beta) |
void |
setPathTolerance(double tolerance) |
void |
setVelocityAlpha(double alpha) |
void |
setVelocityBeta(double beta) |
double[][] |
smoother(double[][] path,
double weight_data,
double weight_smooth,
double tolerance)
Optimization algorithm, which optimizes the data points in path to create a smooth trajectory.
|
double[][] |
transformHeadingToGyroFrameOfRef(double[][] input) |
static double[][] |
transposeVector(double[][] arr) |
public double[][] origPath
public double[][] nodeOnlyPath
public double[][] smoothPath
public double[][] leftFrontPath
public double[][] leftRearPath
public double[][] rightFrontPath
public double[][] rightRearPath
public double[][] origCenterVelocity
public double[][] origLeftFrontVelocity
public double[][] origLeftRearVelocity
public double[][] origRightFrontVelocity
public double[][] origRightRearVelocity
public double[][] smoothCenterVelocity
public double[][] smoothLeftFrontVelocity
public double[][] smoothLeftRearVelocity
public double[][] smoothRightFrontVelocity
public double[][] smoothRightRearVelocity
public double[][] heading
public MecanumPathPlanner(double[][] path)
path
- public static void print(double[] path)
public static void print(double[][] path)
path
- public static double[][] doubleArrayCopy(double[][] arr)
arr
- public double[][] inject(double[][] orig, int numToInject)
orig
- numToInject
- public double[][] smoother(double[][] path, double weight_data, double weight_smooth, double tolerance)
path
- weight_data
- weight_smooth
- tolerance
- public static double[][] nodeOnlyWayPoints(double[][] path)
path
- public int[] injectionCounter2Steps(double numNodeOnlyPoints, double maxTimeToComplete, double timeStep)
numNodeOnlyPoints
- maxTimeToComplete
- timeStep
- public void calcWheelPaths(double[][] smoothPath, double robotTrackWidth, double robotTrackLength)
smoothPath
- - center smooth path of robotrobotTrackWidth
- - width between left and right wheels of robot of mecanum chassis.robotTrackLength
- - length from front to back of robot mecanum chassis.public static double[] getXVector(double[][] arr)
arr
- 2D array of doublespublic static double[] getYVector(double[][] arr)
arr
- 2D array of doublespublic static double[] getZVector(double[][] arr)
arr
- 2D array of doublespublic static double[][] transposeVector(double[][] arr)
public void setPathAlpha(double alpha)
public void setPathBeta(double beta)
public void setPathTolerance(double tolerance)
public void setVelocityAlpha(double alpha)
public void setVelocityBeta(double beta)
public void calculate(double totalTime, double timeStep, double robotTrackWidth, double robotTrackLength)
totalTime
- - time the user wishes to complete the path in seconds. (this is the maximum amount of time the robot is allowed to take to traverse the path.)timeStep
- - the frequency at which the robot controller is running on the robot.robotTrackWidth
- - distance between left and right side wheels of a mecanum drive chassis. Known as the track width.robotTrackLength
- - distance between front and rear wheels of a mecanum drive chassis. Known as track length.public double[][] transformHeadingToGyroFrameOfRef(double[][] input)
public static void main(java.lang.String[] args)
public void figure8Example()