drxgfh
This commit is contained in:
parent
3b22a181cc
commit
77a03a5b34
@ -87,7 +87,7 @@ public class RobotContainer {
|
|||||||
Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0));
|
Avancer avancer = new Avancer(basePilotable, () -> avancerdistance.getDouble(0));
|
||||||
Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY());
|
Cube cube = new Cube(limelight, basePilotable, () -> manette1.getLeftY());
|
||||||
Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY());
|
Apriltag aprilTag = new Apriltag(limelight, basePilotable, () -> manette1.getLeftY());
|
||||||
Tape tape = new Tape(limelight, basePilotable, () -> manette1.getLeftY());
|
Tape tape = new Tape(limelight, basePilotable, () -> -manette1.getLeftY());
|
||||||
PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY);
|
PivotManuel pivotManuel = new PivotManuel(pivot, manette1::getRightY);
|
||||||
BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX);
|
BrasManuel brasManuel = new BrasManuel(brasTelescopique, manette1::getRightX);
|
||||||
ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight);
|
ActiverLimeLight activerLimeLight = new ActiverLimeLight(limelight);
|
||||||
@ -110,8 +110,8 @@ public class RobotContainer {
|
|||||||
private void configureBindings() {
|
private void configureBindings() {
|
||||||
// manette 1
|
// manette 1
|
||||||
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.b().whileTrue(gratteMonte);
|
||||||
manette1.b().onTrue(brakeFerme);
|
manette1.x().whileTrue(gratteBaisser);
|
||||||
manette1.leftBumper().whileTrue(aprilTag);
|
manette1.leftBumper().whileTrue(aprilTag);
|
||||||
manette1.rightBumper().whileTrue(tape);
|
manette1.rightBumper().whileTrue(tape);
|
||||||
manette1.povUp().whileTrue(creerCommandBras(51, -37));
|
manette1.povUp().whileTrue(creerCommandBras(51, -37));
|
||||||
@ -122,12 +122,10 @@ public class RobotContainer {
|
|||||||
//manette 2
|
//manette 2
|
||||||
manette2.povDown().whileTrue(creerCommandBras(5, -12));
|
manette2.povDown().whileTrue(creerCommandBras(5, -12));
|
||||||
manette2.povUp().whileTrue(creerCommandBras(44, 0));
|
manette2.povUp().whileTrue(creerCommandBras(44, 0));
|
||||||
manette2.rightBumper().whileTrue(cube);
|
|
||||||
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().onTrue(brakeOuvre);
|
||||||
manette2.b().whileTrue(gratteBaisser);
|
manette2.b().onTrue(brakeFerme);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Command creerCommandBras(double distancePivot, double distanceBras) {
|
private Command creerCommandBras(double distancePivot, double distanceBras) {
|
||||||
|
@ -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(),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
@ -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(),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
@ -17,6 +17,7 @@ import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
|||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
import frc.robot.Constants;
|
import frc.robot.Constants;
|
||||||
|
import frc.robot.commands.bras.Bougerbras;
|
||||||
|
|
||||||
public class BasePilotable extends SubsystemBase {
|
public class BasePilotable extends SubsystemBase {
|
||||||
final CANSparkMax avantdroit = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless);
|
final CANSparkMax avantdroit = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless);
|
||||||
@ -42,6 +43,9 @@ public class BasePilotable extends SubsystemBase {
|
|||||||
public void drive(double xSpeed, double zRotation){
|
public void drive(double xSpeed, double zRotation){
|
||||||
drive.arcadeDrive(xSpeed, zRotation);
|
drive.arcadeDrive(xSpeed, zRotation);
|
||||||
}
|
}
|
||||||
|
public void drive(double xSpeed, double zRotation, boolean square){
|
||||||
|
drive.arcadeDrive(xSpeed, zRotation, square);
|
||||||
|
}
|
||||||
public double distance(){
|
public double distance(){
|
||||||
return (-avantdroit.getEncoder().getPosition()
|
return (-avantdroit.getEncoder().getPosition()
|
||||||
+avantgauche.getEncoder().getPosition()
|
+avantgauche.getEncoder().getPosition()
|
||||||
|
@ -41,12 +41,13 @@ public class Limelight extends SubsystemBase {
|
|||||||
public void tape() {
|
public void tape() {
|
||||||
limelight.setLED(VisionLEDMode.kOn);
|
limelight.setLED(VisionLEDMode.kOn);
|
||||||
limelight.setPipelineIndex(1);
|
limelight.setPipelineIndex(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getYaw() {
|
public double getYaw() {
|
||||||
var result = limelight.getLatestResult();
|
var result = limelight.getLatestResult();
|
||||||
if(result.hasTargets()){
|
if(result.hasTargets()){
|
||||||
return -result.getBestTarget().getYaw()/30;
|
return -result.getBestTarget().getYaw()/45;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user