58 lines
1.6 KiB
Java
58 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.revrobotics.CANSparkMax;
|
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
|
|
|
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
import frc.robot.Constants;
|
|
|
|
public class Lanceur extends SubsystemBase {
|
|
ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0");
|
|
|
|
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
|
|
//ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
|
|
//.getLayout("Pid", BuiltInLayouts.kList)
|
|
//.withSize(3, 7);
|
|
public Lanceur(){
|
|
dash2.add("test", 1);
|
|
dashboard.add("p", 1);
|
|
dashboard.add("i", 2);
|
|
dashboard.add("d", 3);
|
|
}
|
|
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
|
|
|
|
public void lancer(double vitesse){
|
|
lanceur.set(vitesse);
|
|
}
|
|
public double vitesse(){
|
|
return(lanceur.getEncoder().getVelocity());
|
|
}
|
|
|
|
// encodeur
|
|
public double distance() {
|
|
return(lanceur.getEncoder().getPosition());
|
|
}
|
|
public void Reset() {
|
|
lanceur.getEncoder().setPosition(0);
|
|
}
|
|
|
|
public void stop() {
|
|
}
|
|
|
|
@Override
|
|
public void periodic() {
|
|
// This method will be called once per scheduler run
|
|
}
|
|
|
|
public void setPID(double p, double i, int d) {
|
|
}
|
|
}
|