2025-01-27 18:27:08 -05: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;
|
|
|
|
|
2025-01-27 19:12:49 -05:00
|
|
|
import com.revrobotics.spark.SparkMax;
|
|
|
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
|
|
|
|
2025-01-27 18:34:20 -05:00
|
|
|
import edu.wpi.first.wpilibj.DigitalInput;
|
2025-02-26 19:09:33 -05:00
|
|
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
|
|
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
2025-01-27 18:27:08 -05:00
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
|
|
|
|
|
|
public class Grimpeur extends SubsystemBase {
|
|
|
|
/** Creates a new Grimpeur. */
|
2025-02-26 19:09:33 -05:00
|
|
|
ShuffleboardTab teb = Shuffleboard.getTab("teb");
|
|
|
|
public Grimpeur() {
|
|
|
|
teb.addBoolean("limit grimpeur", this::stop);
|
|
|
|
teb.addDouble("encodeur grimpeur", this::encodeur);
|
|
|
|
}
|
2025-02-22 11:44:53 -05:00
|
|
|
final SparkMax grimpeur = new SparkMax(21,MotorType.kBrushless);
|
2025-02-26 19:09:33 -05:00
|
|
|
final DigitalInput limit1 = new DigitalInput(2);
|
2025-01-27 18:34:20 -05:00
|
|
|
public void grimpe(double vitesse){
|
|
|
|
grimpeur.set(vitesse);
|
|
|
|
}
|
2025-01-27 18:40:58 -05:00
|
|
|
public boolean stop(){
|
|
|
|
return limit1.get();
|
2025-01-27 18:34:20 -05:00
|
|
|
}
|
2025-01-28 17:51:17 -05:00
|
|
|
public double encodeur(){
|
|
|
|
return grimpeur.getEncoder().getPosition();
|
|
|
|
}
|
|
|
|
public void reset(){
|
2025-03-01 13:53:13 -05:00
|
|
|
grimpeur.getEncoder().setPosition(135.11);
|
2025-01-28 17:51:17 -05:00
|
|
|
}
|
2025-01-27 18:27:08 -05:00
|
|
|
@Override
|
|
|
|
public void periodic() {
|
|
|
|
// This method will be called once per scheduler run
|
|
|
|
}
|
|
|
|
}
|