import org.usfirst.frc.team3501.robot.commands.*;
public class OI {
- public Joystick left, right;
+ private Joystick left, right;
public OI() {
left = new Joystick(RobotMap.LEFT_JOYSTICK_PORT);
right.whenReleased(1, new OpenClaw());
}
- public double getForward() {
+ public double getForwardL() {
+ return left.getY();
+ }
+
+ public double getForwardR() {
return right.getY();
}
- public double getTwist() {
+ public double getTwistR() {
return right.getTwist();
}
}
public class Robot extends IterativeRobot {
- public static final Drivetrain drivetrain = new Drivetrain();
- public static final Arm arm = new Arm();
- public static final Claw claw = new Claw();
+ public static Drivetrain drivetrain;
+ public static Arm arm;
+ public static Claw claw;
+
+ public static Pneumatics pneumatics;
public static OI oi;
public void robotInit() {
oi = new OI();
+ drivetrain = new Drivetrain();
+ arm = new Arm();
+ claw = new Claw();
+
+ pneumatics = new Pneumatics();
+
chooseAuto();
}
}
public void autonomousInit() {
+ pneumatics.start();
+
autonomousCommand = (Command) autoChooser.getSelected();
autonomousCommand.start();
}
}
public void teleopInit() {
+ pneumatics.start();
+
autonomousCommand.cancel();
}
LiveWindow.run();
}
+ public void disabledInit() {
+ pneumatics.stop();
+ }
+
private void chooseAuto() {
autoChooser = new SendableChooser();
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
public class RobotMap {
- // Driver Station
+ // driver station
public static final int LEFT_JOYSTICK_PORT = 0, RIGHT_JOYSTICK_PORT = 1;
public static final double MIN_DRIVE_JOYSTICK_INPUT = 0.1,
MIN_ARM_JOYSTICK_INPUT = 0.1;
- // Drivetrain
+ // drivetrain
public static final int FRONT_LEFT_ADDRESS = 4, FRONT_RIGHT_ADDRESS = 5,
REAR_LEFT_ADDRESS = 3, REAR_RIGHT_ADDRESS = 6;
public static final double MAX_DRIVE_SPEED = 0.7;
- // Claw
+ // claw
public static final int CLAW_FORWARD_CHANNEL = 0, CLAW_REVERSE_CHANNEL = 1;
public static final Value OPEN = Value.kForward, CLOSED = Value.kReverse;
- // Arm
+ // arm
public static final int LEFT_WINCH_ADDRESS = 2, RIGHT_WINCH_ADDRESS = 7;
- // Auton
+ // auton
public static final double OVER_STEP_TIME = 1.2, OVER_STEP_SPEED = 0.7,
PAST_STEP_TIME = 1.5, PAST_STEP_SPEED = 0.5;
}
}
protected void execute() {
- drivetrain.drive(oi.getForward(), oi.getTwist());
+ drivetrain.drive(oi.getForwardR(), oi.getTwistR());
}
protected boolean isFinished() {
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands;
+
+public class MoveArm extends CommandBase {
+
+ public MoveArm() {
+ super("MoveArm");
+ requires(arm);
+ }
+
+ protected void execute() {
+ arm.setFromJoystick(oi.getForwardL());
+ }
+
+ protected boolean isFinished() {
+ return false;
+ }
+}
package org.usfirst.frc.team3501.robot.subsystems;
import org.usfirst.frc.team3501.robot.RobotMap;
+import org.usfirst.frc.team3501.robot.commands.MoveArm;
import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.command.Subsystem;
right.set(speed);
}
+ public void setFromJoystick(double speed) {
+ set(getSpeedFromJoystick(speed));
+ }
+
public void moveLeft(double speed) {
left.set(speed);
right.set(0);
return speed;
}
- public void initDefaultCommand() {}
+ public void initDefaultCommand() {
+ setDefaultCommand(new MoveArm());
+ }
}
-
setDefaultCommand(new DriveWithJoysticks());
}
}
-
public void initDefaultCommand() {}
}
-