From 787251658c0164778d1abd633dcc6b1baa7532cb Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Wed, 23 Oct 2024 18:59:06 -0400 Subject: [PATCH 1/2] lanceur encodeur --- src/main/java/frc/robot/Subsystems/Lanceur.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/frc/robot/Subsystems/Lanceur.java b/src/main/java/frc/robot/Subsystems/Lanceur.java index b46a05a..8a5c2e8 100644 --- a/src/main/java/frc/robot/Subsystems/Lanceur.java +++ b/src/main/java/frc/robot/Subsystems/Lanceur.java @@ -11,6 +11,8 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkLowLevel.MotorType; +import edu.wpi.first.wpilibj.Encoder; + import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Lanceur extends SubsystemBase { @@ -20,6 +22,10 @@ public class Lanceur extends SubsystemBase { final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0); final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1); final CANSparkMax tourel = new CANSparkMax(2, MotorType.kBrushed); + Encoder encoder = new Encoder(0, 1); + public void encodeur(double distance){ + encoder.getDistance(); + } public void lance(double vitesse){ lanceur1.set(vitesse); lanceur2.set(-vitesse); From 89d155ae5e7598d14e56408a11ed8a3752d08516 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Wed, 23 Oct 2024 19:17:48 -0400 Subject: [PATCH 2/2] encodeur --- src/main/java/frc/robot/Subsystems/Lanceur.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Subsystems/Lanceur.java b/src/main/java/frc/robot/Subsystems/Lanceur.java index 8a5c2e8..9926b77 100644 --- a/src/main/java/frc/robot/Subsystems/Lanceur.java +++ b/src/main/java/frc/robot/Subsystems/Lanceur.java @@ -24,7 +24,7 @@ public class Lanceur extends SubsystemBase { final CANSparkMax tourel = new CANSparkMax(2, MotorType.kBrushed); Encoder encoder = new Encoder(0, 1); public void encodeur(double distance){ - encoder.getDistance(); + encoder.setDistancePerPulse(distance); } public void lance(double vitesse){ lanceur1.set(vitesse);