Skip to content

Commit

Permalink
stop forcing updates on max velocity if not a change in velocity mult
Browse files Browse the repository at this point in the history
  • Loading branch information
GearBoxFox committed Mar 9, 2024
1 parent d91b2b2 commit 735bbb6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/frc/robot/subsystems/arm/ArmIOKraken.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class ArmIOKraken implements ArmIO {

private boolean m_tracking = false;

private double m_prevArmVelocityMult;
private double m_prevWristVelocityMult;

// Status signals
private final StatusSignal<Double> m_armPositionSignal;
private final StatusSignal<Double> m_wristPositionSignal;
Expand Down Expand Up @@ -249,7 +252,10 @@ public void setArmVoltage(double voltage) {

@Override
public void setArmAngle(double degrees, double velocityMult) {
m_armMaxVelDegS.updateIfChanged(true);
if (velocityMult == 0.0 && m_prevArmVelocityMult != velocityMult) {
m_armMaxVelDegS.updateIfChanged(true);
}
m_prevArmVelocityMult = velocityMult;
m_armDynMMRequest.Velocity = m_armDynMMRequest.Velocity * velocityMult;

m_armMaster.setControl(m_armDynMMRequest.withPosition(degrees / 360));
Expand All @@ -264,7 +270,10 @@ public void setWristVoltage(double voltage) {

@Override
public void setWristAngle(double degrees, double velocityMult) {
m_wristMaxVelDegS.updateIfChanged(true);
if (velocityMult == 0.0 && m_prevWristVelocityMult != velocityMult) {
m_wristMaxVelDegS.updateIfChanged(true);
}
m_prevWristVelocityMult = velocityMult;
m_wristDynMMRequest.Velocity = m_wristDynMMRequest.Velocity * velocityMult;

m_wristMaster.setControl(m_wristDynMMRequest.withPosition(degrees / 360));
Expand Down

0 comments on commit 735bbb6

Please sign in to comment.