This commit is contained in:
Aarav
2023-03-15 15:29:52 -06:00
parent 29eeee1f7f
commit 9322997ce8
6 changed files with 54 additions and 15 deletions
@@ -47,7 +47,7 @@ public class Arm extends SubsystemBase {
this(pivot, tele, encoder, false);
}
public void setRotVel(double vel) {
public void setRotVel(double vel, boolean fast) {
var degrees = Math.abs(getArmRotation()) - 135;
SmartDashboard.putNumber("arm degrees", degrees);
SmartDashboard.putNumber("arm rot vel", vel);
@@ -55,21 +55,25 @@ public class Arm extends SubsystemBase {
if ((degrees < 2 && vel < 0) || (degrees > 110 && vel > 0)) {
m_pivot.set(ControlMode.PercentOutput, 0);
} else if (degrees > 90 && vel > 0) {
m_pivot.set(ControlMode.PercentOutput, .1 * vel);
m_pivot.set(ControlMode.PercentOutput, .2 * vel);
} else {
m_pivot.set(ControlMode.PercentOutput, .25 * vel);
m_pivot.set(ControlMode.PercentOutput, (fast ? .8 : .3) * vel);
}
}
public void setTeleVel(double vel) {
m_tele.set(ControlMode.PercentOutput, -0.5 * vel);
public void setTeleVel(double vel, boolean speed) {
m_tele.set(ControlMode.PercentOutput, (speed ? -.9 : .7) * vel);
}
public boolean isTeleIn() {
return m_tele.isFwdLimitSwitchClosed() == 1 ||
return m_tele.isRevLimitSwitchClosed() == 1 ||
m_tele.getSelectedSensorPosition() < reverse_tele;
}
public double getTeleUnit() {
return m_tele.getSelectedSensorPosition() - reverse_tele;
}
public void armSetRotation(double rot) {
if (rot > 1 || rot < 0) return;
// Move arm code
@@ -104,8 +108,8 @@ public class Arm extends SubsystemBase {
(ArmConstants.TELE_FORWARD_SOFT_LIMIT - ArmConstants.TELE_REVERSE_SOFT_LIMIT);
if (pivot > 0 || tele < 0 || checkLimits(abs_tele, abs_pivot)) {
setRotVel(pivot);
setTeleVel(tele);
setRotVel(pivot, false);
setTeleVel(tele, false);
}
}