dashboard + limitswitchs tourel
This commit is contained in:
@ -21,20 +21,25 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class Lanceur extends SubsystemBase {
|
||||
/** Creates a new Lanceur. */
|
||||
public Lanceur() {dashboard.add("rottourel", 0.2)
|
||||
.withSize(0,0)
|
||||
.withPosition(1, 3);}
|
||||
public Lanceur() {
|
||||
dashboard.addBoolean("limitswitch1", this::limitswitch1)
|
||||
.withSize(0,0).withPosition(1,2);
|
||||
dashboard.addBoolean("limitswitch2", this::limitswitch2)
|
||||
.withSize(0,0).withPosition(0,3);
|
||||
dashboard.addDouble("rottourel", this::distancetourel)
|
||||
.withSize(0,0).withPosition(1, 0);
|
||||
}
|
||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||
|
||||
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
||||
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1);
|
||||
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushed);
|
||||
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushless);
|
||||
final DigitalInput limitswitch1 = new DigitalInput(0);
|
||||
final DigitalInput limitswitch2 = new DigitalInput(1);
|
||||
private GenericEntry vitesse =
|
||||
dashboard.add("vitesselanceur", 0.2)
|
||||
.withSize(0,0)
|
||||
.withPosition(0, 3)
|
||||
.withPosition(0, 2)
|
||||
.getEntry();
|
||||
|
||||
public void encodeur(double distance){
|
||||
@ -42,7 +47,12 @@ public class Lanceur extends SubsystemBase {
|
||||
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
||||
lanceur1.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1);
|
||||
}
|
||||
|
||||
public void touchagedelimitswitch1(double distance){
|
||||
tourelle.getEncoder().setPosition(distance);
|
||||
}
|
||||
public void touchagedelimitswitch2(double distance){
|
||||
tourelle.getEncoder().setPosition(distance);
|
||||
}
|
||||
public void masterslave(){
|
||||
lanceur2.follow(lanceur1);
|
||||
lanceur2.setInverted(true);
|
||||
@ -58,10 +68,10 @@ public class Lanceur extends SubsystemBase {
|
||||
}
|
||||
|
||||
public double vitessetourel(){
|
||||
return(tourelle.getEncoder().getVelocity());
|
||||
return (tourelle.getEncoder().getVelocity());
|
||||
}
|
||||
public double distancetourel(){
|
||||
return(tourelle.getEncoder().getPosition());
|
||||
return (tourelle.getEncoder().getPosition());
|
||||
}
|
||||
public void PIDlanceur(double p, double i, double d) {
|
||||
lanceur1.config_kP(0, p);
|
||||
|
Reference in New Issue
Block a user