View Single Post
  #1   Spotlight this post!  
Unread 03-02-2017, 18:49
Coach Seb's Avatar
Coach Seb Coach Seb is offline
Registered User
AKA: Sebastien Cournoyer
FRC #5860 (Full Metal Muskrats)
Team Role: Coach
 
Join Date: Sep 2015
Rookie Year: 2015
Location: Algonac, MI
Posts: 122
Coach Seb is an unknown quantity at this point
Java Command Based Command

New to Command Based... We are about to start coding the commands for each subsystem and before we get too far, we need the following info on how to handle multiple commands...

For example, we have a feeder motor... we want a command to FeederOn(clockwise), FeederOnRev(counterclockwise) and FeederOff...

We created a Feeder_Command class...

Code:
public class TeleopFeederOn_Command extends Command{
	@Override
	protected void execute(){
		while(Robot.oi.getOperatorJoystick().getRawButton(4) ==true){
			Robot.fuelFeederSubsystem.FeederOn();
		}
		Robot.fuelFeederSubsystem.FeederOff();	
	}
	@Override
	protected boolean isFinished() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	protected void end() {
		Robot.fuelFeederSubsystem.FeederOff();
	}
	@Override
	protected void interrupted(){
		end();
	}	
}
That should take care of our FeederOn command using button 4. Now should we build a new command class for FeederOnRev (button5) or do we want to add the command to this class?
Reply With Quote