|
21 | 21 | import edu.wpi.first.wpilibj.PIDSourceType; |
22 | 22 | import edu.wpi.first.wpilibj.SerialPort; |
23 | 23 | import edu.wpi.first.wpilibj.SpeedControllerGroup; |
| 24 | +import edu.wpi.first.wpilibj.VictorSP; |
24 | 25 | import edu.wpi.first.wpilibj.drive.DifferentialDrive; |
25 | 26 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
26 | 27 |
|
|
32 | 33 | */ |
33 | 34 | public class RobotMap { |
34 | 35 |
|
35 | | - public static WPI_TalonSRX intakeMotor; |
36 | 36 | public static WPI_TalonSRX liftMotor; |
37 | 37 | public static WPI_TalonSRX climberMotor; |
38 | 38 |
|
| 39 | + public static VictorSP leftIntakeMotor; |
| 40 | + public static VictorSP rightIntakeMotor; |
| 41 | + |
39 | 42 | public static DigitalSource leftEncPort1; |
40 | 43 | public static DigitalSource leftEncPort2; |
41 | 44 | public static Encoder leftEncDist; |
@@ -102,13 +105,14 @@ private void configSPX(WPI_VictorSPX mc) { |
102 | 105 |
|
103 | 106 | public RobotMap() { |
104 | 107 |
|
105 | | - intakeMotor = new WPI_TalonSRX(getPort("IntakeTalonSRX", 4)); |
106 | | - configSRX(intakeMotor); |
107 | 108 | liftMotor = new WPI_TalonSRX(getPort("LiftTalonSRX", 5)); |
108 | 109 | configSRX(liftMotor); |
109 | 110 | climberMotor = new WPI_TalonSRX(getPort("ClimberTalonSRX", 6)); |
110 | 111 | configSRX(climberMotor); |
111 | 112 |
|
| 113 | + leftIntakeMotor = new VictorSP(getPort("IntakeLeftVictorSP", 0)); |
| 114 | + rightIntakeMotor = new VictorSP(getPort("IntakeRightVictorSP", 1)); |
| 115 | + |
112 | 116 | leftEncPort1 = new DigitalInput(getPort("1LeftEnc", 0)); |
113 | 117 | leftEncPort2 = new DigitalInput(getPort("2LeftEnc", 1)); |
114 | 118 | leftEncDist = new Encoder(leftEncPort1, leftEncPort2); |
@@ -191,15 +195,14 @@ public double calcDefkD() { |
191 | 195 | * half of the drivetrain only has to support half of the robot), and radius of |
192 | 196 | * the drivetrain wheels squared. It's inversely proportional to the stall |
193 | 197 | * torque of the shaft, which is found by multiplying the stall torque of the |
194 | | - * motor with the gear reduction. |
| 198 | + * motor with the gear reduction by the amount of motors. |
195 | 199 | */ |
196 | 200 | double gearReduction = Robot.getBool("High Gear", false) ? Robot.getConst("High Gear Gear Reduction", 5.392) |
197 | 201 | : Robot.getConst("Low Gear Gear Reduction", 12.255); |
| 202 | + double radius = Robot.getConst("Radius of Drivetrain Wheel", 0.0635); |
198 | 203 | double timeConstant = Robot.getConst("Omega Max", 5330) / gearReduction |
199 | | - * convertLbsTokG(Robot.getConst("Mass of Robot", 150)) / 2 |
200 | | - * Robot.getConst("Radius of Drivetrain Wheel", 0.0635) |
201 | | - * Robot.getConst("Radius of Drivetrain Wheel", 0.0635) |
202 | | - / (Robot.getConst("Stall Torque", 2.41) * gearReduction); |
| 204 | + * convertLbsTokG(Robot.getConst("Mass of Robot", 150)) / 2 * radius * radius |
| 205 | + / (Robot.getConst("Stall Torque", 2.41) * gearReduction * 2); |
203 | 206 | double cycleTime = Robot.getConst("Code cycle time", 0.1); |
204 | 207 | /* |
205 | 208 | * The denominator of kD is 1-(e ^ -cycleTime / timeConstant). The numerator is |
|
0 commit comments