Skip to content

Commit

Permalink
Use isOK() method
Browse files Browse the repository at this point in the history
  • Loading branch information
suryatho committed Feb 15, 2024
1 parent 976a7c3 commit b3980c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void updateInputs() {
LoggedTunableNumber.ifChanged(
hashCode(), () -> io.setTurnPID(turnkP.get(), 0, turnkD.get()), turnkP, turnkD);

// Display warnings
// Display alerts
driveMotorDisconnected.set(!inputs.driveMotorConnected);
turnMotorDisconnected.set(!inputs.turnMotorConnected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public class ModuleIOKrakenFOC implements ModuleIO {
new VelocityTorqueCurrentFOC(0).withUpdateFreqHz(0);
private final PositionTorqueCurrentFOC turnPositionControl =
new PositionTorqueCurrentFOC(0).withUpdateFreqHz(0);
private final NeutralOut driveBrake = new NeutralOut().withUpdateFreqHz(0);
private final NeutralOut turnBrake = new NeutralOut().withUpdateFreqHz(0);
private final NeutralOut driveNeutral = new NeutralOut().withUpdateFreqHz(0);
private final NeutralOut turnNeutral = new NeutralOut().withUpdateFreqHz(0);

public ModuleIOKrakenFOC(ModuleConfig config) {
// Init controllers and encoders from config constants
Expand Down Expand Up @@ -156,11 +156,11 @@ public void updateInputs(ModuleIOInputs inputs) {
driveAppliedVolts,
driveSupplyCurrent,
driveTorqueCurrent)
== StatusCode.OK;
.isOK();
inputs.turnMotorConnected =
BaseStatusSignal.refreshAll(
turnPosition, turnVelocity, turnAppliedVolts, turnSupplyCurrent, turnTorqueCurrent)
== StatusCode.OK;
.isOK();

inputs.drivePositionRad = Units.rotationsToRadians(drivePosition.getValueAsDouble());
inputs.driveVelocityRadPerSec = Units.rotationsToRadians(driveVelocity.getValueAsDouble());
Expand Down Expand Up @@ -247,7 +247,7 @@ public void setTurnBrakeMode(boolean enable) {

@Override
public void stop() {
driveTalon.setControl(driveBrake);
turnTalon.setControl(turnBrake);
driveTalon.setControl(driveNeutral);
turnTalon.setControl(turnNeutral);
}
}

0 comments on commit b3980c0

Please sign in to comment.