This commit is contained in:
Olivier Dubois 2023-03-08 19:14:16 -05:00
parent 99ce225dc6
commit fc4607f3c6
7 changed files with 14 additions and 15 deletions

View File

@ -7,7 +7,6 @@ import edu.wpi.first.cameraserver.CameraServer;
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;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
//subsystems //subsystems
@ -25,7 +24,6 @@ import frc.robot.commands.Cone;
import frc.robot.commands.GratteBaisser; import frc.robot.commands.GratteBaisser;
import frc.robot.commands.GratteMonte; import frc.robot.commands.GratteMonte;
import frc.robot.commands.Gyro; import frc.robot.commands.Gyro;
import frc.robot.commands.Reculer;
import frc.robot.commands.bras.FermePince; import frc.robot.commands.bras.FermePince;
import frc.robot.commands.bras.OuvrePince; import frc.robot.commands.bras.OuvrePince;
import frc.robot.commands.bras.PivotBrasRentre; import frc.robot.commands.bras.PivotBrasRentre;
@ -33,7 +31,6 @@ import frc.robot.commands.bras.PivoteBrasBas;
import frc.robot.commands.bras.PivoteBrasHaut; import frc.robot.commands.bras.PivoteBrasHaut;
import frc.robot.commands.bras.PivoteBrasMilieux; import frc.robot.commands.bras.PivoteBrasMilieux;
//subsystems //subsystems
import frc.robot.subsystems.BasePilotable;
import frc.robot.commands.bras.PivotChercheBas; import frc.robot.commands.bras.PivotChercheBas;
import frc.robot.commands.bras.PivotChercheHaut; import frc.robot.commands.bras.PivotChercheHaut;
import frc.robot.commands.Cube; import frc.robot.commands.Cube;
@ -74,13 +71,15 @@ public RobotContainer() {
configureBindings(); configureBindings();
CameraServer.startAutomaticCapture(); CameraServer.startAutomaticCapture();
basePilotable.setDefaultCommand(new RunCommand(() -> { basePilotable.setDefaultCommand(new RunCommand(() -> {
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX()); basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX(), 0);
},basePilotable)); },basePilotable));
} }
private void configureBindings() { private void configureBindings() {
basePilotable.setDefaultCommand(new RunCommand(() -> {
basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX(), 0);
},basePilotable));
// manette 1 // manette 1
manette1.povDown().onTrue(pivoteBrasHaut); manette1.povDown().onTrue(pivoteBrasHaut);
manette1.povUp().onTrue(pivoteBrasBas); manette1.povUp().onTrue(pivoteBrasBas);

View File

@ -32,7 +32,7 @@ public class Apriltag extends CommandBase {
// 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() {
basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(), 0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -32,7 +32,7 @@ public class Cone extends CommandBase {
// 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() {
basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(), 0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -32,7 +32,7 @@ public class Cube extends CommandBase {
// 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() {
basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(), 0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -30,20 +30,20 @@ public class Gyro extends CommandBase {
public void execute() { public void execute() {
if(basePilotable.getpitch()>4) if(basePilotable.getpitch()>4)
{ {
basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); basePilotable.drive(0.3*basePilotable.getpitch()/12, 0, 0);
} }
else if(basePilotable.getpitch()<-4) else if(basePilotable.getpitch()<-4)
{ {
basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); basePilotable.drive(0.3*basePilotable.getpitch()/12, 0, 0);
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0); basePilotable.drive(0.3*basePilotable.getpitch()/15, 0, 0);
} }
else if(basePilotable.getpitch()<-4) else if(basePilotable.getpitch()<-4)
{ {
basePilotable.drive(0.3*basePilotable.getpitch()/15, 0); basePilotable.drive(0.3*basePilotable.getpitch()/15, 0, 0);
} }
else else
{ {
basePilotable.drive(0, 0); basePilotable.drive(0, 0, 0);
} }
} }

View File

@ -27,7 +27,7 @@ public class Reculer extends CommandBase {
// 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() {
basePilotable.drive(SmartDashboard.getNumber("vitesse auto", -0.3), 0); basePilotable.drive(SmartDashboard.getNumber("vitesse auto", -0.3), 0, 0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -32,7 +32,7 @@ public class Tape extends CommandBase {
// 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() {
basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw()); basePilotable.drive(doubleSupplier.getAsDouble(), limelight.getYaw(), 0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.