From f810501f420a8e41424ab758dad2556851e8e596 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 30 Jan 2024 19:52:09 -0500 Subject: [PATCH] --- networktables.json | 1 + simgui-ds.json | 92 +++++++++++++++++++ simgui.json | 12 +++ src/main/java/frc/robot/RobotContainer.java | 9 +- .../java/frc/robot/command/GrimpeurBas.java | 51 ---------- .../java/frc/robot/command/GuiderHaut.java | 2 +- .../java/frc/robot/subsystem/Guideur.java | 2 +- 7 files changed, 113 insertions(+), 56 deletions(-) create mode 100644 networktables.json create mode 100644 simgui-ds.json create mode 100644 simgui.json delete mode 100644 src/main/java/frc/robot/command/GrimpeurBas.java diff --git a/networktables.json b/networktables.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/networktables.json @@ -0,0 +1 @@ +[] 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..4da2b3d --- /dev/null +++ b/simgui.json @@ -0,0 +1,12 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo", + "/SmartDashboard/Field": "Field2d", + "/SmartDashboard/Pigeon IMU [0]": "Gyro" + } + }, + "NetworkTables Info": { + "visible": true + } +} diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7303389..e2edab8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -13,7 +13,8 @@ import edu.wpi.first.wpilibj2.command.RunCommand; // Manette import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; - +import frc.robot.command.GuiderBas; +import frc.robot.command.GuiderHaut; // Subsystem import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Balayeuse; @@ -31,14 +32,16 @@ public class RobotContainer { Grimpeur grimpeur = new Grimpeur(); Guideur guideur = new Guideur(); Lanceur lanceur = new Lanceur(); - + GuiderHaut guiderHaut = new GuiderHaut(guideur); + GuiderBas guiderBas = new GuiderBas(guideur); CommandJoystick joystick = new CommandJoystick(0); CommandXboxController manette = new CommandXboxController(1); public RobotContainer() { CameraServer.startAutomaticCapture(); - + manette.a().onTrue(guiderBas); + manette.b().onTrue(guiderHaut); configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2)); diff --git a/src/main/java/frc/robot/command/GrimpeurBas.java b/src/main/java/frc/robot/command/GrimpeurBas.java deleted file mode 100644 index 47b2a53..0000000 --- a/src/main/java/frc/robot/command/GrimpeurBas.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package frc.robot.command; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystem.Grimpeur; - -public class GrimpeurBas extends Command { - private Grimpeur grimpeur; - /** Creates a new GrimpeurBas. */ - public GrimpeurBas(Grimpeur grimpeur) { - this.grimpeur = grimpeur; - addRequirements(grimpeur); - // Use addRequirements() here to declare subsystem dependencies. - } - - // Called when the command is initially scheduled. - @Override - public void initialize() { - grimpeur.resetencodeurd(); - grimpeur.resetencodeurg(); - } - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() { - if(grimpeur.droite()){ - grimpeur.resetencodeurd(); - grimpeur.gauche(0); - } - if(grimpeur.gauche()){ - grimpeur.resetencodeurg(); - grimpeur.gauche(0); - } - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - grimpeur.droit(0); - grimpeur.gauche(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/command/GuiderHaut.java b/src/main/java/frc/robot/command/GuiderHaut.java index 586ebbd..1eb052e 100644 --- a/src/main/java/frc/robot/command/GuiderHaut.java +++ b/src/main/java/frc/robot/command/GuiderHaut.java @@ -10,7 +10,7 @@ import frc.robot.subsystem.Guideur; public class GuiderHaut extends Command { private Guideur guideur; /** Creates a new GuiderHaut. */ - public GuiderHaut() { + public GuiderHaut(Guideur guideur) { this.guideur = guideur; addRequirements(guideur); // Use addRequirements() here to declare subsystem dependencies. diff --git a/src/main/java/frc/robot/subsystem/Guideur.java b/src/main/java/frc/robot/subsystem/Guideur.java index 08ffab9..359a04c 100644 --- a/src/main/java/frc/robot/subsystem/Guideur.java +++ b/src/main/java/frc/robot/subsystem/Guideur.java @@ -16,7 +16,7 @@ public class Guideur extends SubsystemBase { final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur); final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut); - final DigitalInput guideurbas = new DigitalInput(Constants.guideurhaut); + final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas); public void guider(double vitesse){ guideur.set(vitesse);