From 0542700d4dbd1b32e17766ef44fdac91df40bdc1 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 23 Jan 2024 19:53:48 -0500 Subject: [PATCH 1/5] mode auto --- .pathplanner/settings.json | 8 +++- src/main/deploy/pathplanner/autos/4.auto | 19 +++++++-- src/main/deploy/pathplanner/autos/5.auto | 31 ++++++++++++++ src/main/deploy/pathplanner/autos/6.auto | 31 ++++++++++++++ src/main/deploy/pathplanner/paths/4.1.path | 32 ++++---------- src/main/deploy/pathplanner/paths/4.2.path | 49 ++++++++++++++++++++++ src/main/deploy/pathplanner/paths/5.1.path | 49 ++++++++++++++++++++++ src/main/deploy/pathplanner/paths/5.2.path | 49 ++++++++++++++++++++++ src/main/deploy/pathplanner/paths/6.1.path | 49 ++++++++++++++++++++++ src/main/deploy/pathplanner/paths/6.2.path | 49 ++++++++++++++++++++++ 10 files changed, 337 insertions(+), 29 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/5.auto create mode 100644 src/main/deploy/pathplanner/autos/6.auto create mode 100644 src/main/deploy/pathplanner/paths/4.2.path create mode 100644 src/main/deploy/pathplanner/paths/5.1.path create mode 100644 src/main/deploy/pathplanner/paths/5.2.path create mode 100644 src/main/deploy/pathplanner/paths/6.1.path create mode 100644 src/main/deploy/pathplanner/paths/6.2.path diff --git a/.pathplanner/settings.json b/.pathplanner/settings.json index 6aafa9f..6bd2033 100644 --- a/.pathplanner/settings.json +++ b/.pathplanner/settings.json @@ -6,15 +6,19 @@ "1", "2", "3", + "4", + "5", "7", - "4" + "6" ], "autoFolders": [ "1", "2", "3", + "4", + "5", "7", - "4" + "6" ], "defaultMaxVel": 3.0, "defaultMaxAccel": 3.0, diff --git a/src/main/deploy/pathplanner/autos/4.auto b/src/main/deploy/pathplanner/autos/4.auto index d585e63..1eb4acc 100644 --- a/src/main/deploy/pathplanner/autos/4.auto +++ b/src/main/deploy/pathplanner/autos/4.auto @@ -2,15 +2,28 @@ "version": 1.0, "startingPose": { "position": { - "x": 2, - "y": 2 + "x": 15.2, + "y": 5.55 }, "rotation": 0 }, "command": { "type": "sequential", "data": { - "commands": [] + "commands": [ + { + "type": "path", + "data": { + "pathName": "4.1" + } + }, + { + "type": "path", + "data": { + "pathName": "4.2" + } + } + ] } }, "folder": "4", diff --git a/src/main/deploy/pathplanner/autos/5.auto b/src/main/deploy/pathplanner/autos/5.auto new file mode 100644 index 0000000..0ba9482 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.auto @@ -0,0 +1,31 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "5.1" + } + }, + { + "type": "path", + "data": { + "pathName": "5.2" + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/6.auto b/src/main/deploy/pathplanner/autos/6.auto new file mode 100644 index 0000000..4624edd --- /dev/null +++ b/src/main/deploy/pathplanner/autos/6.auto @@ -0,0 +1,31 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.8, + "y": 6.65 + }, + "rotation": -60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "6.1" + } + }, + { + "type": "path", + "data": { + "pathName": "6.2" + } + } + ] + } + }, + "folder": "6", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/4.1.path b/src/main/deploy/pathplanner/paths/4.1.path index ca790f1..9aad3ce 100644 --- a/src/main/deploy/pathplanner/paths/4.1.path +++ b/src/main/deploy/pathplanner/paths/4.1.path @@ -3,41 +3,25 @@ "waypoints": [ { "anchor": { - "x": 2.0, - "y": 7.0 + "x": 15.2, + "y": 5.55 }, "prevControl": null, "nextControl": { - "x": 3.0, - "y": 6.5 + "x": 15.2104492025505, + "y": 5.55 }, "isLocked": false, "linkedName": null }, { "anchor": { - "x": 5.0, - "y": 5.0 + "x": 14.0, + "y": 5.55 }, "prevControl": { - "x": 4.0, - "y": 6.0 - }, - "nextControl": { - "x": 6.0, - "y": 4.0 - }, - "isLocked": false, - "linkedName": null - }, - { - "anchor": { - "x": 7.0, - "y": 1.0 - }, - "prevControl": { - "x": 6.75, - "y": 2.5 + "x": 13.969168557398792, + "y": 5.55 }, "nextControl": null, "isLocked": false, diff --git a/src/main/deploy/pathplanner/paths/4.2.path b/src/main/deploy/pathplanner/paths/4.2.path new file mode 100644 index 0000000..e666b95 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/4.2.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 14.0, + "y": 5.55 + }, + "prevControl": null, + "nextControl": { + "x": 15.118033988749895, + "y": 5.55 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 15.2, + "y": 5.55 + }, + "prevControl": { + "x": 15.192584874480913, + "y": 5.547612425391122 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 0, + "rotateFast": false + }, + "reversed": false, + "folder": "4", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/5.1.path b/src/main/deploy/pathplanner/paths/5.1.path new file mode 100644 index 0000000..51aaa81 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/5.1.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 15.85, + "y": 4.4 + }, + "prevControl": null, + "nextControl": { + "x": 15.85312975966851, + "y": 4.40542090276134 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 14.0, + "y": 4.1 + }, + "prevControl": { + "x": 13.990250241783144, + "y": 4.090250241783143 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 0, + "rotateFast": false + }, + "reversed": false, + "folder": "5", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/5.2.path b/src/main/deploy/pathplanner/paths/5.2.path new file mode 100644 index 0000000..aa123ab --- /dev/null +++ b/src/main/deploy/pathplanner/paths/5.2.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 14.0, + "y": 4.1 + }, + "prevControl": null, + "nextControl": { + "x": 14.002432289858724, + "y": 4.1 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 15.85, + "y": 4.4 + }, + "prevControl": { + "x": 15.82771353771501, + "y": 4.361398715001432 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 60.38412103232163, + "rotateFast": false + }, + "reversed": false, + "folder": "5", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/6.1.path b/src/main/deploy/pathplanner/paths/6.1.path new file mode 100644 index 0000000..8e88e49 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/6.1.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 15.8, + "y": 6.65 + }, + "prevControl": null, + "nextControl": { + "x": 15.810493547475788, + "y": 6.65 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 14.0, + "y": 7.0 + }, + "prevControl": { + "x": 14.009749758216856, + "y": 6.990250241783143 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 0, + "rotateFast": false + }, + "reversed": false, + "folder": "6", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/6.2.path b/src/main/deploy/pathplanner/paths/6.2.path new file mode 100644 index 0000000..8a1d6d0 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/6.2.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 14.0, + "y": 7.0 + }, + "prevControl": null, + "nextControl": { + "x": 14.023088833925678, + "y": 7.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 15.8, + "y": 6.65 + }, + "prevControl": { + "x": 15.806819642142848, + "y": 6.668834620329574 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": -58.20379119767198, + "rotateFast": false + }, + "reversed": false, + "folder": "6", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file From 370d4ca87ede30c2b1dbeb2aa0cd600636128ccb Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 23 Jan 2024 19:56:02 -0500 Subject: [PATCH 2/5] auto --- src/main/deploy/pathplanner/autos/1.1.auto | 25 ++++++++++++++++ src/main/deploy/pathplanner/autos/2.1.auto | 25 ++++++++++++++++ src/main/deploy/pathplanner/autos/3.1.auto | 25 ++++++++++++++++ src/main/deploy/pathplanner/autos/4.1.auto | 25 ++++++++++++++++ src/main/deploy/pathplanner/autos/5.1.auto | 25 ++++++++++++++++ src/main/java/frc/robot/command/Lancer.java | 32 +++++++++++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 src/main/deploy/pathplanner/autos/1.1.auto create mode 100644 src/main/deploy/pathplanner/autos/2.1.auto create mode 100644 src/main/deploy/pathplanner/autos/3.1.auto create mode 100644 src/main/deploy/pathplanner/autos/4.1.auto create mode 100644 src/main/deploy/pathplanner/autos/5.1.auto create mode 100644 src/main/java/frc/robot/command/Lancer.java diff --git a/src/main/deploy/pathplanner/autos/1.1.auto b/src/main/deploy/pathplanner/autos/1.1.auto new file mode 100644 index 0000000..3be6cd9 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/1.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.3, + "y": 5.55 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "1.1" + } + } + ] + } + }, + "folder": "1", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/2.1.auto b/src/main/deploy/pathplanner/autos/2.1.auto new file mode 100644 index 0000000..5f0cce7 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/2.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 4.4 + }, + "rotation": 120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "2.1" + } + } + ] + } + }, + "folder": "2", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/3.1.auto b/src/main/deploy/pathplanner/autos/3.1.auto new file mode 100644 index 0000000..d9f0551 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/3.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 0.7, + "y": 6.7 + }, + "rotation": -120.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "3.1" + } + } + ] + } + }, + "folder": "3", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/4.1.auto b/src/main/deploy/pathplanner/autos/4.1.auto new file mode 100644 index 0000000..a7fa3fa --- /dev/null +++ b/src/main/deploy/pathplanner/autos/4.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.2, + "y": 5.55 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "4.1" + } + } + ] + } + }, + "folder": "4", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/5.1.auto b/src/main/deploy/pathplanner/autos/5.1.auto new file mode 100644 index 0000000..e839fb2 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/5.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.85, + "y": 4.4 + }, + "rotation": 60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "5.1" + } + } + ] + } + }, + "folder": "5", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/java/frc/robot/command/Lancer.java b/src/main/java/frc/robot/command/Lancer.java new file mode 100644 index 0000000..feea8c0 --- /dev/null +++ b/src/main/java/frc/robot/command/Lancer.java @@ -0,0 +1,32 @@ +// 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; + +public class Lancer extends Command { + /** Creates a new Lanceur. */ + public Lancer() { + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() {} + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} From 60136fbdcccaa039b1555678cfc7bd1b861bb80f Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Tue, 23 Jan 2024 19:56:49 -0500 Subject: [PATCH 3/5] menage --- src/main/java/frc/robot/subsystem/Balayeuse.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc/robot/subsystem/Balayeuse.java b/src/main/java/frc/robot/subsystem/Balayeuse.java index 83f7404..bf971ab 100644 --- a/src/main/java/frc/robot/subsystem/Balayeuse.java +++ b/src/main/java/frc/robot/subsystem/Balayeuse.java @@ -16,14 +16,8 @@ public class Balayeuse extends SubsystemBase { public Balayeuse() {} final WPI_TalonSRX roue = new WPI_TalonSRX(Constants.roue); final TalonSRX etoile = new TalonSRX(Constants.etoile); - - public void Accumulation(double vitesse){ - roue.set(vitesse); - } - public void balayeuse(){ - etoile.follow(roue); - etoile.setInverted(true); - } + public void Accumulation(double vitesse){roue.set(vitesse);} + public void balayeuse(){etoile.follow(roue); etoile.setInverted(true);} @Override public void periodic() { // This method will be called once per scheduler run From 4aa45a264be356370c90f5ff08e3c4b042790337 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 23 Jan 2024 19:59:45 -0500 Subject: [PATCH 4/5] auto --- .pathplanner/settings.json | 6 ++- src/main/deploy/pathplanner/autos/6.1.auto | 25 +++++++++++ src/main/deploy/pathplanner/autos/8.auto | 25 +++++++++++ src/main/deploy/pathplanner/paths/8.path | 49 ++++++++++++++++++++++ 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/6.1.auto create mode 100644 src/main/deploy/pathplanner/autos/8.auto create mode 100644 src/main/deploy/pathplanner/paths/8.path diff --git a/.pathplanner/settings.json b/.pathplanner/settings.json index 6bd2033..bda535b 100644 --- a/.pathplanner/settings.json +++ b/.pathplanner/settings.json @@ -8,8 +8,9 @@ "3", "4", "5", + "6", "7", - "6" + "8" ], "autoFolders": [ "1", @@ -17,8 +18,9 @@ "3", "4", "5", + "6", "7", - "6" + "8" ], "defaultMaxVel": 3.0, "defaultMaxAccel": 3.0, diff --git a/src/main/deploy/pathplanner/autos/6.1.auto b/src/main/deploy/pathplanner/autos/6.1.auto new file mode 100644 index 0000000..94fe39d --- /dev/null +++ b/src/main/deploy/pathplanner/autos/6.1.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.8, + "y": 6.65 + }, + "rotation": -60.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "6.1" + } + } + ] + } + }, + "folder": "6", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/8.auto b/src/main/deploy/pathplanner/autos/8.auto new file mode 100644 index 0000000..a8fbab3 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/8.auto @@ -0,0 +1,25 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 15.25, + "y": 3.0 + }, + "rotation": 180.0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "8" + } + } + ] + } + }, + "folder": "8", + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/8.path b/src/main/deploy/pathplanner/paths/8.path new file mode 100644 index 0000000..8d78948 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/8.path @@ -0,0 +1,49 @@ +{ + "version": 1.0, + "waypoints": [ + { + "anchor": { + "x": 15.25, + "y": 3.0 + }, + "prevControl": null, + "nextControl": { + "x": 15.242762626364385, + "y": 3.0 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 14.0, + "y": 3.0 + }, + "prevControl": { + "x": 14.014562140186673, + "y": 3.0 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0 + }, + "goalEndState": { + "velocity": 0, + "rotation": 179.21331928381937, + "rotateFast": false + }, + "reversed": false, + "folder": "8", + "previewStartingState": null, + "useDefaultConstraints": false +} \ No newline at end of file From 5478bd7dc916999a8a2bfd895cea4e00f9c15780 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Tue, 23 Jan 2024 20:11:26 -0500 Subject: [PATCH 5/5] --- .../java/frc/robot/command/GuiderBas.java | 45 +++++++++++++++++++ .../java/frc/robot/command/GuiderHaut.java | 45 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/main/java/frc/robot/command/GuiderBas.java create mode 100644 src/main/java/frc/robot/command/GuiderHaut.java diff --git a/src/main/java/frc/robot/command/GuiderBas.java b/src/main/java/frc/robot/command/GuiderBas.java new file mode 100644 index 0000000..a279897 --- /dev/null +++ b/src/main/java/frc/robot/command/GuiderBas.java @@ -0,0 +1,45 @@ +// 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.Guideur; + +public class GuiderBas extends Command { + private Guideur guideur; + /** Creates a new Guideur. */ + public GuiderBas(Guideur guideur) { + this.guideur = guideur; + addRequirements(guideur); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + if(guideur.bas()){ + guideur.guider(0); + } + else{ + guideur.guider(0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + guideur.guider(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 new file mode 100644 index 0000000..d431475 --- /dev/null +++ b/src/main/java/frc/robot/command/GuiderHaut.java @@ -0,0 +1,45 @@ +// 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.Guideur; + +public class GuiderHaut extends Command { + private Guideur guideur; + /** Creates a new GuiderHaut. */ + public GuiderHaut() { + this.guideur = guideur; + addRequirements(guideur); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + if(guideur.haut()){ + guideur.guider(0); + } + else{ + guideur.guider(-0.5); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + guideur.guider(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +}