Merge branch 'main' of https://git.demerso.net/sdesharnais/Rebuilt-2026
This commit is contained in:
@@ -20,6 +20,7 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
|||||||
import frc.robot.commands.Aspirer;
|
import frc.robot.commands.Aspirer;
|
||||||
import frc.robot.commands.DescendreBalyeuse;
|
import frc.robot.commands.DescendreBalyeuse;
|
||||||
import frc.robot.commands.DescendreGrimpeur;
|
import frc.robot.commands.DescendreGrimpeur;
|
||||||
|
import frc.robot.commands.Inverser;
|
||||||
import frc.robot.commands.Lancer;
|
import frc.robot.commands.Lancer;
|
||||||
import frc.robot.commands.LancerAspirer;
|
import frc.robot.commands.LancerAspirer;
|
||||||
import frc.robot.commands.LancerBaseVitesse;
|
import frc.robot.commands.LancerBaseVitesse;
|
||||||
@@ -132,6 +133,7 @@ public class RobotContainer {
|
|||||||
manette1.y().whileTrue(new ModeOposerBalayeuse(balayeuse));
|
manette1.y().whileTrue(new ModeOposerBalayeuse(balayeuse));
|
||||||
manette1.povRight().whileTrue(new BougerDroiteAuto(drivetrain));
|
manette1.povRight().whileTrue(new BougerDroiteAuto(drivetrain));
|
||||||
manette1.povLeft().whileTrue(new BougerGaucheAuto(drivetrain));
|
manette1.povLeft().whileTrue(new BougerGaucheAuto(drivetrain));
|
||||||
|
manette1.start().whileTrue(new Inverser(drivetrain));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
|
|||||||
42
src/main/java/frc/robot/commands/Inverser.java
Normal file
42
src/main/java/frc/robot/commands/Inverser.java
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// 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.CommandSwerveDrivetrain;
|
||||||
|
|
||||||
|
/* 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 Inverser extends Command {
|
||||||
|
CommandSwerveDrivetrain drivetrain;
|
||||||
|
boolean inverse = false;
|
||||||
|
/** Creates a new Inverser. */
|
||||||
|
public Inverser(CommandSwerveDrivetrain drivetrain) {
|
||||||
|
addRequirements(drivetrain);
|
||||||
|
// 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(!inverse){
|
||||||
|
drivetrain.getPigeon2().setYaw(drivetrain.getPigeon2().getYaw().getValueAsDouble()+180);
|
||||||
|
inverse = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user