avancement du dashboard

This commit is contained in:
Olivier Dubois 2024-02-05 19:15:56 -05:00
parent b4496c8987
commit f5e879878a
6 changed files with 24 additions and 8 deletions

View File

@ -47,6 +47,7 @@ public class RobotContainer {
Balayer balayer = new Balayer(balayeuse, accumulateur);
GuiderHaut guiderHaut = new GuiderHaut(guideur);
GuiderBas guiderBas = new GuiderBas(guideur);
Lancer lancer = new Lancer(lanceur);
LancerNote lancernote = new LancerNote(lanceur, accumulateur);
Lancerampli lancerampli = new Lancerampli(lanceur);
CommandJoystick joystick = new CommandJoystick(0);

View File

@ -26,7 +26,7 @@ public class Balayer extends Command {
public void execute() {
if(accumulateur.limitswitch()){
balayeuse.balaye(0);
accumulateur.Accumuler(0);
accumulateur.Accumuler();
}
else{
balayeuse.balaye(0.6);

View File

@ -26,7 +26,7 @@ public class Lancer extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
lanceur.lancer(0.3);
lanceur.lancerspeaker();
}
// Called once the command ends or is interrupted.

View File

@ -26,7 +26,7 @@ public class LancerNote extends Command {
@Override
public void execute() {
double vitesse = 100;
lancer.lancer(vitesse);
lancer.lancerspeaker();
if(lancer.vitesse(vitesse)>vitesse){
accumulateur.Accumuler(0.6);
}

View File

@ -28,7 +28,7 @@ public class Lancerampli extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
lanceur.lancer(0.1);
lanceur.lanceramp();
}
// Called once the command ends or is interrupted.

View File

@ -7,15 +7,24 @@ package frc.robot.subsystem;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkLowLevel.MotorType;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
public class Lanceur extends SubsystemBase {
/** Creates a new Lanceur. */
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private GenericEntry vitesse =
dashboard.add("vitesse", 1)
.getEntry();
private GenericEntry vitesseamp =
dashboard.add("vitesseamp", 1)
.getEntry();
public Lanceur() {
public Lanceur() {}
}
final CANSparkMax lanceur1 = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
final CANSparkMax lanceur2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless);
final CANSparkMax lanceur3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless);
@ -26,6 +35,12 @@ public class Lanceur extends SubsystemBase {
public void lancer(double vitesse){
lanceur1.set(vitesse);
}
public void lancerspeaker(){
lancer(vitesse.getDouble(0.1));
}
public void lanceramp(){
lancer(vitesseamp.getDouble(0.5));
}
public double vitesse(double vitesse){
return lanceur1.getEncoder().getVelocity();
}