Skip to content

C++-based Choreo generator program#1485

Open
shueja wants to merge 19 commits into
SleipnirGroup:mainfrom
shueja:port-generator-to-cpp
Open

C++-based Choreo generator program#1485
shueja wants to merge 19 commits into
SleipnirGroup:mainfrom
shueja:port-generator-to-cpp

Conversation

@shueja

@shueja shueja commented May 17, 2026

Copy link
Copy Markdown
Collaborator

The goal here is to avoid Rust-C++ FFI in the portion of Choreo that translates .chor and .traj into TrajoptLib calls. This depends on wpiutil and wpimath for maintainability and reuse of existing resources. The choreo_core/include/data directory should be compilable with WITH_TRAJOPT not defined, in which case it will not depend on TrajoptLib and can be used on-robot.

Not marking it as a draft, even though it isn't ready, because I want review comments on the code architecture.

Comment thread choreo_core/include/data/expr.hpp Outdated
@github-actions github-actions Bot added the component: trajoptlib TrajoptLib label May 18, 2026

template <typename T>
struct Dimension {
inline static const std::string tag = "default value";

@calcmogul calcmogul Jun 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably use inline static constexpr std::string_view here since the string literals are constexpr and have global storage duration.

@shueja

shueja commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator Author

This PR makes schema changes but I do not intend to offer an upgrade path because the field coordinate system is changing.

Notable schema changes:

  • Silent breakage: coordinate system

    • Following WPILib, the field coordinate system is now (0,0) at field center with +x going towards the BLUE drivers instead of the RED drivers.
  • Samples/Sample Lists:

  • Robot config

    • now takes a list of Translations for bumper corners and wheel locations
    • motor model parameters reorganized in anticipation of current-based motor modeling
  • New variable types added

    • Translation (x: Length, y:Length). This is the same structure used for bumper corners and wheel locations in the robot config.
    • Region (x: Length, y:Length, heading: Angle, w: Length, h: Length). Depending on where this is used, it can represent an ellipse or a rectangle, with axis-rotation supported.
  • New expression dimensions added

    • Current (Amps)
    • KT (N*m per Amp)
    • KV (Volt*seconds per radian)
    • TBD: should we add Volts?
  • Constraints

    • KeepInLane now includes coordinates for its center line, with an option to have the solver use the constraint range start and end points. This increases flexibility while avoiding constraints requiring the context of the range start and end positions.
    • Planned to add Keep In Rect and Ellipse with axis-rotation support. KeepInCircle likely remains a separate constraint because of its special UI behavior and TrajoptLib setup.
  • Snapshot

    • Now is a full copy of parameters and robot config, not a version that converts Exprs to doubles. This takes more serialization space but allows reversion to the last generated settings.
  • Event marker

    • PathPlannerLib command association removed for now, @mjansen4857 has not yet decided what that will look like for 2027

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants