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

Instant commands have problems #363

Closed
jmullins16 opened this issue Jan 19, 2021 · 3 comments · Fixed by #366
Closed

Instant commands have problems #363

jmullins16 opened this issue Jan 19, 2021 · 3 comments · Fixed by #366

Comments

@jmullins16
Copy link

Defined instant command with no required subsystem. Generated code attempts to inject a subsystem parameter with the name “None” (the selection shown when no subsystems have been selected). Since there was no such subsystem (or header files), it would not build.

We created a “dummy” subsystem to assign to commands that did not need to require any of our other subsystems. This allowed it compile.

Added a parameter to the same instant command, and the autogenerated constructor now only shows the parameter, not the subsystem injected. Header file is correct.

    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
    explicit ClimberDeploy(bool climberDeploy, Dummy* m_dummy);

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR

ClimberDeploy::ClimberDeploy(bool climberDeploy): InstantCommand() {
m_climberDeploy = climberDeploy;
    // Use AddRequirements() here to declare subsystem dependencies
    // eg. AddRequirements(Robot::chassis.get());
    SetName("ClimberDeploy");
    AddRequirements(m_dummy);

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR

Also noticed that the generated SmartDashboard buttons do not update when adding/deleting parameters to an instant command.

So we are switching back to regular commands which seem to work fine.

@sciencewhiz
Copy link
Collaborator

For the problem about instant commands not updating parameters, did you update the parameter presets after updating the parameters? There shouldn't be anything different between Instant Commands and Commands when generating SmartDashboard buttons.

@jmullins16
Copy link
Author

It took me a bit to repro, but here's what I did.

  1. Create a new project with a single subsystem and one instant command (no parameters), build no errors
  2. Added a parameter to the instant command, build failed with instant command Constructor missing subsystem
  3. Added a preset to the instant command, build failed with instant command Constructor missing subsystem
  4. Added a new command (no parameters), build with no new errors
  5. Added a parameter to the command, SmartDashboard PutData for command did not add parameter, build with error
  6. Added a preset and it compiled with no errors
  7. Deleted preset and SmartDashboard again missing parameter, build with errors

So I think it's in both.

@sciencewhiz
Copy link
Collaborator

Yes, Smartdashboard failing without parameter presets is known (#257) and isn't anything fixable, other then potentially throwing a validation error.

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

Successfully merging a pull request may close this issue.

2 participants