I have a few questions about Command Based.
We have a couple pneumatic cylinders on our robot. I am currently using a constructor with a variable to control one of them, like this:
Button shiftButton = new JoystickButton( operatorJoystick, 1 );
shiftButton.whenPressed( new ShiftCommand( Gear.HIGH ) );
shiftButton.whenReleased( new ShiftCommand( Gear.LOW ) );
The other I am using a TimedCommand which I have added an additional command to determine if it is timed or not, for the purpose of autonomous. In TeleOp, it is bound to toggleWhenPressed so the timing is not needed.
Button gearButton = new JoystickButton( operatorJoystick, 3 );
gearButton.toggleWhenPressed( new DropGear() );
These work as expected, but I am wondering if there are better ways to accomplish this sort of thing.
My second question is regarding subsystems. I’m really not sure how “require” works and how or when interrupted() will be called. For now, I am leaving out all require statements as my code won’t work with them. I don’t think this is good practice though.
My third question is regarding non-subsystem non-command classes. How do these fit into the Command based framework? I have them in the same package as Robot, RobotMap, and OI currently. The way I am writing code “works”, but I would like to pass on better practices to the future programmers (I am a senior on a Rookie team :ahh:)