Named Commands
This commit is contained in:
		| @@ -4,7 +4,12 @@ | ||||
|  | ||||
| package frc.robot; | ||||
|  | ||||
| import com.pathplanner.lib.auto.AutoBuilder; | ||||
| import com.pathplanner.lib.auto.NamedCommands; | ||||
| import com.pathplanner.lib.auto.AutoBuilder; | ||||
| import com.pathplanner.lib.auto.NamedCommands; | ||||
| import edu.wpi.first.math.MathUtil; | ||||
| import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; | ||||
| import edu.wpi.first.wpilibj2.command.Command; | ||||
| import edu.wpi.first.wpilibj2.command.Commands; | ||||
| import edu.wpi.first.wpilibj2.command.RunCommand; | ||||
| @@ -24,8 +29,10 @@ import frc.robot.subsystems.Elevateur; | ||||
| import frc.robot.subsystems.Pince; | ||||
|  | ||||
| public class RobotContainer { | ||||
|    | ||||
|   CommandXboxController manette1 = new CommandXboxController(0); | ||||
|   CommandXboxController manette2 = new CommandXboxController(0); | ||||
|   private final SendableChooser<Command> autoChooser; | ||||
|   Pince pince = new Pince(); | ||||
|   Elevateur elevateur = new Elevateur(); | ||||
|   ElevateurManuel elevateurManuel = new ElevateurManuel(elevateur, manette2::getLeftY); | ||||
| @@ -34,6 +41,13 @@ public class RobotContainer { | ||||
|     elevateur.setDefaultCommand(new RunCommand(()->{ | ||||
|       elevateur.vitesse(MathUtil.applyDeadband(manette2.getLeftY(), 0.2)); | ||||
|     }, elevateur)); | ||||
|     NamedCommands.registerCommand("Station",new StationPince(pince, elevateur)); | ||||
|     NamedCommands.registerCommand("L4", new L4(elevateur, pince)); | ||||
|     NamedCommands.registerCommand("L3", new L3(elevateur, pince)); | ||||
|     NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince)); | ||||
|     NamedCommands.registerCommand("CoralInspire", new CoralInspire(pince)); | ||||
|     NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince)); | ||||
|     autoChooser = AutoBuilder.buildAutoChooser(); | ||||
|   } | ||||
|  | ||||
|   private void configureBindings() { | ||||
|   | ||||
| @@ -24,7 +24,7 @@ public class CoralExpire extends Command { | ||||
|   // Called every time the scheduler runs while the command is scheduled. | ||||
|   @Override | ||||
|   public void execute() { | ||||
|     pince.aspirecoral(.5); | ||||
|     pince.aspirecoral(-.5); | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   | ||||
| @@ -10,6 +10,7 @@ import frc.robot.subsystems.Pince; | ||||
|  | ||||
| /* 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 StationPince extends Command { | ||||
|    | ||||
|   private Pince pince; | ||||
|   private Elevateur elevateur; | ||||
|   /** Creates a new L2Pince. */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user