idifjkeakjfo h

This commit is contained in:
samuel desharnais 2023-05-03 19:30:01 -04:00
parent 59a7c30154
commit a73b9c7374
3 changed files with 21 additions and 18 deletions

View File

@ -6,7 +6,6 @@ package frc.robot;
import java.util.Map;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
@ -50,6 +49,7 @@ import frc.robot.commands.bras.MonterPivotBras;
import frc.robot.commands.bras.OuvrePince;
import frc.robot.commands.bras.PivotManuel;
import frc.robot.commands.ActiverLimeLight;
public class RobotContainer {
CommandXboxController manette1 = new CommandXboxController(0);
@ -85,13 +85,13 @@ public class RobotContainer {
BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
GratteBaisser gratteBaisser = new GratteBaisser(gratte);
GratteMonte gratteMonte = new GratteMonte(gratte);
Gyro gyro = new Gyro(basePilotable,()->gyroforce.getDouble(0));
Gyro gyro = new Gyro(basePilotable, () -> gyroforce.getDouble(0));
FermePince fermePince = new FermePince(pince);
OuvrePince ouvrePince = new OuvrePince(pince);
Cone cone = new Cone(limelight, basePilotable, () -> -manette1.getLeftY());
Reculer reculers = new Reculer(basePilotable, () -> reculerdistances.getDouble(0),()->reculerforce.getDouble(0));
Reculer reculerb = new Reculer(basePilotable, () -> reculerdistanceb.getDouble(0),()->reculerforce.getDouble(0));
Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0),()-> avancerforce.getDouble(0));
Reculer reculers = new Reculer(basePilotable, () -> reculerdistances.getDouble(0), () -> reculerforce.getDouble(0));
Reculer reculerb = new Reculer(basePilotable, () -> reculerdistanceb.getDouble(0), () -> reculerforce.getDouble(0));
Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0), () -> avancerforce.getDouble(0));
Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY());
Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY());
Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY());
@ -116,7 +116,7 @@ public class RobotContainer {
private void configureBindings() {
// manette 1
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer, pince));
manette2.a().onTrue(brakeOuvre);
manette2.b().onTrue(brakeFerme);
manette1.leftBumper().whileTrue(aprilTag);
@ -126,7 +126,7 @@ public class RobotContainer {
manette1.povRight().whileTrue(creerCommandBras(44, -17));
manette1.povLeft().whileTrue(creerCommandBras(0, 0));
manette1.y().whileTrue(activerLimeLight);
//manette 2
// manette 2
manette2.povDown().whileTrue(creerCommandBras(9, -18));
manette2.povUp().whileTrue(creerCommandBras(44, 0));
manette2.rightBumper().whileTrue(cube);
@ -156,14 +156,17 @@ public class RobotContainer {
Map.entry(aumilieux, creerCommandBras(45, -13)),
Map.entry(enbas, creerCommandBras(12, -9)),
Map.entry(nulpart, creerCommandBras(0, 0))), chooser::getSelected),
//creerCommandBras(50, -40).unless(() -> !chooser.getSelected().equals(enhaut)),
//creerCommandBras(51, -40).unless(() -> !chooser.getSelected().equals(enhaut)),
// creerCommandBras(50, -40).unless(() ->
// !chooser.getSelected().equals(enhaut)),
// creerCommandBras(51, -40).unless(() ->
// !chooser.getSelected().equals(enhaut)),
new OuvrePince(pince).unless(() -> chooser.getSelected().equals(nulpart)),
Commands.waitSeconds(1),
new FermePince(pince).unless(() -> chooser.getSelected().equals(nulpart)),
new ParallelCommandGroup (creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)),
Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true))),
new Avancer(basePilotable, () -> avancerdistance.getDouble(0),()->avancerforce.getDouble(0)).unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)),
new FermePince(pince).unless(() -> chooser.getSelected().equals(nulpart)),
new ParallelCommandGroup(creerCommandBras(0, 0).unless(() -> chooser.getSelected().equals(nulpart)),
Commands.either(reculers, reculerb, () -> autosortir.getBoolean(true))),
new Avancer(basePilotable, () -> avancerdistance.getDouble(0), () -> avancerforce.getDouble(0))
.unless(() -> !autosortir.getBoolean(true) || !autobalance.getBoolean(false)),
Commands.either(gyro, Commands.none(), () -> autobalance.getBoolean(true))))
.andThen(brakeOuvre);

View File

@ -30,11 +30,11 @@ public class Bougerbras extends CommandBase {
@Override
public void execute() {
if(brasTelescopique.distance()>distance+0.5 ) {
brasTelescopique.AvanceRecule(0.35);
brasTelescopique.AvanceRecule(-0.35);
}
else if(brasTelescopique.distance()<distance-0.5) {
brasTelescopique.AvanceRecule(-0.35);
brasTelescopique.AvanceRecule(0.35);
}
else {
brasTelescopique.AvanceRecule(0);

View File

@ -27,10 +27,10 @@ public class Bougerpivot extends CommandBase {
@Override
public void execute() {
if(pivot.distance()>distance+0.5 ) {
pivot.monteDescendre(0.5);
pivot.monteDescendre(-0.5);
}
else if(pivot.distance()<distance-0.5) {
pivot.monteDescendre(-0.5);
pivot.monteDescendre(0.5);
}
else {
pivot.monteDescendre(0);