summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Control.java10
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/HwRobot.java27
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Robot.java3
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Teleop.java34
4 files changed, 17 insertions, 57 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2016/Control.java b/src/org/usfirst/frc/team4272/robot2016/Control.java
index 490269b..b136e0c 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Control.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Control.java
@@ -1,15 +1,9 @@
package org.usfirst.frc.team4272.robot2016;
-import edu.wpi.first.wpilibj.Relay;
-
public class Control {
- double lDrive, rDrive, winch;
- Relay.Value lIntake, rIntake;
- boolean grab, push;
+ double lDrive, rDrive, fBall, bBall;
public Control() {
- lDrive = rDrive = winch = 0;
- grab = push = false;
- lIntake = rIntake = Relay.Value.kOff;
+ lDrive = rDrive = fBall = bBall = 0;
}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
index 9b3e4e1..da4c1b4 100644
--- a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
+++ b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
@@ -1,14 +1,10 @@
package org.usfirst.frc.team4272.robot2016;
import org.mckenzierobotics.lib.robot.PIDOutputSplitter;
-import org.usfirst.frc.team4272.robotlib.DoubleSolenoid;
-import org.usfirst.frc.team4272.robotlib.LimitSwitchedPIDOutput;
-import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSourceType;
-import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Talon;
public class HwRobot {
@@ -29,37 +25,26 @@ public class HwRobot {
* And, for communication: USB-B and Ethernet.
*/
+ // naming convention: {side_letter}{Thing}{E|M (encoder/motor)}
+
public Encoder lDriveE = new Encoder(/*DIO*/2,/*DIO*/3);
private PIDOutput lDriveM = new PIDOutputSplitter(new Talon(/*PWM*/0),
new Talon(/*PWM*/1));
public Encoder rDriveE = new Encoder(/*DIO*/0,/*DIO*/1, true);
private PIDOutput rDriveM = new PIDOutputSplitter(new Talon(/*PWM*/2),
new Talon(/*PWM*/3));
- public Encoder winchE = new Encoder(/*DIO*/4,/*DIO*/5);//),
- private static DigitalInput winchT = new DigitalInput(/*DIO*/6);
- private static DigitalInput winchB = new DigitalInput(/*DIO*/7);
- private PIDOutput winchM = new LimitSwitchedPIDOutput(
- new PIDOutputSplitter(new Talon(/*PWM*/4),
- new Talon(/*PWM*/5)),
- winchT, false, winchB, false);
- private DoubleSolenoid grab = new DoubleSolenoid(/*PCM*/2,/*PCM*/3);
- private DoubleSolenoid push = new DoubleSolenoid(/*PCM*/0,/*PCM*/1);
- private Relay lIntake = new Relay(/*Relay*/1, Relay.Direction.kBoth);
- private Relay rIntake = new Relay(/*Relay*/0, Relay.Direction.kBoth);
+ private PIDOutput fBallM = new PIDOutputSplitter(new Talon(/*PWM*/4), new Talon(/*PWM*/5));
+ private PIDOutput bBallM = new PIDOutputSplitter(new Talon(/*PWM*/6), new Talon(/*PWM*/7));
public HwRobot() {
lDriveE.setPIDSourceType(PIDSourceType.kRate);
rDriveE.setPIDSourceType(PIDSourceType.kRate);
- winchE.setPIDSourceType(PIDSourceType.kRate);
}
public void run(Control c) {
lDriveM.pidWrite( c.lDrive);
rDriveM.pidWrite(-c.rDrive);
- winchM.pidWrite(-c.winch);
- lIntake.set(c.lIntake);
- rIntake.set(c.rIntake);
- grab.setForward(c.grab);
- push.setForward(!c.push);
+ fBallM.pidWrite(c.fBall);
+ bBallM.pidWrite(c.bBall);
}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/Robot.java b/src/org/usfirst/frc/team4272/robot2016/Robot.java
index 0c2a98e..c9ad4c5 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Robot.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Robot.java
@@ -1,8 +1,6 @@
package org.usfirst.frc.team4272.robot2016;
-
-import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.IterativeRobot;
/**
@@ -15,7 +13,6 @@ import edu.wpi.first.wpilibj.IterativeRobot;
public class Robot extends IterativeRobot {
private final HwRobot robot = new HwRobot();
private final HwOI oi = new HwOI();
- private final DriverStation ds = DriverStation.getInstance();
private final Control control = new Control();
private Autonomous auto;
diff --git a/src/org/usfirst/frc/team4272/robot2016/Teleop.java b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
index be88308..aadbc58 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Teleop.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
@@ -6,11 +6,8 @@ import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Axis;
import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Button;
import edu.wpi.first.wpilibj.Joystick;
-import edu.wpi.first.wpilibj.Relay;
public class Teleop {
- private ToggleButton grabButton = new ToggleButton();
- private ToggleButton pushButton = new ToggleButton();
private PushButton camButton = new PushButton();
public Teleop() {
@@ -26,31 +23,18 @@ public class Teleop {
/* Drive */
control.lDrive = jsScale(oi.lStick);
control.rDrive = jsScale(oi.rStick);
- /* Winch */
- control.winch = oi.xbox.getAxis(Axis.LY ) * -1;/* up is neg, down is pos */
- if (Math.abs(control.winch) < 0.1) { control.winch = 0; }
- /* left intake */
- if (oi.xbox.getButton(Button.LB)) {
- control.lIntake = Relay.Value.kReverse;
- } else if (oi.xbox.getAxis(Axis.LT) > 0.75) {
- control.lIntake = Relay.Value.kForward;
- } else {
- control.lIntake = Relay.Value.kOff;
+ /* Ball intake/shooter */
+ if (oi.lStick.getTrigger()) {
+ control.fBall = control.bBall = -1;
+ } else if (oi.rStick.getTrigger()) {
+ control.fBall = 1;
+ if (oi.rStick.getRawButton(3)) {
+ control.bBall = 1;
+ }
}
- /* right intake */
- if (oi.xbox.getButton(Button.RB)) {
- control.rIntake=(Relay.Value.kReverse);
- } else if (oi.xbox.getAxis(Axis.RT) > 0.75) {
- control.rIntake=(Relay.Value.kForward);
- } else {
- control.rIntake=(Relay.Value.kOff);
- }
-
- control.grab = grabButton.update(oi.xbox.getButton(Button.A));
- control.push = pushButton.update(oi.xbox.getButton(Button.B));
-
+ /* Take pictures */
if (camButton.update(oi.xbox.getButton(Button.RT))) {
try {
ProcessBuilder pb = new ProcessBuilder("/home/lvuser/tweeterbot/bin/snapPhoto");