From 42ae8a7af341fab193e386438d23724fde95f03b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Mar 2017 12:22:48 -0400 Subject: Tidy HwRobot. --- src/org/usfirst/frc/team4272/robot2017/HwRobot.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java index 7752bd8..f30d495 100644 --- a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java +++ b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java @@ -65,37 +65,39 @@ public class HwRobot { // naming convention: {side_letter}{Thing}{E|M (encoder/motor)} + // Actuators should be private ///////////////////////////////////////// private final PIDOutput rDriveM = new Talon(/*PWM*/0), /* PDP 2, 3 */ lDriveM = new Talon(/*PWM*/1), /* PDP 12, 13 */ climber = new Talon(/*PWM*/3); /* PDP 4 */ + private final DoubleSolenoid + shifter = new DoubleSolenoid(/*PCM*/4, /*PCM*/5), + ged = new DoubleSolenoid(/*PCM*/6, /*PCM*/7); + // Sensors/info should be public /////////////////////////////////////// public final Encoder lDriveE = new Encoder(/*DIO*/0,/*DIO*/1, /*reverse*/false); public final Encoder rDriveE = new Encoder(/*DIO*/2,/*DIO*/3, /*reverse*/true); public final PIDSource lRate, rRate; public final PowerDistributionPanel PDP = new PowerDistributionPanel(); /* via CAN */ public final DriverStation ds = DriverStation.getInstance(); - - public DoubleSolenoid - shifter = new DoubleSolenoid(/*PCM*/4, /*PCM*/5), - ged = new DoubleSolenoid(/*PCM*/6, /*PCM*/7); - public final double axleWidth = 2.0; // in feet + // Use the constructor to initialize anything you can't + // initialize above. public HwRobot() { lDriveE.setDistancePerPulse(10.0/*feet*/ / 1865.75/*pulses*/); rDriveE.setDistancePerPulse(10.0/*feet*/ / 1865.75/*pulses*/); lDriveE.setPIDSourceType(PIDSourceType.kRate); rDriveE.setPIDSourceType(PIDSourceType.kRate); - PDP.initTable(NetworkTable.getTable("PDP")); lRate = new RollingAvg(5, lDriveE); rRate = new RollingAvg(5, rDriveE); + + PDP.initTable(NetworkTable.getTable("PDP")); } private double maxRate = 0; private double minBatt = 20; - public void run(Control c) { lDriveM.pidWrite(c.lDrive); rDriveM.pidWrite(-c.rDrive); -- cgit v1.2.3