diff --git a/src/org/usfirst/frc/team4737/robot/OI.java b/src/org/usfirst/frc/team4737/robot/OI.java index 2d10bad..fae76d3 100644 --- a/src/org/usfirst/frc/team4737/robot/OI.java +++ b/src/org/usfirst/frc/team4737/robot/OI.java @@ -7,6 +7,8 @@ package org.usfirst.frc.team4737.robot; +import edu.wpi.first.wpilibj.Joystick; + /** * This class is the glue that binds the controls on the physical operator * interface to the commands and command groups that allow control of the robot. @@ -39,4 +41,13 @@ public class OI { // Start the command when the button is released and let it run the command // until it is finished as determined by it's isFinished method. // button.whenReleased(new ExampleCommand()); + + public Joystick leftJoystick; + public Joystick rightJoystick; + + public OI() { + leftJoystick = new Joystick(0); + rightJoystick = new Joystick(1); + } + } diff --git a/src/org/usfirst/frc/team4737/robot/commands/TeleopTankDrive.java b/src/org/usfirst/frc/team4737/robot/commands/TeleopTankDrive.java new file mode 100644 index 0000000..1c31da5 --- /dev/null +++ b/src/org/usfirst/frc/team4737/robot/commands/TeleopTankDrive.java @@ -0,0 +1,42 @@ +package org.usfirst.frc.team4737.robot.commands; + +import org.usfirst.frc.team4737.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class TeleopTankDrive extends Command { + + public TeleopTankDrive() { + // Use requires() here to declare subsystem dependencies + requires(Robot.DRIVETRAIN); + } + + // Called just before this Command runs the first time + protected void initialize() { + } + + // Called repeatedly when this Command is scheduled to run + protected void execute() { + Robot.DRIVETRAIN.tankDrive( + Robot.OI.leftJoystick.getRawAxis(1), + Robot.OI.rightJoystick.getRawAxis(1)); + } + + // Make this return true when this Command no longer needs to run execute() + protected boolean isFinished() { + return false; + } + + // Called once after isFinished returns true + protected void end() { + } + + // Called when another command which requires one or more of the same + // subsystems is scheduled to run + protected void interrupted() { + } + +} diff --git a/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java b/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java index 3e358c1..cc5ab9f 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java @@ -1,6 +1,7 @@ package org.usfirst.frc.team4737.robot.subsystems; import org.usfirst.frc.team4737.robot.RobotMap; +import org.usfirst.frc.team4737.robot.commands.TeleopTankDrive; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; @@ -30,7 +31,7 @@ public Drivetrain() { public void initDefaultCommand() { // Set the default command for a subsystem here. - // setDefaultCommand(new MySpecialCommand()); + setDefaultCommand(new TeleopTankDrive()); } /**