63 lines
2.0 KiB
Java
63 lines
2.0 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.subsystem;
|
|
|
|
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;
|
|
import frc.robot.Constants;
|
|
|
|
public class Lanceur extends SubsystemBase {
|
|
/** Creates a new Lanceur. */
|
|
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
|
private GenericEntry vitesse =
|
|
dashboard.add("vitesse", 1)
|
|
.withSize(1, 1)
|
|
.withPosition(3, 3)
|
|
.getEntry();
|
|
private GenericEntry vitesseamp =
|
|
dashboard.add("vitesseamp", 1)
|
|
.withSize(1, 1)
|
|
.withPosition(3, 4)
|
|
.getEntry();
|
|
public Lanceur() {
|
|
|
|
}
|
|
final CANSparkMax lanceur1 = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
|
final CANSparkMax lanceur2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless);
|
|
final CANSparkMax lanceur3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless);
|
|
final CANSparkMax lanceur4 = new CANSparkMax(Constants.lancer4, MotorType.kBrushless);
|
|
public void pid(){
|
|
lanceur1.getPIDController();
|
|
}
|
|
public void lancer(double vitesse){
|
|
lanceur1.set(vitesse);
|
|
}
|
|
public void lancerspeaker(){
|
|
lancer(vitesse.getDouble(0.1));
|
|
}
|
|
public void lanceramp(){
|
|
lancer(vitesseamp.getDouble(0.5));
|
|
}
|
|
public double vitesse(double vitesse){
|
|
return lanceur1.getEncoder().getVelocity();
|
|
}
|
|
public void lanceur(){
|
|
lanceur2.follow(lanceur1);
|
|
lanceur3.follow(lanceur1);
|
|
lanceur4.follow(lanceur1);
|
|
lanceur3.setInverted(true);
|
|
lanceur4.setInverted(true);
|
|
}
|
|
|
|
@Override
|
|
public void periodic() {}
|
|
// This method will be called once per scheduler run
|
|
|
|
}
|