Skip to content

Add "Field 2D x3" Widget#7

Open
RossRambotics wants to merge 9 commits into2702rebels:mainfrom
RossRambotics:main
Open

Add "Field 2D x3" Widget#7
RossRambotics wants to merge 9 commits into2702rebels:mainfrom
RossRambotics:main

Conversation

@RossRambotics
Copy link

Claude Code and I worked on this... I'm not a TS developer. I couldn't figure out how to use the chooser widget to subscribe to table values, so I hacked in the copy buttons.

Intended usage is:

  • Select in slot network table Pose2d of what your robot is aiming at and copy to Aim field

  • Select in slot network table Pose2d of where autodrive is going and copy it to Autodrive field

  • Select in slot network table Pose2d for robot (works like typical Field2d)

  • Select "auto" for rotation if you want the widget to automatically rotate to align with the robot operator's PoV.

    Add "Field 2D x3" Widget

    Summary

    • New widget: Field 2D x3 — A variant of the existing Field 2D widget that renders three simultaneous poses on the field:
      • Robot pose (green box, sized by bumper setting) — bound via the standard slot selector, same as Field 2D
      • Aim Pose2d (solid yellow circle) — configured by NT path in the props editor
      • Autodrive Pose2d (green X) — configured by NT path in the props editor
    • Auto orientation by alliance — A new "Auto (Alliance)" orientation mode (default) automatically switches between 90° portrait (red alliance) and
      270° portrait (blue alliance) by subscribing to nt:/FMSInfo. Manual landscape/portrait options remain available.
    • "Copy from Slot" buttons — The Aim and Autodrive path fields each have a button that copies the primary robot slot path as a starting point for
      editing.

    Architecture changes

    • src/widgets/types.ts — Added optional extraSlots(props) function to WidgetDescriptor, allowing widgets to declare additional NT subscription
      paths derived from props. Added optional slot field to WidgetEditorProps so editors can read the primary slot binding.
    • src/stores/Workspace.ts — getSlots() now collects paths from descriptor.extraSlots(props) in addition to primary slot bindings. updateWidgetProps
      now recalculates subscriptions so extra slots take effect immediately when a path is typed.
    • src/parts/WidgetPropsEditor.tsx — Passes the primary slot value into the widget's editor component.
    • src/specs/v1.ts — Added "field2dx3" to WidgetTypeValues.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants