j
This commit is contained in:
commit
c40c338976
@ -17,6 +17,7 @@ import frc.robot.subsystems.bras.BrasTelescopique;
|
|||||||
import frc.robot.subsystems.bras.Pince;
|
import frc.robot.subsystems.bras.Pince;
|
||||||
import frc.robot.subsystems.bras.Pivot;
|
import frc.robot.subsystems.bras.Pivot;
|
||||||
import frc.robot.subsystems.Limelight;
|
import frc.robot.subsystems.Limelight;
|
||||||
|
import frc.robot.commands.Apriltag;
|
||||||
// command
|
// command
|
||||||
import frc.robot.commands.BrakeFerme;
|
import frc.robot.commands.BrakeFerme;
|
||||||
import frc.robot.commands.BrakeOuvre;
|
import frc.robot.commands.BrakeOuvre;
|
||||||
@ -31,6 +32,10 @@ import frc.robot.commands.bras.PivotBrasRentre;
|
|||||||
import frc.robot.commands.bras.PivoteBrasBas;
|
import frc.robot.commands.bras.PivoteBrasBas;
|
||||||
import frc.robot.commands.bras.PivoteBrasHaut;
|
import frc.robot.commands.bras.PivoteBrasHaut;
|
||||||
import frc.robot.commands.bras.PivoteBrasMilieux;
|
import frc.robot.commands.bras.PivoteBrasMilieux;
|
||||||
|
import frc.robot.commands.bras.PivotChercheBas;
|
||||||
|
import frc.robot.commands.bras.PivotChercheHaut;
|
||||||
|
import frc.robot.commands.Cube;
|
||||||
|
import frc.robot.commands.Tape;
|
||||||
|
|
||||||
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
@ -57,6 +62,12 @@ PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot);
|
|||||||
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
||||||
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
||||||
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
||||||
|
PivotChercheBas pivotChercheBas = new PivotChercheBas(brasTelescopique, pivot);
|
||||||
|
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);
|
||||||
|
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
configureBindings();
|
configureBindings();
|
||||||
|
|
||||||
@ -67,19 +78,23 @@ public RobotContainer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void configureBindings() {
|
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));
|
||||||
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
||||||
manette1.y().whileTrue(gyro);
|
manette1.y().whileTrue(gyro);
|
||||||
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
||||||
/*manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
manette1.b().onTrue(Commands.either(gratteBaisser, gratteMonte, gratte::getenHaut));
|
||||||
manette2.a().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasHaut, brasTelescopique::pivoteBrasHaut));
|
manette1.leftBumper().toggleOnTrue(aprilTag);
|
||||||
manette2.b().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasBas, brasTelescopique::pivoteBrasBas, brasTelescopique));
|
manette1.rightBumper().toggleOnTrue(tape);
|
||||||
manette2.x().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasMilieux, brasTelescopique::pivoteBrasMilieux, brasTelescopique));
|
// manette 2
|
||||||
manette2.y().toggleOnTrue(Commands.startEnd(brasTelescopique::pivotBrasRentre, brasTelescopique::pivotBrasRentre, brasTelescopique));
|
manette2.a().onTrue(pivoteBrasHaut);
|
||||||
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
manette2.b().onTrue(pivoteBrasBas);
|
||||||
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));
|
manette2.x().onTrue(pivoteBrasMilieux);
|
||||||
manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
manette2.y().onTrue(pivotBrasRentre);
|
||||||
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));**/
|
manette2.povRight().onTrue(pivotChercheBas);
|
||||||
|
manette2.povLeft().onTrue(pivotChercheHaut);
|
||||||
|
manette2.rightBumper().toggleOnTrue(cube);
|
||||||
|
manette2.leftBumper().toggleOnTrue(cone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
|
@ -18,7 +18,9 @@ public class GratteBaisser extends CommandBase {
|
|||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {}
|
public void initialize() {
|
||||||
|
gratte.setenHaut(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Called every time the scheduler runs while the command is scheduled.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
@ -41,9 +43,7 @@ public class GratteBaisser extends CommandBase {
|
|||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
@Override
|
@Override
|
||||||
public void end(boolean interrupted) {
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true when the command should end.
|
// Returns true when the command should end.
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +19,9 @@ public class GratteMonte extends CommandBase {
|
|||||||
|
|
||||||
// Called when the command is initially scheduled.
|
// Called when the command is initially scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {}
|
public void initialize() {
|
||||||
|
gratte.setenHaut(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Called every time the scheduler runs while the command is scheduled.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
// the WPILib BSD license file in the root directory of this project.
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
package frc.robot.subsystems;
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||||
import edu.wpi.first.wpilibj.DigitalInput;
|
import edu.wpi.first.wpilibj.DigitalInput;
|
||||||
@ -24,7 +23,15 @@ ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb")
|
|||||||
private DigitalInput limithg = new DigitalInput(Constants.limithg);
|
private DigitalInput limithg = new DigitalInput(Constants.limithg);
|
||||||
private DigitalInput limitbd = new DigitalInput(Constants.limitbd);
|
private DigitalInput limitbd = new DigitalInput(Constants.limitbd);
|
||||||
private DigitalInput limitbg = new DigitalInput(Constants.limitbg);
|
private DigitalInput limitbg = new DigitalInput(Constants.limitbg);
|
||||||
public boolean baiser;
|
public boolean baiser;
|
||||||
|
boolean enHaut = true;
|
||||||
|
public void setenHaut(boolean enHaut){
|
||||||
|
this.enHaut = enHaut;
|
||||||
|
}
|
||||||
|
public boolean getenHaut(){
|
||||||
|
return enHaut;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hautd(){
|
public boolean hautd(){
|
||||||
return limithd.get();
|
return limithd.get();
|
||||||
@ -34,13 +41,13 @@ public boolean baiser;
|
|||||||
return limithg.get();
|
return limithg.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean basd(int i, String string){
|
public boolean basd(){
|
||||||
return limitbd.get();
|
return limitbd.get();
|
||||||
}
|
}
|
||||||
public boolean basg(){
|
public boolean basg(){
|
||||||
return limitbg.get();
|
return limitbg.get();
|
||||||
}
|
}
|
||||||
/** Creates a new Gratte. */
|
|
||||||
public Gratte() {
|
public Gratte() {
|
||||||
limitswitchgratte.add ("limitbd", 0.1);
|
limitswitchgratte.add ("limitbd", 0.1);
|
||||||
limitswitchgratte.add ("limithg", 0.1);
|
limitswitchgratte.add ("limithg", 0.1);
|
||||||
@ -56,11 +63,10 @@ public boolean baiser;
|
|||||||
Gratteg.set(-vitesse);
|
Gratteg.set(-vitesse);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic(){
|
||||||
|
limitswitchgratte.add ("limitbd", 0.1);
|
||||||
}
|
limitswitchgratte.add ("limithg", 0.1);
|
||||||
|
limitswitchgratte.add ("limithd", 0.1);
|
||||||
public boolean basd() {
|
limitswitchgratte.add ("limitbg", 0.1);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user