DASHBOARD LANCEUR

This commit is contained in:
Olivier Dubois 2024-10-30 19:37:02 -04:00
parent 1989806378
commit 4ece413126

View File

@ -12,17 +12,24 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkLowLevel.MotorType;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Lanceur extends SubsystemBase {
/** Creates a new Lanceur. */
public Lanceur() {}
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);
private GenericEntry vitesse =
dashboard.add("vitesselanceur", 0.2)
.withSize(0,0)
.withPosition(1, 4)
.getEntry();
public void encodeur(double distance){
lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
@ -34,6 +41,9 @@ public class Lanceur extends SubsystemBase {
lanceur1.set(vitesse);
lanceur2.set(-vitesse);
}
public void lance(){
lance(vitesse.getDouble(0.2));
}
public void tourelRotation(double vitesse){
tourelle.set(vitesse);
}