Skip to content

Commit

Permalink
Investigate further. May just have been because we were missing perio…
Browse files Browse the repository at this point in the history
…dic().
  • Loading branch information
JohnGilb committed Feb 18, 2024
1 parent 0fb65ac commit 1a22a7c
Showing 1 changed file with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import xbot.common.command.BaseSetpointSubsystem;
import competition.electrical_contract.ElectricalContract;
import xbot.common.controls.actuators.XCANSparkMax;
import xbot.common.controls.actuators.XCANSparkMaxPIDProperties;
import xbot.common.properties.DoubleProperty;
import xbot.common.properties.PropertyFactory;

Expand Down Expand Up @@ -82,23 +83,25 @@ public ShooterWheelSubsystem(XCANSparkMax.XCANSparkMaxFactory sparkMaxFactory, P
// THIS IS HOW MUCH RPM WE CAN TOLERATE (needs testing and is UNIVERSAL)
acceptableToleranceRPM = pf.createPersistentProperty("AcceptableToleranceRPM", 200);


// MOTOR RELATED, COULD BE USED LATER
// XCANSparkMaxPIDProperties wheelDefaultProps = new XCANSparkMaxPIDProperties();
// wheelDefaultProps.p = 0.00008;
// wheelDefaultProps.i = 0;
// wheelDefaultProps.d = 0;
// wheelDefaultProps.feedForward = 0.000185;
// wheelDefaultProps.iZone = 200;
// wheelDefaultProps.maxOutput = 1;
// wheelDefaultProps.minOutput = -1;
XCANSparkMaxPIDProperties defaultShooterPidProperties = new XCANSparkMaxPIDProperties(
0.0007,
0.0,
0.0,
0.0,
0.00019,
1,
-1
);

if (contract.isShooterReady()) {
this.leader = sparkMaxFactory.create(contract.getShooterMotorLeader(), this.getPrefix(),
"ShooterMaster", null);
this.follower = sparkMaxFactory.create(contract.getShooterMotorFollower(), this.getPrefix(),
"ShooterFollower", null);
this.follower.follow(this.leader, true);
"ShooterMaster", "ShooterWheel", defaultShooterPidProperties);
this.follower = sparkMaxFactory.createWithoutProperties(contract.getShooterMotorFollower(), this.getPrefix(),
"ShooterFollower");
this.follower.follow(this.leader, false);

this.leader.setP(defaultShooterPidProperties.p());
this.leader.setFF(defaultShooterPidProperties.feedForward());
}
}

Expand Down Expand Up @@ -204,6 +207,9 @@ public void configurePID() {
}
}
public void periodic() {
leader.periodic();
follower.periodic();

aKitLog.record("TargetRPM", getTargetValue());
aKitLog.record("CurrentRPM", getCurrentValue());
aKitLog.record("TrimRPM", getTrimRPM());
Expand Down

0 comments on commit 1a22a7c

Please sign in to comment.