samuel desharnais 57af33dfed
2024-12-16 19:30:19 -05:00

67 lines
2.1 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 edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
public class Accumulateur extends SubsystemBase {
/** Creates a new Accumulateur. */
public Accumulateur() {dashboard.addBoolean("photocell", this::photocell).withSize(1, 1).withPosition(0, 1);
dashboard.addBoolean("photocell2", this::photocell).withSize(1, 1).withPosition(1, 1);
}
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private GenericEntry vitesse =
dashboard.add("vitesseacc", 0.1)
.withSize(1, 1)
.withPosition(0, 0)
.getEntry();
final WPI_TalonSRX strap = new WPI_TalonSRX(16);
final WPI_TalonSRX rouesbleues = new WPI_TalonSRX(21);
final WPI_TalonSRX roueRouge1 = new WPI_TalonSRX(14);
final WPI_TalonSRX roueRouge2 = new WPI_TalonSRX(22);
final DigitalInput photocell = new DigitalInput(2);
final DigitalInput photocell2 = new DigitalInput(5);
public void encodeur(){
}
public boolean photocell(){
return !photocell.get();
}
public boolean photocell2(){
return !photocell2.get();
}
public void desaccumule(double vitesse){
strap.set(vitesse);
}
public void masterslave(){
roueRouge2.follow(roueRouge1);
roueRouge1.setInverted(true);
}
public void masterslave2(){
rouesbleues.follow(strap);
rouesbleues.setInverted(true);
}
public void Petitlanceur(double vitesse){
roueRouge1.set(vitesse);
}
public void desaccumule(){
desaccumule(vitesse.getDouble(0.9));
}
public void rouesbleue(double vitesse){
rouesbleues.set(vitesse);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}