Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/org/team3042/sweep/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package org.team3042.sweep;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;

/**
* This class is the glue that binds the controls on the physical operator
Expand All @@ -16,6 +18,8 @@ public class OI {
public Joystick stickRight = new Joystick( RobotMap.RIGHT_JOY_USB_PORT_2);
// Button button = new JoystickButton(stick, buttonNumber);

public Button lTrigger = new JoystickButton(stickLeft, 1);
public Button rTrigger = new JoystickButton(stickRight, 1);
// Another type of button you can create is a DigitalIOButton, which is
// a button or switch hooked up to the cypress module. These are useful if
// you want to build a customized operator interface.
Expand All @@ -39,6 +43,6 @@ 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());
}

14 changes: 13 additions & 1 deletion src/org/team3042/sweep/commands/DriveTrainTankDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
public class DriveTrainTankDrive extends CommandBase {

private static double leftPower;
private static double rightPower;

public DriveTrainTankDrive() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
Expand All @@ -23,7 +26,16 @@ protected void initialize() {

// Called repeatedly when this Command is scheduled to run
protected void execute() {
driveTrain.drive(-oi.stickLeft.getY(), -oi.stickRight.getY());
leftPower = -oi.stickLeft.getY();
rightPower = -oi.stickRight.getY();

if(oi.lTrigger.get()){
rightPower = leftPower;
}
else if (oi.rTrigger.get()){
leftPower = rightPower;
}
driveTrain.drive(leftPower, rightPower);
}

// Make this return true when this Command no longer needs to run execute()
Expand Down