diff --git a/bin/main/frc/robot/subsystems/BasePilotable.class b/bin/main/frc/robot/subsystems/BasePilotable.class new file mode 100644 index 0000000..9d83fb8 Binary files /dev/null and b/bin/main/frc/robot/subsystems/BasePilotable.class differ diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 0000000..73cc713 --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,92 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 0000000..1d8ea9a --- /dev/null +++ b/simgui.json @@ -0,0 +1,17 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo" + } + }, + "NetworkTables": { + "transitory": { + "Shuffleboard": { + ".metadata": { + "open": true + }, + "open": true + } + } + } +} diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 1518cc8..6d6e398 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -10,12 +10,16 @@ public class Constants { //moteur public static int leverGratte = 0; +<<<<<<< HEAD + public static int baiserGratte = 1; +======= public static int baisserGratte = 1; +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0 // pneumatique public static int pistonpinceouvre = 0; public static int pistonpinceferme = 1; - public static int actuateur = 2; + public static int actuateur = 8; public static int brakedroit = 3; public static int brakegauche = 4; public static int brakewinchf = 5; diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 37187a6..c239352 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -16,7 +16,6 @@ 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; @@ -33,6 +32,7 @@ import frc.robot.commands.bras.PivoteBrasBas; import frc.robot.commands.bras.PivoteBrasHaut; import frc.robot.commands.bras.PivoteBrasMilieux; + public class RobotContainer { CameraServer.startAutomaticCapture(); CommandXboxController manette1 = new CommandXboxController(0); @@ -70,8 +70,21 @@ public RobotContainer() { manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); manette1.y().whileTrue(gyro); - manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte)); manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable)); + /*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)); +<<<<<<< HEAD + manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null));**/ +======= + manette2.leftBumper().toggleOnTrue(Commands.startEnd(null, null, null)); + +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0 } public Command getAutonomousCommand() { diff --git a/src/main/java/frc/robot/commands/GratteBaisser.java b/src/main/java/frc/robot/commands/GratteBaisser.java index de68b8f..8984475 100644 --- a/src/main/java/frc/robot/commands/GratteBaisser.java +++ b/src/main/java/frc/robot/commands/GratteBaisser.java @@ -41,7 +41,9 @@ public class GratteBaisser extends CommandBase { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + + } // Returns true when the command should end. @Override diff --git a/src/main/java/frc/robot/subsystems/BasePilotable.java b/src/main/java/frc/robot/subsystems/BasePilotable.java index 6ed4487..4cbec8e 100644 --- a/src/main/java/frc/robot/subsystems/BasePilotable.java +++ b/src/main/java/frc/robot/subsystems/BasePilotable.java @@ -13,17 +13,19 @@ import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; public class BasePilotable extends SubsystemBase { - final CANSparkMax avantdroit = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless); + final CANSparkMax avantd = new CANSparkMax(Constants.avantdroit, MotorType.kBrushless); final CANSparkMax avantgauche = new CANSparkMax(Constants.avantgauche, MotorType.kBrushless); final CANSparkMax arrieredroit = new CANSparkMax(Constants.arrieredroit, MotorType.kBrushless); final CANSparkMax arrieregauche = new CANSparkMax(Constants.arrieregauche, MotorType.kBrushless); - final MotorControllerGroup droit = new MotorControllerGroup(avantdroit, arrieredroit); + final MotorControllerGroup droit = new MotorControllerGroup(avantd, arrieredroit); final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche); final DifferentialDrive drive = new DifferentialDrive(gauche, droit); @@ -32,6 +34,9 @@ public class BasePilotable extends SubsystemBase { private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche); //gyro ShuffleboardTab teb = Shuffleboard.getTab("teb"); + ShuffleboardLayout layout = Shuffleboard.getTab("teb") + .getLayout ("distance", BuiltInLayouts.kList) + .withSize(2, 2); private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();} public double getpitch() { return gyroscope.getPitch(); @@ -41,13 +46,13 @@ public class BasePilotable extends SubsystemBase { drive.arcadeDrive(xSpeed, zRotation); } public double distance(){ - return (-avantdroit.getEncoder().getPosition() + return (-avantd.getEncoder().getPosition() +avantgauche.getEncoder().getPosition() -arrieredroit.getEncoder().getPosition() +arrieregauche.getEncoder().getPosition()) / 4; } public void Reset() { - avantdroit.getEncoder().setPosition(0); + avantd.getEncoder().setPosition(0); avantgauche.getEncoder().setPosition(0); arrieredroit.getEncoder().setPosition(0); arrieregauche.getEncoder().setPosition(0); @@ -61,20 +66,16 @@ public void BrakeFerme(){ brakegauche.set(Value.kReverse); } public void resetGyro(){ - try {gyroscope.reset();} catch(Exception e){DriverStation.reportError("bye bye",true); + {gyroscope.reset();} } - } /** Creates a new BasePilotable. */ public BasePilotable() { droit.setInverted(true); + layout .addDouble("distance", this::distance); } @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); + } -} +} \ No newline at end of file diff --git a/src/main/java/frc/robot/subsystems/Gratte.java b/src/main/java/frc/robot/subsystems/Gratte.java index 4cefbae..7176d4f 100644 --- a/src/main/java/frc/robot/subsystems/Gratte.java +++ b/src/main/java/frc/robot/subsystems/Gratte.java @@ -8,15 +8,27 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import frc.robot.Constants; public class Gratte extends SubsystemBase { +<<<<<<< HEAD +ShuffleboardTab teb = Shuffleboard.getTab("teb"); +======= + ShuffleboardTab teb = Shuffleboard.getTab("teb"); +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0 +ShuffleboardLayout limitswitchgratte = Shuffleboard.getTab("teb") +.getLayout("limitswitchsgratte", BuiltInLayouts.kList) +.withSize(2, 2); private WPI_TalonSRX Gratted = new WPI_TalonSRX(Constants.leverGratte); - private WPI_TalonSRX Gratteg = new WPI_TalonSRX(Constants.baisserGratte); + private WPI_TalonSRX Gratteg = new WPI_TalonSRX(Constants.baiserGratte); private DigitalInput limithd = new DigitalInput(Constants.limithd); private DigitalInput limithg = new DigitalInput(Constants.limithg); private DigitalInput limitbd = new DigitalInput(Constants.limitbd); private DigitalInput limitbg = new DigitalInput(Constants.limitbg); +public boolean baiser; public boolean hautd(){ return limithd.get(); @@ -26,7 +38,7 @@ public class Gratte extends SubsystemBase { return limithg.get(); } - public boolean basd(){ + public boolean basd(int i, String string){ return limitbd.get(); } public boolean basg(){ @@ -44,9 +56,17 @@ public class Gratte extends SubsystemBase { } @Override public void periodic() { - Shuffleboard.getTab("SmartDashBoard") .add("limithd",0.1); - Shuffleboard.getTab("SmartDashBoard") .add("limitbd",0.1); - Shuffleboard.getTab("SmartDashBoard") .add("limithg",0.1); - Shuffleboard.getTab("SmartDashBoard") .add("limitbg",0.1); + teb .add("limithd", 0.1); + teb .add("limithg", 0.1); + teb .add("limitbd", 0.1); + teb .add("limitbg", 0.1); + limitswitchgratte.add ("limitbd", 0.1); + limitswitchgratte.add ("limithg", 0.1); + limitswitchgratte.add ("limithd", 0.1); + limitswitchgratte.add ("limitbg", 0.1); } + +public boolean basd() { + return false; +} } diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index 1d41677..58d30f8 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -6,6 +6,8 @@ package frc.robot.subsystems; import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; + import org.photonvision.PhotonCamera; import org.photonvision.common.hardware.VisionLEDMode; @@ -15,6 +17,7 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Limelight extends SubsystemBase { + ShuffleboardTab teb = Shuffleboard.getTab("teb"); PhotonCamera limelight = new PhotonCamera("limelight"); /** Creates a new Limelight. */ public Limelight() { @@ -56,6 +59,6 @@ public class Limelight extends SubsystemBase { @Override public void periodic() { CameraServer.startAutomaticCapture(); - Shuffleboard.getTab("SmartDashBoard") .add("limelight",0.1); + teb .add("limelight", 0.1); } } diff --git a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java index 98bc79c..cb92af3 100644 --- a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java +++ b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java @@ -12,11 +12,28 @@ import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; public class BrasTelescopique extends SubsystemBase { + ShuffleboardTab teb = Shuffleboard.getTab("teb"); + ShuffleboardLayout layout = Shuffleboard.getTab("teb") + .getLayout("layout", BuiltInLayouts.kList) + .withSize(2, 2); +<<<<<<< HEAD + ShuffleboardLayout bras = Shuffleboard.getTab("teb") + .getLayout("bras", BuiltInLayouts.kList) + .withSize(2, 2); +======= + +ShuffleboardLayout bras = Shuffleboard.getTab("teb") +.getLayout("bras", BuiltInLayouts.kList) +.withSize(2, 2); +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0 /** Creates a new BrasTelescopique. */ public BrasTelescopique() {} final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless); @@ -42,7 +59,8 @@ public class BrasTelescopique extends SubsystemBase { } @Override public void periodic() { - Shuffleboard.getTab("SmartDashBoard") .add("photocell",0.1); - Shuffleboard.getTab("SmartDashBoard") .add("winch",0.1); + teb .add("photocell",0.1); + teb .add("winch",0.1); + bras.add ("encodeur",0.1); } -} +} \ No newline at end of file diff --git a/src/main/java/frc/robot/subsystems/bras/Pince.java b/src/main/java/frc/robot/subsystems/bras/Pince.java index 2aa6540..a8a7c81 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pince.java +++ b/src/main/java/frc/robot/subsystems/bras/Pince.java @@ -8,9 +8,11 @@ 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 frc.robot.Constants; -public class Pince extends SubsystemBase { + +public class Pince extends SubsystemBase{ private DoubleSolenoid pistonPince = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.pistonpinceouvre, Constants.pistonpinceferme); /** Creates a new Pince. */ public Pince() { @@ -23,6 +25,5 @@ public class Pince extends SubsystemBase { } @Override public void periodic() { - } } diff --git a/src/main/java/frc/robot/subsystems/bras/Pivot.java b/src/main/java/frc/robot/subsystems/bras/Pivot.java index 58f24d2..e82eecc 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pivot.java +++ b/src/main/java/frc/robot/subsystems/bras/Pivot.java @@ -6,6 +6,7 @@ package frc.robot.subsystems.bras; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; @@ -13,6 +14,11 @@ import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMaxLowLevel.MotorType; public class Pivot extends SubsystemBase { +<<<<<<< HEAD +ShuffleboardTab teb = Shuffleboard.getTab("teb"); +======= + ShuffleboardTab teb = Shuffleboard.getTab("teb"); +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0 // moteur private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless); private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot); @@ -21,7 +27,7 @@ public class Pivot extends SubsystemBase { public void monteDescendre(double vitesse) { pivot.set (vitesse); } - // encoder + // encodeur public double distance(){ return (pivot.getEncoder().getPosition()); } @@ -34,8 +40,17 @@ public class Pivot extends SubsystemBase { } @Override public void periodic() { - Shuffleboard.getTab("SmartDashBoard") .add("limitpivot",0.1); - Shuffleboard.getTab("SmartDashBoard") .add("pivot encodeur",0.1); + teb .add("encodeur", 0.1); + teb .add ("encodeur pivot",0.1); } - } +<<<<<<< HEAD +} + + +======= + { + teb.add ("encodeur pivot",0.1); + } +} +>>>>>>> cd7604e30f9d6c974930cf5af86554639315c8a0