54 lines
1.6 KiB
Java
Raw Normal View History

2025-01-27 20:14:20 -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;
import com.revrobotics.spark.SparkFlex;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkLowLevel.MotorType;
2025-02-22 15:21:04 -05:00
import edu.wpi.first.networktables.GenericEntry;
2025-01-27 20:14:20 -05:00
import edu.wpi.first.wpilibj.DigitalInput;
2025-02-22 15:21:04 -05:00
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardComponent;
2025-02-25 17:57:57 -05:00
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
2025-02-22 15:21:04 -05:00
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
2025-01-27 20:14:20 -05:00
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2025-02-25 18:03:04 -05:00
public class Requin extends SubsystemBase {
2025-01-27 20:14:20 -05:00
/** Creates a new Requin. */
2025-02-25 18:03:04 -05:00
ShuffleboardTab teb = Shuffleboard.getTab("teb");
2025-02-25 17:57:57 -05:00
public Requin() {
2025-02-25 18:05:00 -05:00
teb.addBoolean("limit requin", this::enHaut);
2025-02-25 17:57:57 -05:00
}
2025-02-19 17:21:37 -05:00
final SparkFlex balaye = new SparkFlex(15, MotorType.kBrushless);
2025-02-20 20:10:58 -05:00
final SparkMax rotatione = new SparkMax(17, MotorType.kBrushless);
2025-02-25 17:57:57 -05:00
final DigitalInput limit3 = new DigitalInput(1);
2025-02-22 15:21:04 -05:00
2025-02-25 18:03:04 -05:00
2025-02-22 15:21:04 -05:00
2025-01-27 20:14:20 -05:00
public void balaye(double vitesse){
balaye.set(vitesse);
}
public void rotationer(double vitesse){
2025-01-28 19:34:18 -05:00
rotatione.set(vitesse);
2025-01-27 20:14:20 -05:00
}
public boolean enHaut(){
2025-01-28 19:34:18 -05:00
return limit3.get();
2025-02-19 17:21:37 -05:00
}
2025-01-28 19:34:18 -05:00
public double encodeur(){
return rotatione.getEncoder().getPosition();
}
public void reset(){
rotatione.getEncoder().setPosition(0);
}
2025-02-20 20:10:58 -05:00
public double amp(){
return balaye.getOutputCurrent();
}
2025-01-27 20:14:20 -05:00
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}