It can help to keep your code organized if your commands live within the subsystems and are exposed through methods, rather than being created inside the RobotContainer where they're bound.
Instead you can (or even, should) have in FeedSubsystem:
public FeedSubsystem(CANSparkMax feedMotor) {
this.feedMotor = feedMotor;
setDefaultCommand(run(() -> feed(0)); // or runOnce(() -> feed(0)).andThen(Commands.idle());
}
public Command feedIn() {
return run(() -> feed(0.25));
}
public Command feedOut() {
return run(() -> feed(-.1));
}
Then if you want to reuse the feedIn command (which you do multiple times in RobotContainer) you can just call FeedSubsystem.feedIn() instead of having to create a new command each time.
It can help to keep your code organized if your commands live within the subsystems and are exposed through methods, rather than being created inside the RobotContainer where they're bound.
For example, in
RobotContainer
you haveInstead you can (or even, should) have in
FeedSubsystem
:Then if you want to reuse the feedIn command (which you do multiple times in RobotContainer) you can just call
FeedSubsystem.feedIn()
instead of having to create a new command each time.