generated from SciBorgs/Hydrogen
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc5005e
commit e801fbf
Showing
4 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 16 additions & 8 deletions
24
src/main/java/org/sciborgs1155/robot/shooter/feeder/RealFeeder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
package org.sciborgs1155.robot.shooter.feeder; | ||
|
||
import static org.sciborgs1155.robot.Ports.Shooter.Feeder.*; | ||
|
||
import com.revrobotics.CANSparkBase.IdleMode; | ||
import com.revrobotics.CANSparkFlex; | ||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
|
||
public class RealFeeder implements FeederIO{ | ||
CANSparkFlex motor = new CANSparkFlex(0, MotorType.kBrushless) | ||
public class RealFeeder implements FeederIO { | ||
|
||
@Override | ||
public double getFeederSpeed(){ | ||
private final CANSparkFlex motor = new CANSparkFlex(FEEDER_SPARK, MotorType.kBrushless); | ||
|
||
} | ||
public RealFeeder() { | ||
motor.setIdleMode(IdleMode.kBrake); | ||
} | ||
|
||
@Override | ||
public void setFeederVoltage(double speed){ | ||
// @Override | ||
// public double getFeederVoltage() { | ||
// return motor.getBusVoltage(); | ||
// } | ||
|
||
} | ||
@Override | ||
public void setFeederVoltage(double speed) { | ||
motor.setVoltage(speed); | ||
} | ||
} |
22 changes: 21 additions & 1 deletion
22
src/main/java/org/sciborgs1155/robot/shooter/feeder/SimFeeder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
package org.sciborgs1155.robot.shooter.feeder; | ||
|
||
public class SimFeeder {} | ||
import static org.sciborgs1155.robot.shooter.ShooterConstants.Feeder.*; | ||
|
||
import edu.wpi.first.math.system.plant.DCMotor; | ||
import edu.wpi.first.math.system.plant.LinearSystemId; | ||
import edu.wpi.first.wpilibj.simulation.DCMotorSim; | ||
|
||
public class SimFeeder implements FeederIO { | ||
DCMotor motor = DCMotor.getNEO(1); | ||
|
||
private final DCMotorSim simMotor = | ||
new DCMotorSim(LinearSystemId.createDCMotorSystem(kV, kA), motor, GEARING); | ||
|
||
// @Override public double getFeederVoltage(){ | ||
// motor.getVoltage() | ||
// } | ||
|
||
@Override | ||
public void setFeederVoltage(double voltage) { | ||
simMotor.setInputVoltage(voltage); | ||
} | ||
} |