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

Updating a preset for a command's parameters does not update usages of that preset #119

Open
SamCarlberg opened this issue Dec 2, 2018 · 0 comments

Comments

@SamCarlberg
Copy link
Member

Detail

  1. Create a new command that takes a parameter (for example, a Setpoint Command)
  2. Add a preset for the parameters for that command
  3. Use that command elsewhere (button binding, command group, etc)
  4. Update the preset to use different value(s)

The usages of that command will still use the initial values of the preset, not the new ones.

Possible Solutions

Bind preset usages to that preset
This would make RobotBuilder read the preset values at generation time, not at use-time, and as such would always be up to date.

Generate static factory methods for each preset
For example, having a MoveElevator command taking a single setpoint as its argument and with the presets top, middle, bottom, and intake.

class MoveElevator extends SetpointCommand {
  MoveElevator(double setpoint);
  static MoveElevator moveElevatorToTop()
  static MoveElevator moveElevatorToMiddle()
  static MoveElevator moveElevatorToBottom()
  static MoveElevator moveElevatorToIntake()
}

This would be an improvement on the previous solution, as usages of the presets would need to know which factory method to call. The constructor would remain public so more than just the presets would be usable. However, a default constructor should not be generated

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

No branches or pull requests

2 participants