Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to set selected option in SendableChooser #6252

Closed
wants to merge 2 commits into from
Closed

Add method to set selected option in SendableChooser #6252

wants to merge 2 commits into from

Conversation

Gold856
Copy link
Contributor

@Gold856 Gold856 commented Jan 18, 2024

Resolves #3731

@Gold856 Gold856 requested a review from a team as a code owner January 18, 2024 22:14
@calcmogul
Copy link
Member

calcmogul commented Jan 18, 2024

This doesn't obey the sim/non-sim class split. Users shouldn't be able to call SetSelected() in non-sim robot code (sim objects are no-ops in non-sim).

@Gold856
Copy link
Contributor Author

Gold856 commented Jan 18, 2024

Should I wrap it in if (IsSimulation())? I don't like having a whole other class, especially since the other sim classes interact with the HAL, whereas SendableChooser only uses NT. Having a SendableChooserSim means I need an NT publisher to manage, and I'd need to lock it behind if (IsSimulation()) anyways.

@calcmogul
Copy link
Member

calcmogul commented Jan 18, 2024

SendableChooser is still using a key-value system like HALSIM in the form of NT. Teams already complain about how much sim and non-sim code is mixed, and this change conflates them further.

Copy link
Member

@Starlight220 Starlight220 left a comment

Choose a reason for hiding this comment

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

Rather than adding a new test, the existing tests should use SendableChooserSim rather than what they do now.

@Starlight220
Copy link
Member

Is there value in being able to select from code regardless of sim?

@PeterJohnson
Copy link
Member

PeterJohnson commented Jan 19, 2024

That’s what the set default option is for. It should theoretically be safe to use NT setDefault() to set the selected value (as this will not override the dashboard set value), but this is not exposed on the Sendable interface.

@Gold856 Gold856 closed this by deleting the head repository Jun 9, 2024
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.

Add SendableChooserSim
5 participants