diff --git a/bin/main/frc/robot/subsystems/BasePilotable.class b/bin/main/frc/robot/subsystems/BasePilotable.class deleted file mode 100644 index 3d8632d..0000000 Binary files a/bin/main/frc/robot/subsystems/BasePilotable.class and /dev/null differ diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e46be4b..8fc2828 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -1,12 +1,12 @@ package frc.robot; public class Constants { - public static int avantdroit = 0; - public static int avantgauche = 1; - public static int arrieredroit = 2; - public static int arrieregauche = 3; + public static int avantdroit = 1; + public static int avantgauche = 4; + public static int arrieredroit = 3; + public static int arrieregauche = 5; public static int BrasTelescopique = 4; - public static int pivot = 5; + public static int pivot = 0; //moteur public static int leverGratte = 0; diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 0a1dcc2..21a327e 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -7,8 +7,8 @@ import edu.wpi.first.cameraserver.CameraServer; //import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; -import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.RunCommand; +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; //subsystems @@ -33,6 +33,8 @@ import frc.robot.commands.bras.PivotBrasRentre; import frc.robot.commands.bras.PivoteBrasBas; import frc.robot.commands.bras.PivoteBrasHaut; import frc.robot.commands.bras.PivoteBrasMilieux; +//subsystems +import frc.robot.subsystems.BasePilotable; import frc.robot.commands.bras.PivotChercheBas; import frc.robot.commands.bras.PivotChercheHaut; import frc.robot.commands.Cube; @@ -49,7 +51,7 @@ Gratte gratte = new Gratte(); BrasTelescopique brasTelescopique = new BrasTelescopique(); Pince pince = new Pince(); Pivot pivot = new Pivot(); -Limelight limelight = new Limelight(); +Limelight limelight = new Limelight();/** */ //commands BrakeFerme brakeFerme = new BrakeFerme(basePilotable); BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable); @@ -77,33 +79,37 @@ public RobotContainer() { },basePilotable)); } - + private void configureBindings() { + basePilotable.setDefaultCommand(new RunCommand(() -> { + basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX()); + },basePilotable)); // manette 1 + manette1.povDown().onTrue(pivoteBrasHaut); + manette1.povUp().onTrue(pivoteBrasBas); + manette1.povLeft().onTrue(pivoteBrasMilieux); + manette1.povRight().onTrue(pivotBrasRentre); manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); - manette1.y().whileTrue(gyro); - manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable)); manette1.b().onTrue(Commands.either(gratteBaisser, gratteMonte, gratte::getenHaut)); - manette1.leftBumper().toggleOnTrue(aprilTag); - manette1.rightBumper().toggleOnTrue(tape); + manette1.leftBumper().toggleOnTrue(cube); + manette1.rightBumper().toggleOnTrue(cone); // manette 2 - manette2.a().onTrue(pivoteBrasHaut); - manette2.b().onTrue(pivoteBrasBas); - manette2.x().onTrue(pivoteBrasMilieux); - manette2.y().onTrue(pivotBrasRentre); + manette2.y().whileTrue(gyro); + manette2.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable)); manette2.povRight().onTrue(pivotChercheBas); manette2.povLeft().onTrue(pivotChercheHaut); - manette2.rightBumper().toggleOnTrue(cube); - manette2.leftBumper().toggleOnTrue(cone); + manette2.rightBumper().toggleOnTrue(aprilTag); + manette2.leftBumper().toggleOnTrue(tape); } public Command getAutonomousCommand() { - return new SequentialCommandGroup( - new PivoteBrasMilieux(brasTelescopique, pivot), - new OuvrePince(pince), - new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)), - new Gyro(basePilotable) - ); + return null; + //return new SequentialCommandGroup( + //new PivoteBrasMilieux(brasTelescopique, pivot), + //new OuvrePince(pince), + //new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)), + //new Gyro(basePilotable) + //); } } diff --git a/src/main/java/frc/robot/commands/Gyro.java b/src/main/java/frc/robot/commands/Gyro.java index e8742ba..2350667 100644 --- a/src/main/java/frc/robot/commands/Gyro.java +++ b/src/main/java/frc/robot/commands/Gyro.java @@ -30,11 +30,19 @@ public class Gyro extends CommandBase { public void execute() { if(basePilotable.getpitch()>4) { +<<<<<<< HEAD + basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); + } + else if(basePilotable.getpitch()<-4) + { + basePilotable.drive(0.3*basePilotable.getpitch()/12, 0); +======= basePilotable.drive(0.3*basePilotable.getpitch()/15, 0); } else if(basePilotable.getpitch()<-4) { basePilotable.drive(0.3*basePilotable.getpitch()/15, 0); +>>>>>>> 3d2364b54822fb53a6cd71a0347d11baeef62001 } else { diff --git a/src/main/java/frc/robot/subsystems/BasePilotable.java b/src/main/java/frc/robot/subsystems/BasePilotable.java index d8ce05a..9c1b909 100644 --- a/src/main/java/frc/robot/subsystems/BasePilotable.java +++ b/src/main/java/frc/robot/subsystems/BasePilotable.java @@ -70,6 +70,13 @@ public void resetGyro(){ @Override public void periodic() { + //teb .add("encodeuravantdroit",0.1); + //teb .add("encodeurarrieregauche",0.1); + //teb .add("encodeurarrieredroit",0.1); + //teb .add("encodeuravantgauche",0.1); + //teb .add("distance",0.1); + //teb .add("brakedroit",0.1); + //teb .add("brakegauche", 0.1); } } \ No newline at end of file