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

Commit fd1b3b4

Browse files
teleop VPID working!
mostly! not quite sure if limiting target or changing kf based on current DT gear (high/low)
1 parent 7170ab4 commit fd1b3b4

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ public RobotMap() {
114114
configSPX(dtLeftSlave);
115115
dtLeft = new SpeedControllerGroup(dtLeftMaster, dtLeftSlave);
116116

117-
leftVelocityController = new VelocityPIDController(Robot.getConst("VelocityLeftkP", 1),
117+
leftVelocityController = new VelocityPIDController(Robot.getConst("VelocityLeftkP", 0),
118118
Robot.getConst("VelocityLeftkI", 0), Robot.getConst("VelocityLeftkD", 0),
119-
1 / Robot.getConst("Max Low Speed", 84), leftEncRate, dtLeft);
120-
// leftVelocityController.enable();
119+
/*1 / Robot.getConst("Max Low Speed", 84)*/ Robot.getConst("VelocityLeftkF", 1/84.0), leftEncRate, dtLeft);
121120
leftVelocityController.setInputRange(-Robot.getConst("Max High Speed", 204),
122121
Robot.getConst("Max High Speed", 204));
123122
leftVelocityController.setOutputRange(-1.0, 1.0);
@@ -138,22 +137,20 @@ public RobotMap() {
138137
dtRightSlave = new WPI_VictorSPX(getPort("RightVictorSPXSlave", 3));
139138
configSPX(dtRightSlave);
140139
dtRight = new SpeedControllerGroup(dtRightMaster, dtRightSlave);
141-
// dtRight.setInverted(true);
142140

143-
rightVelocityController = new VelocityPIDController(Robot.getConst("VelocityRightkP", 1),
141+
rightVelocityController = new VelocityPIDController(Robot.getConst("VelocityRightkP", 0),
144142
Robot.getConst("VelocityRightkI", 0), Robot.getConst("VelocityRightkD", 0),
145-
1 / Robot.getConst("Max Low Speed", 84), rightEncRate, dtRight);
146-
// rightVelocityController.enable();
143+
/*1 / Robot.getConst("Max Low Speed", 84)*/ Robot.getConst("VelocityRightkF", 1/84.0), rightEncRate, dtRight);
147144
rightVelocityController.setInputRange(-Robot.getConst("Max High Speed", 204),
148145
Robot.getConst("Max High Speed", 204));
149146
rightVelocityController.setOutputRange(-1.0, 1.0);
150147
rightVelocityController.setContinuous(false);
151148
rightVelocityController.setAbsoluteTolerance(Robot.getConst("VelocityToleranceRight", 2));
152149

153-
// robotDrive = new DifferentialDrive(leftVelocityController, rightVelocityController);
154-
robotDrive = new DifferentialDrive(dtLeft, dtRight);
150+
robotDrive = new DifferentialDrive(leftVelocityController, rightVelocityController);
151+
// robotDrive = new DifferentialDrive(dtLeft, dtRight);
155152

156-
// robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
153+
robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
157154

158155
distEncAvg = new PIDSourceAverage(leftEncDist, rightEncDist);
159156
fancyGyro = new AHRS(SerialPort.Port.kMXP);

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TeleopDrive.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ public TeleopDrive() {
2323
// Called just before this Command runs the first time
2424
@Override
2525
protected void initialize() {
26+
Robot.dt.enableVelocityPIDs();
2627
}
2728

2829
// Called repeatedly when this Command is scheduled to run
2930
@Override
3031
protected void execute() {
3132
Robot.dt.resetVPIDInputRanges();
33+
Robot.dt.updatePidConstants();
3234
Robot.dt.teleopDrive();
3335
}
3436

0 commit comments

Comments
 (0)