Exporting Code
Exporting Code
Section titled “Exporting Code”Turn your visualized paths into runnable robot code or shareable animations.
How to Export
Section titled “How to Export”The exporting process is simple and unified under a single dialog window.
- Open the Export Dialog: Click the Export button in the top-right corner of the visualizer’s navigation bar. Alternatively, use the shortcut Ctrl + Shift + J (or Cmd + Shift + J on macOS) to quick-open to Java mode.
- Select a Format: Use the segmented control at the top of the dialog to switch between Java Class, Sequential Command, Points Array, Animation, or .PP (JSON) formats.
- Adjust Options: Depending on the format you selected, customize the settings (such as “Generate Full Class”, “Package Name”, or Animation FPS) using the controls below the code preview.
- Save or Copy:
- Click Copy to Clipboard to quickly paste the generated code into Android Studio.
- Click Save to File to download the code as a
.java,.txt,.pp, or image file to your computer.
Java OpMode (Standard)
Section titled “Java OpMode (Standard)”Generates a complete, standalone OpMode for your autonomous routine. This does not support all the functionality of the program due to current limitaions.
- Full Class: Creates a ready-to-run file including the
OpModestructure, state machine, and path definitions. - Snippets: Uncheck “Generate Full Class” to get just the
PathChainconstruction code for copy-pasting into your own classes. - Hardcoded Paths: The geometry is baked into the Java file. You do not need to upload the
.ppfile to the robot. - Event Markers: Automatically generates
addEventMarkercalls and placeholder comments for registering your commands.
Command-Based (Recommended, Advanced)
Section titled “Command-Based (Recommended, Advanced)”Generates a SequentialCommandGroup for use with command-based frameworks.
- Supported Libraries:
- SolversLib: Standard integration.
- NextFTC: Experimental support.
- Dynamic Loading: This mode uses
PedroPathReaderto load path data from the.ppfile at runtime. You must upload your.ppfile to the robot for this to work. - Features: Automatically handles
FollowPath,Wait, and event triggers usingParallelRaceGroup.
Gradle setup
Section titled “Gradle setup”To use the command-based exports you need to add the JitPack repository and the PedroPathingPlus dependency to your teamcode Gradle configuration (for example, build.gradle):
repositories { maven { url 'https://jitpack.io' }}And add the dependency (use the newest release instead of the version shown):
implementation 'com.github.Mallen220:PedroPathingPlus:1.0.6'Other Formats
Section titled “Other Formats”- Points List: A raw array of coordinates (e.g.,
[(10, 10), (20, 20)]) for custom processing or debugging. - Project File (.pp): Download the source file to share with teammates or back up your work.
Animation Export
Section titled “Animation Export”Create high-quality visualizers to share your strategy.
- Formats:
- GIF: Best for compatibility (Discord, Slack).
- APNG: Higher quality with transparency support, and smaller file sizes.
- Quality Controls: Adjust FPS, Scale, and Quality to balance file size and visual fidelity.
Dialog Tools
Section titled “Dialog Tools”- Search (Ctrl+F): Quickly find specific lines or markers in the generated code.
- Package Name: Set your team’s package (e.g.,
org.firstinspires.ftc.teamcode) to fix imports automatically. - Save to File: Directly save
.javaor.txtfiles to your computer.