2024-10-21 19:36:34 -04:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
package frc.robot.Subsystems;
|
|
|
|
|
2024-10-21 19:54:51 -04:00
|
|
|
|
|
|
|
|
2024-10-28 18:52:38 -04:00
|
|
|
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
|
|
|
|
import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
|
2024-10-21 19:52:53 -04:00
|
|
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
2024-10-21 19:58:56 -04:00
|
|
|
import com.revrobotics.CANSparkMax;
|
|
|
|
import com.revrobotics.CANSparkLowLevel.MotorType;
|
2024-10-21 19:52:53 -04:00
|
|
|
|
2024-10-28 18:52:38 -04:00
|
|
|
|
2024-10-23 18:59:06 -04:00
|
|
|
|
2024-10-21 19:36:34 -04:00
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
|
|
|
|
|
|
public class Lanceur extends SubsystemBase {
|
|
|
|
/** Creates a new Lanceur. */
|
|
|
|
public Lanceur() {}
|
2024-10-23 18:10:59 -04:00
|
|
|
|
2024-10-21 19:52:53 -04:00
|
|
|
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
2024-10-21 19:58:56 -04:00
|
|
|
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1);
|
|
|
|
final CANSparkMax tourel = new CANSparkMax(2, MotorType.kBrushed);
|
2024-10-23 18:59:06 -04:00
|
|
|
public void encodeur(double distance){
|
2024-10-28 18:52:38 -04:00
|
|
|
lanceur1.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
|
|
|
lanceur2.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative);
|
|
|
|
lanceur1.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1);
|
|
|
|
lanceur2.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1);
|
2024-10-23 18:59:06 -04:00
|
|
|
}
|
2024-10-21 20:01:10 -04:00
|
|
|
public void lance(double vitesse){
|
|
|
|
lanceur1.set(vitesse);
|
|
|
|
lanceur2.set(-vitesse);
|
|
|
|
}
|
2024-10-23 17:56:39 -04:00
|
|
|
public void tourelRotation(double vitesse){
|
|
|
|
tourel.set(vitesse);
|
|
|
|
}
|
2024-10-23 18:10:59 -04:00
|
|
|
public void setPID(double p, double i, int d) {
|
|
|
|
}
|
2024-10-21 19:36:34 -04:00
|
|
|
@Override
|
|
|
|
public void periodic() {
|
2024-10-21 19:52:53 -04:00
|
|
|
// This method will be called oncehttps://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json per scheduler run
|
2024-10-21 19:36:34 -04:00
|
|
|
}
|
|
|
|
}
|