Compare commits
10 Commits
c0e7985ab7
...
main
Author | SHA1 | Date | |
---|---|---|---|
172d3c92ab | |||
80e1f22ea3 | |||
792d780d89 | |||
398ea4ac82 | |||
59a44ada9a | |||
0878a276dd | |||
bb9870732c | |||
c4704210b9 | |||
63313b3b7a | |||
7de77db146 |
@ -63,13 +63,14 @@ public class RobotContainer {
|
|||||||
.withSize(2, 2).withProperties(Map.of("Label position", "LEFT"));
|
.withSize(2, 2).withProperties(Map.of("Label position", "LEFT"));
|
||||||
GenericEntry L1 = layoutauto.add("choix L1",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
GenericEntry L1 = layoutauto.add("choix L1",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
GenericEntry sortirAngle = layoutauto.add("Cote?",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
GenericEntry sortirAngle = layoutauto.add("Cote?",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
GenericEntry Reculer = layoutauto.add("Reculer",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
GenericEntry ReculerB = layoutauto.add("ReculerB",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
|
GenericEntry ReculerR = layoutauto.add("ReculerR",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
GenericEntry L4 = layoutauto.add("L4",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
GenericEntry L4 = layoutauto.add("L4",false).withWidget(BuiltInWidgets.kToggleSwitch).getEntry();
|
||||||
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
|
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
|
||||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity
|
||||||
|
|
||||||
/* Setting up bindings for necessary control of the swerve drive platform */
|
/* Setting up bindings for necessary control of the swerve drive platform */
|
||||||
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
|
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
|
||||||
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1) // Add a 10% deadband
|
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1) // Add a 10% deadband
|
||||||
.withDriveRequestType(DriveRequestType.OpenLoopVoltage
|
.withDriveRequestType(DriveRequestType.OpenLoopVoltage
|
||||||
); // Use open-loop control for drive motors
|
); // Use open-loop control for drive motors
|
||||||
@ -157,32 +158,31 @@ public class RobotContainer {
|
|||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
return new SequentialCommandGroup(
|
return new SequentialCommandGroup(
|
||||||
|
drivetrain.applyRequest(()->
|
||||||
|
drive.withVelocityX(0.1*MaxSpeed)
|
||||||
|
.withVelocityY(0)
|
||||||
|
.withRotationalRate(0)).unless(()->!ReculerR.getBoolean(true)).withTimeout(3.5),
|
||||||
drivetrain.applyRequest(()->
|
drivetrain.applyRequest(()->
|
||||||
drive.withVelocityX(-0.1*MaxSpeed)
|
drive.withVelocityX(-0.1*MaxSpeed)
|
||||||
.withVelocityY(0)
|
.withVelocityY(0)
|
||||||
.withRotationalRate(0)).unless(()->!Reculer.getBoolean(true)).withTimeout(3.5),
|
.withRotationalRate(0)).unless(()->!ReculerB.getBoolean(true)).withTimeout(3.5),
|
||||||
|
drivetrain.applyRequest(()->
|
||||||
|
drive.withVelocityX(-0.1*MaxSpeed)
|
||||||
|
.withVelocityY(0)
|
||||||
|
.withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(2.35),
|
||||||
drivetrain.applyRequest(()->
|
drivetrain.applyRequest(()->
|
||||||
drive.withVelocityX(0.1*MaxSpeed)
|
drive.withVelocityX(0.1*MaxSpeed)
|
||||||
.withVelocityY(0)
|
.withVelocityY(0)
|
||||||
.withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(3.5),
|
.withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)|| !ReculerR.getBoolean(true)).withTimeout(3),
|
||||||
drivetrain.applyRequest(()->
|
drivetrain.applyRequest(()->
|
||||||
drive.withVelocityX(-0.1*MaxSpeed)
|
drive.withVelocityX(-0.1*MaxSpeed)
|
||||||
.withVelocityY(0)
|
.withVelocityY(0)
|
||||||
.withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)).withTimeout(3),
|
.withRotationalRate(0)).unless(()->!sortirAngle.getBoolean(true)|| !ReculerB.getBoolean(true)).withTimeout(3),
|
||||||
drivetrain.applyRequest(()->
|
drivetrain.applyRequest(()->
|
||||||
drive.withVelocityX(0)
|
drive.withVelocityX(0)
|
||||||
.withVelocityY(0)
|
.withVelocityY(0)
|
||||||
.withRotationalRate(0)).withTimeout(0.1),
|
.withRotationalRate(0)).withTimeout(0.1),
|
||||||
new L4(elevateur, pince).unless(()->!L4.getBoolean(true)).withTimeout(4),
|
new L4(elevateur, pince).unless(()->!L4.getBoolean(true)).withTimeout(4),
|
||||||
drivetrain.applyRequest(()->
|
|
||||||
drive.withVelocityX(0.1*MaxSpeed)
|
|
||||||
.withVelocityY(0)
|
|
||||||
.withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(0.25),
|
|
||||||
drivetrain.applyRequest(()->
|
|
||||||
drive.withVelocityX(0*MaxSpeed)
|
|
||||||
.withVelocityY(0)
|
|
||||||
.withRotationalRate(0)).unless(()->!L4.getBoolean(true)).withTimeout(2),
|
|
||||||
new CoralExpire(pince, bougie).unless(()->!L4.getBoolean(true)).withTimeout(2),
|
|
||||||
new L1Requin(requin, bougie).unless(()-> !L1.getBoolean(true)).withTimeout(2),
|
new L1Requin(requin, bougie).unless(()-> !L1.getBoolean(true)).withTimeout(2),
|
||||||
new ExpireCorail(requin, bougie).unless(()->!L1.getBoolean(true)).withTimeout(2),
|
new ExpireCorail(requin, bougie).unless(()->!L1.getBoolean(true)).withTimeout(2),
|
||||||
new RainBow(bougie));
|
new RainBow(bougie));
|
||||||
|
@ -78,7 +78,7 @@ public class TunerConstants {
|
|||||||
|
|
||||||
// Theoretical free speed (m/s) at 12 V applied output;
|
// Theoretical free speed (m/s) at 12 V applied output;
|
||||||
// This needs to be tuned to your individual robot
|
// This needs to be tuned to your individual robot
|
||||||
public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(5.21);
|
public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(6);
|
||||||
|
|
||||||
// Every 1 rotation of the azimuth results in kCoupleRatio drive motor turns;
|
// Every 1 rotation of the azimuth results in kCoupleRatio drive motor turns;
|
||||||
// This may need to be tuned to your individual robot
|
// This may need to be tuned to your individual robot
|
||||||
|
@ -38,10 +38,10 @@ public class StationPince extends Command {
|
|||||||
if(pince.emperagecoral() >= 18){
|
if(pince.emperagecoral() >= 18){
|
||||||
pince.x = true;
|
pince.x = true;
|
||||||
}
|
}
|
||||||
if(elevateur.position()<=-0.1 && elevateur.position()>= -0.2){
|
if(elevateur.position()<=-0.4 && elevateur.position()>= -0.5){
|
||||||
elevateur.vitesse(0);
|
elevateur.vitesse(0);
|
||||||
}
|
}
|
||||||
else if(elevateur.position()>=-0.1){
|
else if(elevateur.position()>=-0.4){
|
||||||
elevateur.vitesse(-0.7);
|
elevateur.vitesse(-0.7);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -28,12 +28,12 @@ public class ExpireCorail extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
if(requin.amp()> 60){
|
if(requin.amp()> 60){
|
||||||
requin.balaye(-0.2);
|
requin.balaye(-0.1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bougie.Rouge();
|
bougie.Rouge();
|
||||||
requin.balaye(-0.2);
|
requin.balaye(-0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ public class exspire extends Command {
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
if(requin.amp()> 15)
|
if(requin.amp()> 15)
|
||||||
{
|
{
|
||||||
requin.balaye(0.4);
|
requin.balaye(0.2);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
bougie.Rouge();
|
bougie.Rouge();
|
||||||
requin.balaye(0.4);
|
requin.balaye(0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,22 @@ package frc.robot.subsystems;
|
|||||||
|
|
||||||
import com.ctre.phoenix.led.CANdle;
|
import com.ctre.phoenix.led.CANdle;
|
||||||
import com.ctre.phoenix.led.CANdleConfiguration;
|
import com.ctre.phoenix.led.CANdleConfiguration;
|
||||||
|
import com.ctre.phoenix.led.FireAnimation;
|
||||||
|
import com.ctre.phoenix.led.LarsonAnimation;
|
||||||
import com.ctre.phoenix.led.RainbowAnimation;
|
import com.ctre.phoenix.led.RainbowAnimation;
|
||||||
|
import com.ctre.phoenix.led.TwinkleAnimation;
|
||||||
|
import com.ctre.phoenix.led.TwinkleOffAnimation;
|
||||||
|
import com.ctre.phoenix.led.TwinkleOffAnimation.TwinkleOffPercent;
|
||||||
|
import com.ctre.phoenix.led.LarsonAnimation.BounceMode;
|
||||||
|
import com.ctre.phoenix.led.TwinkleAnimation.TwinklePercent;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
public class Bougie extends SubsystemBase {
|
public class Bougie extends SubsystemBase {
|
||||||
CANdle candle = new CANdle(23);
|
CANdle candle = new CANdle(23);
|
||||||
CANdleConfiguration config = new CANdleConfiguration();
|
CANdleConfiguration config = new CANdleConfiguration();
|
||||||
RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 68);
|
LarsonAnimation rainbowAnim = new LarsonAnimation(256,0,0,0,0.1,68,BounceMode.Front,10,8);
|
||||||
|
//TwinkleOffAnimation rainbowAnim = new TwinkleOffAnimation(256, 0, 0,0,0.5,68,TwinkleOffPercent.Percent88,8);
|
||||||
/** Creates a new Bougie. */
|
/** Creates a new Bougie. */
|
||||||
public Bougie() {
|
public Bougie() {
|
||||||
config.brightnessScalar = 0.5;
|
config.brightnessScalar = 0.5;
|
||||||
|
Reference in New Issue
Block a user