This commit is contained in:
EdwardFaucher 2023-03-11 09:57:38 -05:00
commit d4fc0d5497
4 changed files with 37 additions and 10 deletions

View File

@ -2,15 +2,24 @@ package frc.robot;
public class Constants { public class Constants {
public static int avantdroit = 1; public static int avantdroit = 1;
public static int avantgauche = 4; public static int avantgauche = 2;
public static int arrieredroit = 3; public static int arrieredroit = 3;
public static int arrieregauche = 5; public static int arrieregauche = 5;
public static int BrasTelescopique = 2; public static int BrasTelescopique = 2;
public static int pivot = 6; public static int pivot = 6;
//moteur //moteur
<<<<<<< HEAD
public static int leverGratte = 7; public static int leverGratte = 7;
public static int baiserGratte = 8; public static int baiserGratte = 8;
=======
public static int leverGratte = 0;
public static int baiserGratte = 1;
<<<<<<< HEAD
public static int baisserGratte = 2;
=======
>>>>>>> 23806ebfa2db43d63673f9b4cfc37aa3b9b23491
>>>>>>> feb8cc033e5eefa2d6b104c4ab7de16e0527fc5f
// pneumatique // pneumatique
public static int pistonpinceouvre = 0; public static int pistonpinceouvre = 0;

View File

@ -3,13 +3,19 @@
// 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; package frc.robot;
import java.util.Map; import org.photonvision.estimation.CameraTargetRelation;
import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.cameraserver.CameraServer;
<<<<<<< HEAD
import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets; import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
=======
>>>>>>> feb8cc033e5eefa2d6b104c4ab7de16e0527fc5f
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import java.util.Map;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
@ -82,6 +88,13 @@ Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY());
Reculer reculers = new Reculer(basePilotable, ()->reculerdistances.getDouble(0)); Reculer reculers = new Reculer(basePilotable, ()->reculerdistances.getDouble(0));
Reculer reculerb = new Reculer(basePilotable, ()->reculerdistanceb.getDouble(0)); 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);
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);
ShuffleboardTab teb = Shuffleboard.getTab("teb");
Reculer reculer = new Reculer(basePilotable);
public RobotContainer() { public RobotContainer() {
chooser.setDefaultOption(enhaut, enhaut); chooser.setDefaultOption(enhaut, enhaut);
@ -92,14 +105,18 @@ public RobotContainer() {
configureBindings(); configureBindings();
CameraServer.startAutomaticCapture();
basePilotable.setDefaultCommand(new RunCommand(() -> { teb.add (CameraServer.startAutomaticCapture(null, 0));
basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX()); basePilotable.setDefaultCommand(new RunCommand() -> {
},basePilotable)); basePilotable.drive(-manette1.getLeftY(), manette1.getLeftX(), 0);
}
} }
private void configureBindings() { private void configureBindings() {
// manette 1
manette1.povDown().onTrue(pivoteBrasHaut);
manette1.povUp().onTrue(pivoteBrasBas);
manette1.povLeft().onTrue(pivoteBrasMilieux);
manette1.povRight().onTrue(pivotBrasRentre);
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);

View File

@ -32,7 +32,8 @@ ShuffleboardLayout bras = Shuffleboard.getTab("teb")
public BrasTelescopique() { public BrasTelescopique() {
teb .add("photocell",0.1); teb .add("photocell",0.1);
teb .add("winch",0.1); teb .add("winch",0.1);
teb .add("encodeur",0.1);} teb .add("encodeur",0.1);
}
final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless); final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless);
private DigitalInput photocell = new DigitalInput(Constants.photocell); private DigitalInput photocell = new DigitalInput(Constants.photocell);
private DoubleSolenoid brakewinch = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakewinchf, Constants.brakewinchb); private DoubleSolenoid brakewinch = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakewinchf, Constants.brakewinchb);