Skip to content

Automate match team based on driver station#108

Merged
luanzeba merged 3 commits intoFRC2713:mainfrom
TheHighlanders:feat/remember-driver-station
Mar 10, 2026
Merged

Automate match team based on driver station#108
luanzeba merged 3 commits intoFRC2713:mainfrom
TheHighlanders:feat/remember-driver-station

Conversation

@ianonavy
Copy link
Copy Markdown
Contributor

@ianonavy ianonavy commented Mar 7, 2026

Hi! I'm a mentor from FRC 6201. We have a new feature to suggest. :)

Teams often assign scouts to focus on the same driver station across matches. This PR adds support for a special "driverStation" field value that, when set, automatically selects the team number based on their assigned driver station position.

The impact of this change is that scouts can "set and forget" their assigned driver stations. As soon as the form as reset and the match number is incremented, the correct team number is automatically selected. This saves scouts time and significantly reduces the likelihood of error, leading to more reliable scouting data for alliance selection.

Example config snippet:

        {
          "title": "Driver Station",
          "description": "If you are scouting the same driver station each match, choose here.",
          "type": "select",
          "required": false,
          "code": "driverStation",
          "formResetBehavior": "preserve",
          "defaultValue": "",
          "choices": {
            "R1": "Red 1",
            "R2": "Red 2",
            "R3": "Red 3",
            "B1": "Blue 1",
            "B2": "Blue 2",
            "B3": "Blue 3"
          }
        },

Teams often assign scouts to focus on the same driver station across
matches. This PR adds support for a special "driverStation" field value
that, when set, automatically selects the team number based on their
assigned driver station position.

The impact of this change is that scouts can "set and forget" their
assigned driver stations. As soon as the form as reset and the match
number is incremented, the correct team number is automatically
selected. This saves scouts time and significantly reduces the
likelihood of error, leading to more reliable scouting data for alliance
selection.
Copy link
Copy Markdown
Collaborator

@luanzeba luanzeba left a comment

Choose a reason for hiding this comment

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

Thanks so much for this contribution!! This is a good idea (:

I included a suggestion for better long-term support but that can be done in a follow up PR so we can land this more quickly.
As soon as you update that comment and remove the package-lock.json updates, we can merge this.

// Scouts are often assigned to a single robot position
// Remember this when changing match numbers
const driverStation = useQRScoutState(() => {
return getFieldValue("driverStation");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This works great, but the behavior is currently implicit (you have to know about "driverStation").
For long-term support, it would be better to make this explicit in TBA-team-and-robot config and schema.

Rough direction:

  autoAssignFromFieldCode: z.string().optional()
  const sourceCode = data.autoAssignFromFieldCode;
  const assignedStation = useQRScoutState(() =>
    sourceCode ? getFieldValue(sourceCode) : undefined
  );

If you want, would you be interested in opening that follow-up PR too? We’d be happy to review it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That plan works for me!

return typeof value === 'number' ? value : null;
});
// Scouts are often assigned to a single robot position
// Remember this when changing match numbers
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you expand on this comment explaining this temporary convention (expected values R1/R2/R3/B1/B2/B3, and that it’s intended to become a formal config option later)? That’ll help maintainers until the schema-backed option we mentioned in the other comment lands.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The expected values come from the robotPosition defined in this same component. I can certainly document that this solution is temporary.

Comment thread package-lock.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you mind reverting the changes to this lockfile? They seem unrelated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yes sorry about that! I was working in a codespace and didn't notice.

@ianonavy
Copy link
Copy Markdown
Contributor Author

@luanzeba Thanks for the review! I'll give the config a go in a separate PR. How does this version look?

Copy link
Copy Markdown
Collaborator

@luanzeba luanzeba left a comment

Choose a reason for hiding this comment

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

This is great, thanks so much for contributing!

@luanzeba luanzeba merged commit 70858ef into FRC2713:main Mar 10, 2026
1 check failed
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