This commit is contained in:
commit
9f3bbd70d1
@ -21,7 +21,6 @@ import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
|
||||
// Commands
|
||||
import frc.robot.command.AllumeLED;
|
||||
import frc.robot.command.Balayer;
|
||||
import frc.robot.command.GrimpeurDroit;
|
||||
import frc.robot.command.GrimpeurGauche;
|
||||
@ -33,7 +32,6 @@ import frc.robot.command.LancerNote;
|
||||
import frc.robot.command.Lancerampli;
|
||||
import frc.robot.command.Limelight_tracker;
|
||||
import frc.robot.command.PistonFerme;
|
||||
import frc.robot.command.Pistongrimpeur;
|
||||
import frc.robot.command.PistonOuvre;
|
||||
// Subsystems
|
||||
import frc.robot.subsystem.Accumulateur;
|
||||
@ -41,7 +39,6 @@ import frc.robot.subsystem.Balayeuse;
|
||||
import frc.robot.subsystem.Drive;
|
||||
import frc.robot.subsystem.Grimpeur;
|
||||
import frc.robot.subsystem.Guideur;
|
||||
import frc.robot.subsystem.LED;
|
||||
import frc.robot.subsystem.Lanceur;
|
||||
import frc.robot.subsystem.Limelight;
|
||||
|
||||
@ -56,7 +53,6 @@ public class RobotContainer {
|
||||
Guideur guideur = new Guideur();
|
||||
Lanceur lanceur = new Lanceur();
|
||||
Limelight limelight = new Limelight();
|
||||
LED LED = new LED();
|
||||
CommandJoystick joystick = new CommandJoystick(0);
|
||||
CommandXboxController manette = new CommandXboxController(1);
|
||||
/*private final Relay blue = new Relay(0);
|
||||
@ -71,8 +67,6 @@ public class RobotContainer {
|
||||
Lancerampli lancerampli = new Lancerampli(lanceur,limelight);
|
||||
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftY);
|
||||
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getRightY);
|
||||
AllumeLED allumeLED = new AllumeLED(LED, accumulateur);
|
||||
Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED);
|
||||
public RobotContainer() {
|
||||
|
||||
dashboard.addCamera("limelight", "limelight","limelight.local:5800")
|
||||
@ -83,6 +77,8 @@ public class RobotContainer {
|
||||
.withSize(4, 4)
|
||||
.withPosition(3, 0);
|
||||
|
||||
CameraServer.startAutomaticCapture();
|
||||
|
||||
NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur));
|
||||
NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur));
|
||||
NamedCommands.registerCommand("piston", new PistonFerme(grimpeur));
|
||||
@ -110,7 +106,9 @@ public class RobotContainer {
|
||||
grimpeur.gauche(MathUtil.applyDeadband(-manette.getRightY(),0.2 ));}
|
||||
,grimpeur));
|
||||
|
||||
LED.setDefaultCommand(allumeLED);
|
||||
dashboard.add("autochooser",autoChooser)
|
||||
.withSize(2,1)
|
||||
.withPosition(1,1);
|
||||
}
|
||||
|
||||
private void configureBindings() {}
|
||||
|
@ -1,48 +0,0 @@
|
||||
// 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.command;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystem.Accumulateur;
|
||||
import frc.robot.subsystem.LED;
|
||||
|
||||
public class AllumeLED extends Command {
|
||||
private LED led;
|
||||
private Accumulateur accumulateur;
|
||||
/** Creates a new AllumeLED. */
|
||||
public AllumeLED(LED led,Accumulateur accumulateur){
|
||||
this.accumulateur = accumulateur;
|
||||
this.led = led;
|
||||
addRequirements(led);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(accumulateur.limitswitch()){
|
||||
led.couleur(0, 255, 0);
|
||||
}
|
||||
else{
|
||||
led.couleur(255, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
led.couleur(255, 0, 0);
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// 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.command;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import frc.robot.subsystem.Grimpeur;
|
||||
import frc.robot.subsystem.LED;
|
||||
|
||||
public class Pistongrimpeur extends Command {
|
||||
private LED LED;
|
||||
private Grimpeur grimpeur;
|
||||
/** Creates a new Pistongrimpeur. */
|
||||
public Pistongrimpeur(Grimpeur grimpeur,LED LED) {
|
||||
this.grimpeur = grimpeur;
|
||||
this.LED = LED;
|
||||
addRequirements(grimpeur,LED);
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
grimpeur.pistonouvre();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
if(grimpeur.piston()){
|
||||
LED.couleur(0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
LED.couleur(0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// 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.subsystem;
|
||||
|
||||
import edu.wpi.first.wpilibj.AddressableLED;
|
||||
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
|
||||
import edu.wpi.first.wpilibj.Relay;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
|
||||
public class LED extends SubsystemBase {
|
||||
/** Creates a new LED. */
|
||||
public LED() {}
|
||||
|
||||
AddressableLED led = new AddressableLED(9);
|
||||
AddressableLEDBuffer ledBuffer = new AddressableLEDBuffer(150);
|
||||
|
||||
public void led(){
|
||||
led.setData(ledBuffer);
|
||||
led.start();}
|
||||
|
||||
public void couleur(int R, int G,int B){
|
||||
for (int i = 0; i < ledBuffer.getLength(); i++) {
|
||||
// Sets the specified LED to the RGB values for red
|
||||
ledBuffer.setRGB(i, 255, 0, 0);}
|
||||
}
|
||||
@Override
|
||||
public void periodic() {
|
||||
// This method will be called once per scheduler run
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user