Skip to content

Conversation

@ThadHouse
Copy link
Member

WIP, still needs C++, and for the mappings to actually be made correct. Plus the op mode PR.

@ThadHouse ThadHouse requested review from a team as code owners November 14, 2025 01:58
@github-actions
Copy link
Contributor

This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR.

@github-actions github-actions bot added component: wpilibj WPILib Java component: command-based WPILib Command Based Library 2027 2027 target labels Nov 14, 2025
@qwertychouskie
Copy link

Why does the gamepad code care if a button press came from one DS software or another? (TBH, this kinda smells of abstracting at the wrong layer.)

@ThadHouse
Copy link
Member Author

The old DS doesn't have the same mappings as a new DS. And at least for the time being, we need to support both.

Because theres no standard to what the NI DS outputs, we can't do anything at a lower layer.

@Starlight220
Copy link
Member

I think we should keep overloads taking int indexes; teams using one DS won't care about the indexes in the other and shouldn't have to pass a parameter that's irrelevant to them.

Do we have usage reporting of people using GenericHID directly (by index) rather than using the subclasses with named buttons?

@ThadHouse
Copy link
Member Author

I actually can't keep the indexer ones around for a lot of the things. Because the enum is the key into the dictionary so the system can keep track of which buttons have events on them.

The only way to really make it work would be to make the key be "Object", but there might be other issues with that too. Would need to investigate.

Comment on lines +134 to +138
if (DriverStation.isNiDs()) {
index = button.getNiIndex();
} else {
index = button.getSdlIndex();
}
Copy link
Member

Choose a reason for hiding this comment

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

  1. What should happen if the DS didn't connect yet? I have a feeling this is going to cause a lot of issues, similar to the alliance color issues in the past.
  2. Is defaulting to SDL the desired behavior?
  3. This evaluation should be pulled up to somewhere, rather than littering it all over the code, for consistency (in defaults etc) and code dedup.

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. These functions are already broken if used before a DS has been connected. They'll return false anyway, it doesn't matter what index you set.
  2. Defaulting to SDL is the desired behavior.
  3. Yeah I'm planning on working on that.

@Starlight220
Copy link
Member

So perhaps we could make a factory that returns a pair for a single value?

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

Labels

2027 2027 target component: command-based WPILib Command Based Library component: wpilibj WPILib Java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants