summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Autonomous.java17
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Control.java4
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/HwRobot.java24
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Robot.java1
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Teleop.java24
5 files changed, 24 insertions, 46 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2016/Autonomous.java b/src/org/usfirst/frc/team4272/robot2016/Autonomous.java
index 4fab67f..295cba9 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Autonomous.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Autonomous.java
@@ -1,30 +1,13 @@
package org.usfirst.frc.team4272.robot2016;
-import edu.wpi.first.wpilibj.Timer;
-
public class Autonomous {
- private final Timer time = new Timer();
private final HwRobot robot;
public Autonomous(HwRobot robot) {
this.robot = robot;
- time.reset();
- time.start();
- robot.rDriveE.reset();
- robot.lDriveE.reset();
}
public Control run(Control c) {
- if (robot.rDriveE.getDistance() > -(15.5*140*1.15)) {
- c.rDrive = c.lDrive = 0.7;
- //initially -0.7 to drive backwards
- //0 to 9787 for going backwards
- //0 to negative for forward
- //INDY: (15.5*140*1.1)
- //PURDUE: (15.5*140*1.15) for a drop further
- } else {
- c.rDrive = c.lDrive = 0;
- }
return c;
}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/Control.java b/src/org/usfirst/frc/team4272/robot2016/Control.java
index b136e0c..d7eadf5 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Control.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Control.java
@@ -1,9 +1,9 @@
package org.usfirst.frc.team4272.robot2016;
public class Control {
- double lDrive, rDrive, fBall, bBall;
+ double lDrive, rDrive, fBall, bBall, arm;
public Control() {
- lDrive = rDrive = fBall = bBall = 0;
+ lDrive = rDrive = fBall = bBall = arm = 0;
}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
index b2c7150..a59ecb1 100644
--- a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
+++ b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
@@ -27,24 +27,24 @@ public class HwRobot {
// 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));
- 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 Encoder lDriveE = new Encoder(/*DIO*/2,/*DIO*/3);
+ //public Encoder rDriveE = new Encoder(/*DIO*/0,/*DIO*/1, true);
+ private PIDOutput lDriveM = new PIDOutputSplitter(new Talon(/*PWM*/0), new Talon(/*PWM*/1));
+ private PIDOutput rDriveM = new PIDOutputSplitter(new Talon(/*PWM*/2), new Talon(/*PWM*/3));
+ private PIDOutput armM = new PIDOutputSplitter(new Talon(/*PWM*/4), new Talon(/*PWM*/5));
+ private PIDOutput fBallM = new PIDOutputSplitter(new Talon(/*PWM*/6), new Talon(/*PWM*/7));
+ private PIDOutput bBallM = new PIDOutputSplitter(new Talon(/*PWM*/8), new Talon(/*PWM*/9));
public HwRobot() {
- lDriveE.setPIDSourceType(PIDSourceType.kRate);
- rDriveE.setPIDSourceType(PIDSourceType.kRate);
+ //lDriveE.setPIDSourceType(PIDSourceType.kRate);
+ //rDriveE.setPIDSourceType(PIDSourceType.kRate);
}
public void run(Control c) {
lDriveM.pidWrite( c.lDrive);
rDriveM.pidWrite(-c.rDrive);
- fBallM.pidWrite(c.fBall);
- bBallM.pidWrite(c.bBall);
+ armM.pidWrite(-c.arm);
+ 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 c9ad4c5..fc2eef6 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Robot.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Robot.java
@@ -37,7 +37,6 @@ public class Robot extends IterativeRobot {
public void teleopInit() {
try {
- robot.rDriveE.reset();
teleop = new Teleop();
} catch (Exception e) {}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/Teleop.java b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
index 4853162..8c6e73b 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Teleop.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
@@ -1,6 +1,7 @@
package org.usfirst.frc.team4272.robot2016;
import org.usfirst.frc.team4272.robotlib.PushButton;
+import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Axis;
import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Button;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.Joystick;
@@ -21,24 +22,18 @@ public class Teleop {
/* Drive */
control.lDrive = jsScale(oi.lStick);
control.rDrive = jsScale(oi.rStick);
-
- /* Ball intake/shooter */
- if (oi.lStick.getTrigger()) {
- /* intake */
- control.fBall = control.bBall = -SmartDashboard.getNumber("intakeSpeed");
- } else if (oi.rStick.getTrigger()) {
- /* outtake */
- control.fBall = 1;
- if (oi.rStick.getRawButton(3)) {
- control.bBall = 1;
- } else {
- control.bBall = 0;
- }
+ control.arm = -oi.xbox.getAxis(Axis.LY);
+ control.fBall = oi.xbox.getAxis(Axis.RTrigger) - oi.xbox.getAxis(Axis.LTrigger);
+ if (control.fBall < -0.1) {
+ control.bBall = -1;
} else {
- control.fBall = control.bBall = 0;
+ control.bBall = oi.xbox.getButton(Button.A) ? 1 : 0;
}
+ SmartDashboard.putNumber("fBall", control.fBall);
+
/* Take pictures */
+ /*
if (camButton.update(oi.xbox.getButton(Button.RT))) {
try {
ProcessBuilder pb = new ProcessBuilder("/home/lvuser/tweeterbot/bin/snapPhoto");
@@ -46,6 +41,7 @@ public class Teleop {
pb.start();
} catch (Exception e) {};
}
+ */
return control;
}