From 680a2292554f18f287859a5045e2921cb354ec44 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Mar 2017 12:08:01 -0400 Subject: move the axleWidth constant from Autonomous to HwRobot. --- src/org/usfirst/frc/team4272/robot2017/Autonomous.java | 5 ++--- src/org/usfirst/frc/team4272/robot2017/HwRobot.java | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java index 2669205..3f6b7b4 100644 --- a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java +++ b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java @@ -145,7 +145,6 @@ public class Autonomous { } } - private static final double axleWidth = 2; // in feet private static Command driveDistance(HwRobot robot, double speed, double dist) { return new DriveDistance(robot, 0.2, speed, dist, @@ -153,8 +152,8 @@ public class Autonomous { } private static Command turnRadians(HwRobot robot, double speed, double rad) { return new DriveDistance(robot, 0.6, - speed, Math.copySign(rad*axleWidth/2, rad), - speed, Math.copySign(rad*axleWidth/2, -rad)); + speed, Math.copySign(rad*robot.axleWidth/2, rad), + speed, Math.copySign(rad*robot.axleWidth/2, -rad)); } private static Command turnDegrees(HwRobot robot, double speed, double deg) { return turnRadians(robot, speed, deg * Math.PI/180); diff --git a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java index a72ae44..23d98b3 100644 --- a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java +++ b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java @@ -80,9 +80,8 @@ public class HwRobot { public DoubleSolenoid shifter = new DoubleSolenoid(/*PCM*/4, /*PCM*/5), ged = new DoubleSolenoid(/*PCM*/6, /*PCM*/7); - - private double maxRate = 0; - private double minBatt = 20; + + public final double axleWidth = 2.0; // in feet public HwRobot() { lDriveE.setDistancePerPulse(10.0/*feet*/ / 1865.75/*pulses*/); @@ -96,6 +95,9 @@ public class HwRobot { rRate = new RollingAvg(5, rDriveE); } + 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