Skip to content

Add Choreo event markers with AutoFactory.bind() and a marker/binding guard #38

Description

@nlaverdure

Follow-up from #30.

Background

Choreo event markers, drawn in the GUI, fire named events along a trajectory. ChoreoLib connects commands to them in two ways:

  • AutoFactory.bind(name, command), where one binding covers every trajectory, and
  • per-trajectory triggers: atTime("name"), atPose("name", …), atTranslation("name", …).

We deferred this until mechanisms exist. For now the only placeholder autos are drive-out and branching examples.

Things to know before starting

  • Order matters for bind(). It applies only to trajectories created after it is called (AutoFactory.bind javadoc, v2027.0.0-alpha-3). In our pattern, each AutoMode builds its own AutoFactory, and subclasses load trajectories in their constructors. So the bindings have to be made in the AutoMode base constructor, before trajectory(ChoreoTraj) is called. Otherwise they silently do nothing.
  • Event names are typed as strings. Choreo's code generation covers trajectory names (ChoreoTraj) but not event names. A misspelled marker or binding fails silently.
  • A guard already exists. ChoreoProjectTest.trajectoriesHaveNoEventMarkers currently fails if any .traj has events. It is there to force this decision.

Tasks

  • Choose where the bindings live. For example, one table of event names to commands, applied in the AutoMode base constructor. Build it on Rebuilt's structure, not a new framework.
  • Replace trajectoriesHaveNoEventMarkers with a two-way check:
    • every marker name in a .traj file has a binding, and
    • every binding has at least one marker.
  • Add one marker to an example path, bind a visible command to it, and check in sim that it fires at the right time.

Done when

  • A marker drawn in Choreo runs its command in sim.
  • A misspelled marker or binding fails the guard test loudly.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions