Skip to content

TurtleCompiler

The TurtleCompiler class helps turn your .turt files from the Turtle Tracer Visualizer into PedroPathing PathChains. It does this by reading the .turt file in JSON format and converting it into something usable.


Property Value
Package Path org.firstinspires.ftc.teamcode.Paths
Type Utility / Compiler / Autonomous

public static String readAssetFile(InputStream is)

This method is used to convert an InputStream containing data from a .turt file into a String so that it can be used later in the compiler.

Parameter Type Description
is InputStream Data extracted from a .turt file.
Type Description
String Returns a String containing the information extracted from the .turt file.
private static PathChain compileLine(Line line, Pose startPose, Follower follower)

This method is used to compile a custom Line into a format usable my PedroPathing

Parameter Type Description
line Line A singular line from a .turt file
startPose Pose The start position for the line, either comes from a previous line or start of the .turt file
follower Follower Follower instance, should come straight from the Auto as to prevent having several instances of the same thing
Type Description
PathChain Returns the singular line as a pathChain so it can be appended to a list of them
public static PathProgram compile(TurtleFile file, Follower follower, AutoConfiguration config)

This method is used to compile your Turt file data into a singular PathProgram which a follower can run.

Parameter Type Description
file TurtleFile Contains the startPoint, lines to follow, and sequence of them.
follower Follower Needed so that it can call compileLine as to not copy and paste the same code
config AutoConfiguration Tells the method how many rows, and shots it needs.
Type Description
PathProgram Contains a list of the paths, and their names so that it can be used in TurtleRunner to be converted into a PathChain