dsgfhfvjbg

This commit is contained in:
EdwardFaucher 2023-03-13 19:02:43 -04:00
parent e5756d0d5f
commit d1ac0f57da
3 changed files with 22 additions and 9 deletions

View File

@ -4,6 +4,7 @@
package frc.robot;
import java.util.Map;
import java.util.function.DoubleSupplier;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.networktables.GenericEntry;
@ -95,8 +96,8 @@ PivotChercheHaut pivotChercheHaut = new PivotChercheHaut(brasTelescopique, pivot
Cube cube = new Cube(limelight, basePilotable, null);
Apriltag aprilTag = new Apriltag(limelight, basePilotable, null);
Tape tape = new Tape(limelight, basePilotable, null);
PivotManuel pivotManuel = new PivotManuel(pivot);
BrasManuel brasManuel = new BrasManuel(brasTelescopique);
PivotManuel pivotManuel = new PivotManuel(pivot,manette2.getLeftX());
BrasManuel brasManuel = new BrasManuel(brasTelescopique,manette2::getLeftY);
public RobotContainer() {
@ -110,6 +111,8 @@ public RobotContainer() {
basePilotable.setDefaultCommand(new RunCommand(() -> {
basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX());
}, basePilotable));
brasTelescopique.setDefaultCommand(brasManuel);
pivot.setDefaultCommand(pivotManuel);
}
private void configureBindings() {
// manette 1
@ -130,8 +133,7 @@ public RobotContainer() {
manette2.start().onTrue(new InstantCommand(basePilotable::resetGyro));
manette2.a().whileTrue(gratteMonte);
manette2.b().whileTrue(gratteBaisser);
manette2.leftStick().whileTrue(brasManuel);
manette2.rightStick().whileTrue(pivotManuel);
}
public Command getAutonomousCommand() {
@ -148,7 +150,7 @@ public RobotContainer() {
Commands.either(reculers, reculerb,()-> autosortir.getBoolean(true)),
avancer.unless(()->!autosortir.getBoolean(true)|| !autobalance.getBoolean(false)),
Commands.either(gyro, Commands.none(),()-> autobalance.getBoolean(true))
).deadlineWith(Commands.waitSeconds(14)).andThen(brakeOuvre);
).deadlineWith(Commands.waitSeconds(14.6)).andThen(brakeOuvre);
}

View File

@ -4,15 +4,22 @@
package frc.robot.commands.bras;
import java.util.function.DoubleSupplier;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.bras.BrasTelescopique;
public class BrasManuel extends CommandBase {
private BrasTelescopique brasTelescopique;
private DoubleSupplier doubleSupplier;
/** Creates a new BrasManuel. */
public BrasManuel(BrasTelescopique brasTelescopique) {
public BrasManuel(BrasTelescopique brasTelescopique,DoubleSupplier doubleSupplier) {
this.brasTelescopique = brasTelescopique;
this.doubleSupplier = doubleSupplier;
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(brasTelescopique);
}
// Called when the command is initially scheduled.
@ -22,7 +29,7 @@ public class BrasManuel extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
brasTelescopique.AvanceRecule(0.3);
brasTelescopique.AvanceRecule(doubleSupplier.getAsDouble());
}
// Called once the command ends or is interrupted.

View File

@ -4,14 +4,18 @@
package frc.robot.commands.bras;
import java.util.function.DoubleSupplier;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.bras.Pivot;
public class PivotManuel extends CommandBase {
private Pivot pivot;
private DoubleSupplier doubleSupplier;
/** Creates a new PivotManuel. */
public PivotManuel(Pivot pivot) {
public PivotManuel(Pivot pivot,double d) {
this.pivot = pivot;
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(pivot);
}
@ -23,7 +27,7 @@ public class PivotManuel extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
pivot.monteDescendre(0.3);
pivot.monteDescendre(doubleSupplier.getAsDouble());
}
// Called once the command ends or is interrupted.