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