pathflip
v4.1.3
Published
[](https://github.com/jonahsnider/pathflip/actions/workflows/ci.yml)
Readme
🛹 Pathflip
Pathflip is a CLI tool for FRC teams to mirror Java autonomous routines from one side of the field to the other.
Write and tune an auto for one side (e.g. RightIntegratedAuto), then use Pathflip to produce the mirrored version (e.g. LeftIntegratedAuto).
Developed for Team 581.
Install
npm install -g pathflipUsage
pathflip <input-file> [--config path]Options
--config, -c— Path topathflip.config.pkl. If omitted, Pathflip walks up from the input file's directory to find one.
Example
pathflip comp-bot/src/main/java/frc/robot/autos/auto_state_machines/RightIntegratedAuto.javaConfig
Create a pathflip.config.pkl in your project root:
amends "package://pkg.pkl-lang.org/github.com/jonahsnider/pathflip/[email protected]#/src/config.pkl"
fieldHeight = 8.069
replacements {
["Right"] = "Left"
["right"] = "left"
["RIGHT"] = "LEFT"
["Left"] = "Right"
["left"] = "right"
["LEFT"] = "RIGHT"
}
negateConstants {
"BUMP_OFFSET"
}The amends line is optional but recommended — it provides type checking and editor support via the published Pkl package.
| Key | Description |
|-----|-------------|
| fieldHeight | Field height in meters, used to flip Pose2d Y-coordinates (y' = fieldHeight - y) |
| replacements | Simultaneous find-and-replace pairs (both directions must be listed) |
| negateConstants | Names of private static final double constants whose values should be negated |
Transformations
Applied in order:
- Pose2d Y-flip —
new Pose2d(x, y, ...)→new Pose2d(x, fieldHeight - y, ...) - Rotation2d.fromDegrees negation — Simple numbers are negated;
180 + X↔180 - X - Rotation2d constant swap —
kCW_90deg↔kCCW_90deg - Constant sign negation — Configured constants have their values negated
- String multi-replace — Simultaneous replacement using the
replacementsmap
