mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 08:48:01 -06:00
Merge branch 'master' into auto-programming
This commit is contained in:
@@ -33,9 +33,9 @@ public class DriveStraightToPositionMM extends CommandBase {
|
||||
m_pneumatics = subsystem2;
|
||||
try {
|
||||
if (m_pneumatics.m_isSpeedShiftHigh) {
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_HIGH * 2;
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_HIGH;
|
||||
} else {
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_LOW * 2;
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_LOW;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error In Motion Magic Switch Gains.");
|
||||
|
||||
@@ -31,9 +31,9 @@ public class DriveStraightToPositionPID extends CommandBase {
|
||||
m_pneumatics = subsystem2;
|
||||
try {
|
||||
if (m_pneumatics.m_isSpeedShiftHigh) {
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_HIGH * 2;
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_HIGH;
|
||||
} else {
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_LOW * 2;
|
||||
m_targetPosIn = targetPos * DriveConstants.TICKS_PER_INCH_LOW;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error In Motion Magic Switch Gains.");
|
||||
|
||||
@@ -34,7 +34,18 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
m_shooter.runDrumShooterVelocityPID(m_shooter.addFireVel());
|
||||
//Tells whether the target velocity has been reached
|
||||
m_actualVel = m_shooter.m_shooterFalcon.getSelectedSensorPosition();
|
||||
m_targetVel = m_shooter.addFireVel();
|
||||
double error = m_actualVel - m_targetVel;
|
||||
if (Math.abs(error) < ShooterConstants.DRUM_VELOCITY_BOUND){
|
||||
m_shooter.m_isDrumReady = true;
|
||||
m_shooter.runDrumShooterVelocityPID(m_targetVel);
|
||||
}
|
||||
else{
|
||||
m_shooter.m_isDrumReady = false;
|
||||
m_shooter.runDrumShooterVelocityPID(m_targetVel);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@@ -45,16 +56,6 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
//Tells whether the target velocity has been reached
|
||||
double upperBound = m_targetVel + ShooterConstants.DRUM_VELOCITY_BOUND;
|
||||
double lowerBound = m_targetVel - ShooterConstants.DRUM_VELOCITY_BOUND;
|
||||
if (m_actualVel < upperBound && m_actualVel > lowerBound){
|
||||
m_shooter.m_isDrumReady = true;
|
||||
}
|
||||
else{
|
||||
m_shooter.m_isDrumReady = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ public class TrackTarget extends CommandBase {
|
||||
|
||||
m_shooter.m_fireVel = fireVel;
|
||||
m_shooterHood.m_fireAngle = fireAngle;// + m_shooter.shooterTrims.m_hoodTrim;
|
||||
m_shooterAim.m_targetDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user