so;hwistesZ

This commit is contained in:
samuel desharnais 2025-02-10 19:11:48 -05:00
parent 9f017968e1
commit ab241f2f65
3 changed files with 86 additions and 4 deletions

View File

@ -20,10 +20,13 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction;
import frc.robot.TunerConstants.TunerConstants;
import frc.robot.commands.RainBow;
import frc.robot.subsystems.Bougie;
import frc.robot.subsystems.CommandSwerveDrivetrain;
import frc.robot.subsystems.Grimpeur;
@ -45,7 +48,7 @@ public class RobotContainer {
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
private final SendableChooser<Command> autoChooser;
Bougie bougie = new Bougie();
public RobotContainer() {
@ -73,7 +76,11 @@ public class RobotContainer {
drivetrain.registerTelemetry(logger::telemeterize);
}
public Command getAutonomousCommand() {
return autoChooser.getSelected();
return new ParallelCommandGroup(
autoChooser.getSelected(),
new RainBow(bougie)
);
}
}

View File

@ -0,0 +1,37 @@
// 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.commands;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Bougie;
/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class RainBow extends Command {
Bougie bougie;
/** Creates a new RainBow. */
public RainBow(Bougie bougie) {
this.bougie = bougie;
addRequirements(bougie);
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {bougie.RainBow();}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {bougie.RainBowStop();}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -0,0 +1,38 @@
// 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.ctre.phoenix.led.CANdle;
import com.ctre.phoenix.led.CANdleConfiguration;
import com.ctre.phoenix.led.RainbowAnimation;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Bougie extends SubsystemBase {
CANdle candle = new CANdle(5);
CANdleConfiguration config = new CANdleConfiguration();
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64);
/** Creates a new Bougie. */
public Bougie() {
config.brightnessScalar = 0.5;
candle.configAllSettings(config);
}
public void Rouge() {
candle.setLEDs(255, 0, 0);
}
public void Vert() {
candle.setLEDs(0, 255, 0);
}
public void Bleu() {
candle.setLEDs(0, 0, 255);
}
public void RainBow(){candle.animate(rainbowAnim);}
public void RainBowStop(){candle.animate(null);}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}