Skip to content

feat: add AutoBuilder.configureDistanceBased for distance-based mode#3

Closed
JosephTLockwood wants to merge 1 commit into
feat/follow-path-distance-commandfrom
feat/auto-builder-distance-glue
Closed

feat: add AutoBuilder.configureDistanceBased for distance-based mode#3
JosephTLockwood wants to merge 1 commit into
feat/follow-path-distance-commandfrom
feat/auto-builder-distance-glue

Conversation

@JosephTLockwood

Copy link
Copy Markdown
Owner

Summary

Third and final PR in the distance-based path-following stack. Stacks on top of PR #2 (feat/follow-path-distance-command).

Adds four overloads of `AutoBuilder.configureDistanceBased(...)` that mirror the existing time-based `configure(...)` parameter shape:

Overload output type endConditions
1 (full) `BiConsumer<ChassisSpeeds, DriveFeedforwards>` explicit
2 `BiConsumer<...>` uses `EndConditions.defaults()`
3 `Consumer` explicit
4 `Consumer` uses `EndConditions.defaults()`

Sets the same `globals` fields as `configure(...)` and builds a `pathFollowingCommandBuilder` that creates `FollowPathDistanceCommand`. Explicitly leaves `pathfindingConfigured = false` since `PathfindingCommand` is intrinsically time-based; integrating distance-based pathfinding is a separate concern.

Why

First-class API parity with `configure(...)` so users can opt into distance-based mode with one call instead of wiring `configureCustom` themselves.

Tests

None added. PathPlannerLib has zero existing `AutoBuilder` unit tests because `RobotConfig`'s static initializer transitively loads WPILib NetworkTables JNI, which isn't available in pure-Java test scope. Following the same convention; verified via compile + `spotlessJavaCheck`.

`followPath(PathPlannerPath)` and the rest of the public `AutoBuilder` surface work transparently with distance-based mode -- they all delegate to the `pathFollowingCommandBuilder` lambda which now produces `FollowPathDistanceCommand`. The `pathfindToPose` / `pathfindThenFollowPath` family correctly throws when used in distance-based mode (the standard not-configured error).

Test plan

  • Existing 43 tests pass
  • `spotlessJavaCheck` clean
  • End-to-end smoke test in a real robot project (in progress)

Adds four overloads of configureDistanceBased that mirror the
existing time-based configure(...) parameter shape: full vs
Consumer-only output, with explicit end conditions vs defaults.

Sets the same globals fields as configure(...) and uses
FollowPathDistanceCommand as the path-following command builder.
Explicitly leaves pathfindingConfigured = false since
PathfindingCommand is intrinsically time-based; integrating
distance-based pathfinding is a separate concern.

No unit tests: RobotConfig's static initializer transitively loads
WPILib NT JNI, which isn't available in pure-Java test scope.
PathPlannerLib follows the same convention (no existing AutoBuilder
unit tests). Verified via compile + spotless.
@JosephTLockwood

Copy link
Copy Markdown
Owner Author

Re-targeting upstream against mjansen4857/pathplanner. See replacement PR there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant