66 lines
1.9 KiB
Java
Raw Normal View History

2025-01-28 18:24:21 -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.SparkLowLevel.MotorType;
import com.revrobotics.spark.SparkMax;
2025-02-24 18:18:14 -05:00
import edu.wpi.first.networktables.GenericEntry;
2025-01-28 18:24:21 -05:00
import edu.wpi.first.wpilibj.DigitalInput;
2025-02-24 18:18:14 -05:00
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
2025-02-25 17:56:24 -05:00
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
2025-01-28 18:24:21 -05:00
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Pince extends SubsystemBase {
/** Creates a new Pince. */
2025-02-25 17:56:24 -05:00
ShuffleboardTab teb = Shuffleboard.getTab("teb");
public Pince() {
teb.addBoolean("limit pince",this::position);
teb.addDouble("encodeur pince", this::encodeurpivot);
}
2025-02-22 11:41:37 -05:00
final SparkMax coral = new SparkMax(20, MotorType.kBrushless);
final SparkMax pivoti = new SparkMax(14, MotorType.kBrushless);
final SparkMax algue1 = new SparkMax(16, MotorType.kBrushless);
final SparkMax algue2 = new SparkMax(19, MotorType.kBrushless);
2025-02-25 17:56:24 -05:00
final DigitalInput limit6 = new DigitalInput(9);
2025-01-28 18:24:21 -05:00
public void aspirecoral(double vitesse){
coral.set(vitesse);
}
public void pivote(double vitesse){
pivoti.set(vitesse);
}
public void aspirealgue(double vitesse){
algue2.set(vitesse);
algue1.set(-vitesse);
}
public double encodeurpivot(){
return pivoti.getEncoder().getPosition();
}
2025-01-28 18:46:42 -05:00
public boolean position(){
return limit6.get();
2025-01-28 18:24:21 -05:00
}
public void reset(){
pivoti.getEncoder().setPosition(0);
2025-01-28 19:09:16 -05:00
}
public double emperagecoral(){
return coral.getOutputCurrent();
}
public double emperagealgue(){
return algue1.getOutputCurrent();
2025-02-24 18:15:32 -05:00
}
public void algue1Test(double vitesse){
algue1.set(vitesse);
}
public void algue2Test(double vitesse){
algue2.set(vitesse);
2025-01-28 18:24:21 -05:00
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}