Skip to content

Commit

Permalink
Merged in Aeniug2/bender (pull request #1)
Browse files Browse the repository at this point in the history
Added definitions for every button and joystick on the xbox / logitech controller. Added config values: HANDICAP and SquaredInputs.
  • Loading branch information
floogulinc committed Jan 22, 2014
2 parents bd1c656 + c105789 commit fb3236d
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/com/frc2879/bender/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,30 @@ public class Robot extends SimpleRobot {
RobotDrive drivetrain = new RobotDrive(1,2);
Joystick controllerthing = new Joystick(1);


// Defining Joystick Mappings:
public final int Button_X = 1;
public final int Button_Y = 4;
public final int Button_A = 2;
public final int Button_B = 3;
public final int Button_START = 10;
public final int Button_BACK = 9;
public final int Button_RIGHT_BUMPER = 6;
public final int Button_RIGHT_TRIGGER = 8;
public final int Button_LEFT_BUMPER = 5;
public final int Button_LEFT_TRIGGER = 7;
// Joystick axis(s)
public final int Stick_LEFT_Y = 2;
public final int Stick_LEFT_X = 1;
public final int Stick_RIGHT_X = 4;
public final int Stick_RIGHT_Y = 5;

// CONFIG VALUES ~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~
int HANDICAP = 1;
boolean SquaredInputs = true;
// ~~~~~~~~~~~~~~~~~~~~~~~
// CONFIG VALUES ~~~~~~~~~

/**
* This function is called once each time the robot enters autonomous mode.
*/
Expand All @@ -39,7 +62,14 @@ public void autonomous() {
public void operatorControl() {
drivetrain.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
drivetrain.arcadeDrive(controllerthing);

// Update joystick values:
float moveL = ((controllerthing.GetRawAxis(Stick_LEFT_Y)) / HANDICAP);
float spinL = ((controllerthing.GetRawAxis(Stick_LEFT_X)) / HANDICAP);

// Drive da robot:
drivetrain.arcadeDrive(moveL, spinL, SquaredInputs);

Timer.delay(0.01);
}
}
Expand Down

0 comments on commit fb3236d

Please sign in to comment.