Fix Dead assist so it uses the right constants and TurnRate code

This commit is contained in:
Keenan D. Buckley
2020-02-19 19:15:45 -07:00
parent 9c2a897236
commit 11f7f2272e
5 changed files with 10 additions and 9 deletions
@@ -47,7 +47,7 @@ public class DriveWithJoystickDriveStraight extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
m_currentGyro = m_drive.m_rightFrontMotor.getSelectedSensorPosition(DriveConstants.PID_TURN);
m_currentGyro = m_drive.m_rightFrontMotor.getSelectedSensorPosition(1);
double moveInput = -m_controller.getLeftYAxis();
double steerInput = m_controller.getRightXAxis();
double moveOutput = 0;
@@ -102,7 +102,7 @@ public class DriveWithJoystickDriveStraight extends CommandBase {
private void resetGyroTarget() {
//m_targetGyro = m_currentGyro;
m_targetGyro = m_currentGyro
+ (3 * m_drive.m_rightFrontMotor.getSelectedSensorVelocity(1));
+ m_drive.getTurnRate();
}
// Called once the command ends or is interrupted.
@@ -131,11 +131,7 @@ public class DriveWithJoystickUsingDeadAssistPID extends CommandBase {
private void resetGyroTarget() {
m_targetGyro = m_currentGyro;
m_targetGyro = m_currentGyro
+ (3 * m_drive.m_rightFrontMotor.getSelectedSensorVelocity(1));
m_targetGyro = MathUtil.clamp( m_targetGyro,
m_currentGyro-(DriveConstants.TICKS_PER_GYRO_REV/8),
m_currentGyro+(DriveConstants.TICKS_PER_GYRO_REV/8));
+ m_drive.getTurnRate();
}
// Called once the command ends or is interrupted.