mhc n
This commit is contained in:
parent
f8b7d9c61d
commit
de668cfe2e
@ -1,12 +1,12 @@
|
||||
package frc.robot;
|
||||
|
||||
public class Constants {
|
||||
public static int avantdroit = 0;
|
||||
public static int avantgauche = 1;
|
||||
public static int arrieredroit = 2;
|
||||
public static int arrieregauche = 3;
|
||||
public static int avantdroit = 1;
|
||||
public static int avantgauche = 4;
|
||||
public static int arrieredroit = 3;
|
||||
public static int arrieregauche = 5;
|
||||
public static int BrasTelescopique = 4;
|
||||
public static int pivot = 5;
|
||||
public static int pivot = 0;
|
||||
|
||||
//moteur
|
||||
public static int leverGratte = 0;
|
||||
|
@ -6,18 +6,9 @@ package frc.robot;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
|
||||
//subsystems
|
||||
import frc.robot.subsystems.BasePilotable;
|
||||
import frc.robot.subsystems.Gratte;
|
||||
import frc.robot.subsystems.bras.BrasTelescopique;
|
||||
import frc.robot.subsystems.bras.Pince;
|
||||
import frc.robot.subsystems.bras.Pivot;
|
||||
import pabeles.concurrency.ConcurrencyOps.Reset;
|
||||
import frc.robot.subsystems.Limelight;
|
||||
// command
|
||||
import frc.robot.commands.BrakeFerme;
|
||||
import frc.robot.commands.BrakeOuvre;
|
||||
@ -32,71 +23,63 @@ import frc.robot.commands.bras.PivotBrasRentre;
|
||||
import frc.robot.commands.bras.PivoteBrasBas;
|
||||
import frc.robot.commands.bras.PivoteBrasHaut;
|
||||
import frc.robot.commands.bras.PivoteBrasMilieux;
|
||||
import frc.robot.commands.bras.PivotChercheBas;
|
||||
import frc.robot.commands.bras.PivotChercheHaut;
|
||||
import edu.wpi.first.apriltag.AprilTag;
|
||||
import frc.robot.commands.Cube;
|
||||
import frc.robot.commands.Cone;
|
||||
import frc.robot.commands.Tape;
|
||||
//subsystems
|
||||
import frc.robot.subsystems.BasePilotable;
|
||||
|
||||
public class RobotContainer {
|
||||
CommandXboxController manette1 = new CommandXboxController(0);
|
||||
CommandXboxController manette2 = new CommandXboxController(1);
|
||||
// subsystems
|
||||
BasePilotable basePilotable = new BasePilotable();
|
||||
Gratte gratte = new Gratte();
|
||||
/*Gratte gratte = new Gratte();
|
||||
BrasTelescopique brasTelescopique = new BrasTelescopique();
|
||||
Pince pince = new Pince();
|
||||
Pivot pivot = new Pivot();
|
||||
Limelight limelight = new Limelight();
|
||||
Limelight limelight = new Limelight();/** */
|
||||
//commands
|
||||
BrakeFerme brakeFerme = new BrakeFerme(basePilotable);
|
||||
BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
|
||||
GratteBaisser gratteBaisser = new GratteBaisser(gratte);
|
||||
GratteMonte gratteMonte = new GratteMonte(gratte);
|
||||
//BrakeFerme brakeFerme = new BrakeFerme(basePilotable);
|
||||
//BrakeOuvre brakeOuvre = new BrakeOuvre(basePilotable);
|
||||
//GratteBaisser gratteBaisser = new GratteBaisser(gratte);
|
||||
//GratteMonte gratteMonte = new GratteMonte(gratte);
|
||||
Gyro gyro = new Gyro(basePilotable);
|
||||
FermePince fermePince = new FermePince(pince);
|
||||
/*FermePince fermePince = new FermePince(pince);
|
||||
OuvrePince ouvrePince = new OuvrePince(pince);
|
||||
PivotBrasRentre pivotBrasRentre = new PivotBrasRentre(brasTelescopique, pivot);
|
||||
PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot);
|
||||
PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot);
|
||||
PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot);
|
||||
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
|
||||
Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());**/
|
||||
public RobotContainer() {
|
||||
configureBindings();
|
||||
|
||||
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
||||
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX());
|
||||
},basePilotable));
|
||||
|
||||
}
|
||||
|
||||
private void configureBindings() {
|
||||
manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
|
||||
basePilotable.setDefaultCommand(new RunCommand(() -> {
|
||||
basePilotable.drive(-manette1.getLeftY(), -manette1.getLeftX());
|
||||
},basePilotable));
|
||||
//manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince));
|
||||
manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable));
|
||||
manette1.y().whileTrue(gyro);
|
||||
<<<<<<< HEAD
|
||||
// manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
||||
=======
|
||||
>>>>>>> 4b22cac30fd2b3c5e7b1af3c7f890c4def2d21f7
|
||||
manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable));
|
||||
manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
||||
/** manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte));
|
||||
manette2.a().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasHaut, brasTelescopique::pivoteBrasHaut));
|
||||
manette2.b().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasBas, brasTelescopique::pivoteBrasBas, brasTelescopique));
|
||||
manette2.x().toggleOnTrue(Commands.startEnd(brasTelescopique::pivoteBrasMilieux, brasTelescopique::pivoteBrasMilieux, brasTelescopique));
|
||||
manette2.y().toggleOnTrue(Commands.startEnd(brasTelescopique::pivotBrasRentre, brasTelescopique::pivotBrasRentre, brasTelescopique));
|
||||
manette2.povRight().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheBas, brasTelescopique::PivotChercheBas, brasTelescopique));
|
||||
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));
|
||||
manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||
manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||
manette2.povLeft().toggleOnTrue(Commands.startEnd(brasTelescopique::PivotChercheHaut, brasTelescopique::PivotChercheHaut, brasTelescopique));*/
|
||||
// manette2.rightBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||
// manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));
|
||||
}
|
||||
|
||||
public Command getAutonomousCommand() {
|
||||
return new SequentialCommandGroup(
|
||||
new PivoteBrasMilieux(brasTelescopique, pivot),
|
||||
new OuvrePince(pince),
|
||||
new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
||||
new Gyro(basePilotable)
|
||||
);
|
||||
return null;
|
||||
//return new SequentialCommandGroup(
|
||||
//new PivoteBrasMilieux(brasTelescopique, pivot),
|
||||
//new OuvrePince(pince),
|
||||
//new PivotBrasRentre(brasTelescopique, pivot).alongWith(new Reculer(basePilotable)),
|
||||
//new Gyro(basePilotable)
|
||||
//);
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ public class Gyro extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(basePilotable.getpitch()<10)
|
||||
if(basePilotable.getpitch()>4)
|
||||
{
|
||||
basePilotable.drive(0.4, 0);
|
||||
basePilotable.drive(0.3, 0);
|
||||
}
|
||||
else if(basePilotable.getpitch()>-10)
|
||||
else if(basePilotable.getpitch()<-4)
|
||||
{
|
||||
basePilotable.drive(-0.4, 0);
|
||||
basePilotable.drive(-0.3, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -71,12 +71,12 @@ public void resetGyro(){
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
teb .add("encodeuravantdroit",0.1);
|
||||
teb .add("encodeurarrieregauche",0.1);
|
||||
teb .add("encodeurarrieredroit",0.1);
|
||||
teb .add("encodeuravantgauche",0.1);
|
||||
teb .add("distance",0.1);
|
||||
teb .add("brakedroit",0.1);
|
||||
teb .add("brakegauche", 0.1);
|
||||
//teb .add("encodeuravantdroit",0.1);
|
||||
//teb .add("encodeurarrieregauche",0.1);
|
||||
//teb .add("encodeurarrieredroit",0.1);
|
||||
//teb .add("encodeuravantgauche",0.1);
|
||||
//teb .add("distance",0.1);
|
||||
//teb .add("brakedroit",0.1);
|
||||
//teb .add("brakegauche", 0.1);
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@ import edu.wpi.first.wpilibj.DoubleSolenoid;
|
||||
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import frc.robot.Constants;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user