Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 5ea98aa

Browse files
committed
Added lift motors to robotMap and accounted for two CIMs in kD calculations
1 parent 7e4e9bf commit 5ea98aa

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import edu.wpi.first.wpilibj.PIDSourceType;
2222
import edu.wpi.first.wpilibj.SerialPort;
2323
import edu.wpi.first.wpilibj.SpeedControllerGroup;
24+
import edu.wpi.first.wpilibj.VictorSP;
2425
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
2526
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
2627

@@ -32,10 +33,12 @@
3233
*/
3334
public class RobotMap {
3435

35-
public static WPI_TalonSRX intakeMotor;
3636
public static WPI_TalonSRX liftMotor;
3737
public static WPI_TalonSRX climberMotor;
3838

39+
public static VictorSP leftIntakeMotor;
40+
public static VictorSP rightIntakeMotor;
41+
3942
public static DigitalSource leftEncPort1;
4043
public static DigitalSource leftEncPort2;
4144
public static Encoder leftEncDist;
@@ -102,13 +105,14 @@ private void configSPX(WPI_VictorSPX mc) {
102105

103106
public RobotMap() {
104107

105-
intakeMotor = new WPI_TalonSRX(getPort("IntakeTalonSRX", 4));
106-
configSRX(intakeMotor);
107108
liftMotor = new WPI_TalonSRX(getPort("LiftTalonSRX", 5));
108109
configSRX(liftMotor);
109110
climberMotor = new WPI_TalonSRX(getPort("ClimberTalonSRX", 6));
110111
configSRX(climberMotor);
111112

113+
leftIntakeMotor = new VictorSP(getPort("IntakeLeftVictorSP", 0));
114+
rightIntakeMotor = new VictorSP(getPort("IntakeRightVictorSP", 1));
115+
112116
leftEncPort1 = new DigitalInput(getPort("1LeftEnc", 0));
113117
leftEncPort2 = new DigitalInput(getPort("2LeftEnc", 1));
114118
leftEncDist = new Encoder(leftEncPort1, leftEncPort2);
@@ -191,15 +195,14 @@ public double calcDefkD() {
191195
* half of the drivetrain only has to support half of the robot), and radius of
192196
* the drivetrain wheels squared. It's inversely proportional to the stall
193197
* 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.
195199
*/
196200
double gearReduction = Robot.getBool("High Gear", false) ? Robot.getConst("High Gear Gear Reduction", 5.392)
197201
: Robot.getConst("Low Gear Gear Reduction", 12.255);
202+
double radius = Robot.getConst("Radius of Drivetrain Wheel", 0.0635);
198203
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);
203206
double cycleTime = Robot.getConst("Code cycle time", 0.1);
204207
/*
205208
* The denominator of kD is 1-(e ^ -cycleTime / timeConstant). The numerator is

0 commit comments

Comments
 (0)