This commit is contained in:
EdwardFaucher 2023-03-18 12:58:08 -04:00
parent ac95c28c45
commit c81d4cfbd1
7 changed files with 41 additions and 15 deletions

View File

@ -1 +1,26 @@
[
{
"name": "/Shuffleboard/teb/auto/reculerdistancesortir",
"type": "double",
"value": -66.0,
"properties": {
"persistent": true
}
},
{
"name": "/Shuffleboard/teb/auto/reculerdistancebalance",
"type": "double",
"value": -31.0,
"properties": {
"persistent": true
}
},
{
"name": "/Shuffleboard/teb/auto/avancer",
"type": "double",
"value": -35.0,
"properties": {
"persistent": true
}
}
]

1
networktables.json.bck Normal file
View File

@ -0,0 +1 @@

View File

@ -93,9 +93,9 @@ Reculer reculerb = new Reculer(basePilotable, ()->reculerdistanceb.getDouble(0))
Avancer avancer = new Avancer(basePilotable, ()->avancerdistance.getDouble(0)); Avancer avancer = new Avancer(basePilotable, ()->avancerdistance.getDouble(0));
PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot); PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot);
PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot); PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot);
Cube cube = new Cube(limelight, basePilotable, null); Cube cube = new Cube(limelight, basePilotable, ()-> manette1.getLeftY());
Apriltag aprilTag = new Apriltag(limelight, basePilotable, null); Apriltag aprilTag = new Apriltag(limelight, basePilotable,()-> manette1.getLeftY());
Tape tape = new Tape(limelight, basePilotable, null); Tape tape = new Tape(limelight, basePilotable, ()-> manette1.getLeftY());
PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX); PivotManuel pivotManuel = new PivotManuel(pivot,manette2::getLeftX);
BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY); BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY);
@ -119,8 +119,8 @@ public RobotContainer() {
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
manette1.x().onTrue(brakeOuvre); manette1.x().onTrue(brakeOuvre);
manette1.b().onTrue(brakeFerme); manette1.b().onTrue(brakeFerme);
manette1.leftBumper().toggleOnTrue(aprilTag); manette1.leftBumper().whileTrue(aprilTag);
manette1.rightBumper().toggleOnTrue(tape); manette1.rightBumper().whileTrue(tape);
manette1.povUp().whileTrue(pivoteBrasHaut); manette1.povUp().whileTrue(pivoteBrasHaut);
manette1.povDown().whileTrue(pivoteBrasBas); manette1.povDown().whileTrue(pivoteBrasBas);
manette1.povRight().whileTrue(pivoteBrasMilieux); manette1.povRight().whileTrue(pivoteBrasMilieux);
@ -128,8 +128,8 @@ public RobotContainer() {
//manette 2 //manette 2
manette2.povDown().onTrue(pivotChercheBas); manette2.povDown().onTrue(pivotChercheBas);
manette2.povUp().onTrue(pivotChercheHaut); manette2.povUp().onTrue(pivotChercheHaut);
manette2.rightBumper().toggleOnTrue(cube); manette2.rightBumper().whileTrue(cube);
manette2.leftBumper().toggleOnTrue(cone); manette2.leftBumper().whileTrue(cone);
manette2.y().whileTrue(gyro); manette2.y().whileTrue(gyro);
manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro)); manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro));
manette2.a().whileTrue(gratteMonte); manette2.a().whileTrue(gratteMonte);
@ -154,9 +154,9 @@ public RobotContainer() {
new PivotBrasRentre(brasTelescopique , pivot).unless(()->chooser.getSelected().equals(nulpart)), new PivotBrasRentre(brasTelescopique , pivot).unless(()->chooser.getSelected().equals(nulpart)),
Commands.waitSeconds(1), Commands.waitSeconds(1),
Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)), Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)),
avancer.unless(()->!autosortir.getBoolean(true)|| !autobalance.getBoolean(false)), avancer.unless(()->!autosortir.getBoolean(true)|| autobalance.getBoolean(false)),
Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true)) Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true))
)).andThen(new InstantCommand(basePilotable::BrakeOuvre)); )).andThen(new InstantCommand(basePilotable::BrakeOuvre,basePilotable));
} }

View File

@ -30,7 +30,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(-0.5,0); basePilotable.drive(-0.4,0);
} }
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.

View File

@ -65,7 +65,7 @@ public class PivoteBrasBas extends CommandBase {
// Returns true when the command should end. // Returns true when the command should end.
@Override @Override
public boolean isFinished() { public boolean isFinished() {
return brasTelescopique.distance()>-13.5 && brasTelescopique.distance() <-15.5 && pivot.distance()<8.5 && pivot.distance()>10.5; return brasTelescopique.distance()>-13.5 && brasTelescopique.distance() <-14.5 && pivot.distance()<8.5 && pivot.distance()>9.5;
} }
} }

View File

@ -41,10 +41,10 @@ public class PivoteBrasMilieux extends CommandBase {
brasTelescopique.ouvrir(); brasTelescopique.ouvrir();
} }
if (pivot.distance()<43.5){ if (pivot.distance()<43.5){
pivot.monteDescendre(0.7); pivot.monteDescendre(0.6);
} }
else if(pivot.distance()>44.5) { else if(pivot.distance()>44.5) {
pivot.monteDescendre(-0.7); pivot.monteDescendre(-0.6);
} }
else{ else{
pivot.monteDescendre(0); pivot.monteDescendre(0);

View File

@ -47,7 +47,7 @@ public class Limelight extends SubsystemBase {
public double getYaw() { public double getYaw() {
var result = limelight.getLatestResult(); var result = limelight.getLatestResult();
if(result.hasTargets()){ if(result.hasTargets()){
return result.getBestTarget().getYaw(); return -result.getBestTarget().getYaw()/60;
} }
return 0; return 0;