This commit is contained in:
Olivier Dubois 2022-11-23 18:50:12 -05:00
commit ad2779c462
6 changed files with 208 additions and 2 deletions

View File

@ -4,9 +4,11 @@
package frc.robot; package frc.robot;
import edu.wpi.first.math.estimator.KalmanFilter;
import edu.wpi.first.wpilibj.GenericHID; import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.XboxController.Button;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import frc.robot.commands.ActiverBlockeur; import frc.robot.commands.ActiverBlockeur;
@ -16,6 +18,9 @@ import frc.robot.commands.DesactiverBlockeur;
import frc.robot.subsystems.BasePilotable; import frc.robot.subsystems.BasePilotable;
import frc.robot.subsystems.Pistonshaker; import frc.robot.subsystems.Pistonshaker;
import frc.robot.subsystems.Poussoir; import frc.robot.subsystems.Poussoir;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
/** /**
* This class is where the bulk of the robot should be declared. Since Command-based is a * This class is where the bulk of the robot should be declared. Since Command-based is a
@ -53,7 +58,15 @@ public class RobotContainer {
* edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a {@link * edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then passing it to a {@link
* edu.wpi.first.wpilibj2.command.button.JoystickButton}. * edu.wpi.first.wpilibj2.command.button.JoystickButton}.
*/ */
private void configureButtonBindings() {} private void configureButtonBindings() {
JoystickButton buttonA = new JoystickButton(manette, XboxController.Button.kA.value);
buttonA.whileHeld(Poussoir);
JoystickButton rightbumper = new JoystickButton(manette, XboxController.Button.kLeftBumper.value);
rightbumper.whileHeld(Pistonshaker);
JoystickButton buttonY = new JoystickButton(manette, XboxController.Button.kY.value);
buttonY.whenPressed(DesactiverBlockeur, ActiverBlockeur);
}
/** /**
* Use this to pass the autonomous command to the main {@link Robot} class. * Use this to pass the autonomous command to the main {@link Robot} class.

View File

@ -0,0 +1,40 @@
// 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.CommandBase;
import frc.robot.subsystems.BasePilotable;
public class Avancer extends CommandBase {
private BasePilotable basePilotable;
/** Creates a new Avancer. */
public Avancer(BasePilotable basePilotable) {
basePilotable = new BasePilotable();
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(basePilotable);
}
// 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() {
basePilotable.drive(0.5, 0.5, 0);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
basePilotable.drive(0, 0, 0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -0,0 +1,32 @@
// 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.CommandBase;
public class BoutonA extends CommandBase {
/** Creates a new boutonY. */
public BoutonA() {
// 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() {}
// 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;
}
}

View File

@ -0,0 +1,41 @@
// 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.CommandBase;
import frc.robot.subsystems.BasePilotable;
public class Reculer extends CommandBase {
private BasePilotable basePilotable;
/** Creates a new Reculer. */
public Reculer(BasePilotable basePilotable) {
basePilotable = new BasePilotable();
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(basePilotable);
}
// 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() {
basePilotable.drive(-0.5, -0.5, 0);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
basePilotable.drive(0, 0, 0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -0,0 +1,41 @@
// 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.CommandBase;
import frc.robot.subsystems.BasePilotable;
public class TournerDroite extends CommandBase {
private BasePilotable basePilotable;
/** Creates a new Tourner. */
public TournerDroite(BasePilotable basePilotable) {
basePilotable = new BasePilotable();
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(basePilotable);
}
// 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() {
basePilotable.drive(0, 0, 0.5);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
basePilotable.drive(0, 0, 0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -0,0 +1,39 @@
// 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.CommandBase;
import frc.robot.subsystems.BasePilotable;
public class TournerGauche extends CommandBase {
private BasePilotable basePilotable;
/** Creates a new TournerGauche. */
public TournerGauche(BasePilotable basePilotable) {
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(basePilotable);
}
// 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() {
basePilotable.drive(0, 0, -0.5);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
basePilotable.drive(0, 0, 0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}