A comprehensive guide and documentation on implementation a minimalistic path following algorithm in FTC
Warning
This site assumes that you are already moderately-versed with the Java language the FTC SDK.
Tip
I aim to provide explanations and implementations of the different control systems to programmers of FTC regardless of their experience or prior knowledge level.
Tip
If your team does not want to invest money into expensive hardware such as encoders and dead wheels, this implementation may not be the right one for you.
Welcome! This website serves as a comprehensive documentation and guide on the implementation of field centric “pure pursuit” for Holonomic Drivetrains in FTC. This is intended to serve tips , sample code, and resources needed along with explanations and implementations of different control systems for accurate path following.
Any team looking to implement a minimalistic and time efficient path following algorithm in FTC will be able to do so by following the code and conceptual explanations in this documentation. My goal is that the code samples and concept sections will give simple explanations that will enable anyone to understand the algorithm completely and trouble shoot any problems they may incur.
Path follower implemented for a Mecanum Drivetrain
Path follower implemented for a Tank Drivetrain
This path follower can be implemented for both Tank and Mecanum drivetrains. However, there are some key differences between what is needed and how some methods are implemented for each respective drive train. Each page will contain one of the notification bars shown below:
[!ATTENTION] This is for both Tank and Mecanum Drivetrains
[!ATTENTION] This is only for Mecanum drivetrains
[!ATTENTION] This is only for Tank drivetrains
If the page does not contain implementations or explanations necessary for your drive train type, you may skip over it.
Tip
Make sure you know all of these topics thoroughly as it is the foundation for our path-following algorithm. Without knowing these topics, you will get lost as we progress through the difficult topics and concepts.
-
Understanding of simple Trigonometry (Cosine , Secant , Tangent, etc.)
-
Understanding of hardware (Motors , Encoders)
-
Basic Calculus (Derivatives , integrals)
-
Knowledge of the java programming knowledge
public static void main(String[] args) {
// An arraylist of type Point is initialized
ArrayList<Point> pathPoints = new ArrayList<>();
// Adding points to the array list
pathPoints.add(new Point(0 , 0));
pathPoints.add(new Point(0 , 25));
pathPoints.add(new Point(15 , 40));
// Storing the output of the method as a variable
boolean valueExists = xValueExists(pathPoints , 40);
// Printing the variable to view the result
System.out.println(valueExists);
}
/*
Method returns a boolean
Parameter pathPoints is of type ArrayList<Point>
Parameter xValue is of type double
*/
public static boolean xValueExists(ArrayList<Point> pathPoints , double xValue){
// Iterates through the list of points
for(int i = 0 ; i < pathPoints.size(); i ++){
/* If statement checks the x value of the current point in the iteration process is
equal to the x value you are looking for */
if(pathPoints.get(i).x == xValue){
return true;
}
}
// returns false if none of the x values of the points in the list were equal to the xValue
return false;
}