47 lines
1.6 KiB
Java
47 lines
1.6 KiB
Java
// 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;
|
|
|
|
|
|
|
|
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
|
|
import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
|
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
|
import com.revrobotics.CANSparkMax;
|
|
import com.revrobotics.CANSparkLowLevel.MotorType;
|
|
|
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
|
|
public class Lanceur extends SubsystemBase {
|
|
/** Creates a new Lanceur. */
|
|
public Lanceur() {}
|
|
|
|
final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0);
|
|
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1);
|
|
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushed);
|
|
public void encodeur(double distance){
|
|
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);
|
|
|
|
}
|
|
public void lance(double vitesse){
|
|
lanceur1.set(vitesse);
|
|
lanceur2.set(-vitesse);
|
|
}
|
|
public void tourelRotation(double vitesse){
|
|
tourelle.set(vitesse);
|
|
}
|
|
public void setPID(double p, double i, int d) {
|
|
}
|
|
@Override
|
|
public void periodic() {
|
|
// This method will be called oncehttps://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json per scheduler run
|
|
}
|
|
}
|