Add Conversion to degrees on Hood and Turret

This commit is contained in:
Keenan D. Buckley
2020-03-08 15:20:55 -06:00
parent 74f60f0e85
commit 7e760c1b55
3 changed files with 50 additions and 36 deletions
@@ -69,40 +69,6 @@ public class ShooterAim extends SubsystemBase {
SmartDashboard.putData("Turret Angle", m_turretGyro);
}
public GyroBase getGyroInterface() {
return new GyroBase(){
@Override
public void close() throws Exception {
// TODO Auto-generated method stub
}
@Override
public void reset() {
// TODO Auto-generated method stub
}
@Override
public double getRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public double getAngle() {
// TODO Auto-generated method stub
return getShooterRotatePosition();
}
@Override
public void calibrate() {
// TODO Auto-generated method stub
}
};
}
/**
* Passes subsystem needed.
* @param subsystem Subsystem needed.
@@ -140,6 +106,46 @@ public class ShooterAim extends SubsystemBase {
public double getShooterRotatePosition()
{
return m_shooterRotateMotor.getEncoder().getPosition();
return m_shooterRotateEncoder.getPosition();
}
public double getShooterRotatePositionDegrees()
{
return (m_shooterRotateEncoder.getPosition() - ShooterConstants.TURRET_MOTOR_POS_AT_ZERO_ROT) * 360/ShooterConstants.TURRET_MOTOR_ROTS_PER_ROT;
}
public GyroBase getGyroInterface() {
return new GyroBase(){
@Override
public void close() throws Exception {
// TODO Auto-generated method stub
}
@Override
public void reset() {
// TODO Auto-generated method stub
}
@Override
public double getRate() {
// TODO Auto-generated method stub
return 0;
}
@Override
public double getAngle() {
// TODO Auto-generated method stub
return getShooterRotatePositionDegrees();
}
@Override
public void calibrate() {
// TODO Auto-generated method stub
}
};
}
}
@@ -59,7 +59,7 @@ public class ShooterHood extends SubsystemBase {
// This method will be called once per scheduler run
SmartDashboard.putNumber("Fire Angle CSV", m_fireAngle);
SmartDashboard.putNumber("Hood Angle Raw", getAnglePosition());
SmartDashboard.putNumber("Hood Angle Raw", getAnglePositionDegrees());
}
/**
@@ -95,4 +95,8 @@ public class ShooterHood extends SubsystemBase {
public double getAnglePosition(){
return m_angleEncoder.getPosition();
}
public double getAnglePositionDegrees(){
return (m_angleEncoder.getPosition() - ShooterConstants.HOOD_MOTOR_POS_AT_ZERO_ROT) * 360/ShooterConstants.HOOD_MOTOR_ROTS_PER_ROT;
}
}