diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 903b89d..3b58775 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -133,7 +133,7 @@ public class RobotContainer { //Pince manuel pince.setDefaultCommand(new RunCommand(()->{ - pince.pivote(MathUtil.applyDeadband(manette2.getRightY(), 0.1)); + pince.pivote(MathUtil.applyDeadband(manette2.getRightY()*manette2.getRightY()*manette2.getRightY(), 0.05)); }, pince)); //Elevateur manuel diff --git a/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java index 682fdc6..772df78 100644 --- a/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java +++ b/src/main/java/frc/robot/commands/Elevateur/ElevateurManuel.java @@ -28,7 +28,10 @@ public class ElevateurManuel extends Command { // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { - if (elevateur.limit2()) + if (elevateur.limit2()){ + + + } elevateur.vitesse(doubleSupplier.getAsDouble()/3.5); } diff --git a/src/main/java/frc/robot/commands/Pince/Algue1Test.java b/src/main/java/frc/robot/commands/Pince/Algue1Test.java deleted file mode 100644 index ab5e886..0000000 --- a/src/main/java/frc/robot/commands/Pince/Algue1Test.java +++ /dev/null @@ -1,41 +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.commands.Pince; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Pince; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class Algue1Test extends Command { - private Pince pince; - /** Creates a new AlgueTest. */ - public Algue1Test(Pince pince) { - this.pince = pince; - addRequirements(pince); - // 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() { - pince.algue1Test(0.2); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - pince.algue1Test(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/commands/Pince/Algue2Test.java b/src/main/java/frc/robot/commands/Pince/Algue2Test.java deleted file mode 100644 index 386e4f1..0000000 --- a/src/main/java/frc/robot/commands/Pince/Algue2Test.java +++ /dev/null @@ -1,41 +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.commands.Pince; - -import edu.wpi.first.wpilibj2.command.Command; -import frc.robot.subsystems.Pince; - -/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ -public class Algue2Test extends Command { - private Pince pince; - /** Creates a new AlgueTest. */ - public Algue2Test(Pince pince) { - this.pince = pince; - addRequirements(pince); - // 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() { - pince.algue2Test(0.2); - } - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) { - pince.algue2Test(0); - } - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/frc/robot/subsystems/Elevateur.java b/src/main/java/frc/robot/subsystems/Elevateur.java index 7ef7851..b329555 100644 --- a/src/main/java/frc/robot/subsystems/Elevateur.java +++ b/src/main/java/frc/robot/subsystems/Elevateur.java @@ -3,8 +3,6 @@ // the WPILib BSD license file in the root directory of this project. package frc.robot.subsystems; - -import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; @@ -25,7 +23,17 @@ public class Elevateur extends SubsystemBase { return monte.getEncoder().getPosition(); } public void vitesse(double vitesse){ - monte.set(vitesse); + if (limit2()) { + if (vitesse > 0) { + monte.set(0); + } + else{ + monte.set(vitesse); + } + } + else{ + monte.set(vitesse); + } } public boolean limit2(){ return limit2.get(); diff --git a/src/main/java/frc/robot/subsystems/Pince.java b/src/main/java/frc/robot/subsystems/Pince.java index f07f601..957b45b 100644 --- a/src/main/java/frc/robot/subsystems/Pince.java +++ b/src/main/java/frc/robot/subsystems/Pince.java @@ -6,8 +6,6 @@ package frc.robot.subsystems; import com.revrobotics.spark.SparkLowLevel.MotorType; import com.revrobotics.spark.SparkMax; - -import edu.wpi.first.networktables.GenericEntry; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; @@ -27,11 +25,21 @@ public class Pince extends SubsystemBase { final DigitalInput limit6 = new DigitalInput(9); - public void aspirecoral(double vitesse){ - coral.set(vitesse); - } +public void aspirecoral(double vitesse){ + coral.set(vitesse); +} public void pivote(double vitesse){ - pivoti.set(vitesse); + if (position()) { + if (vitesse > 0) { + pivoti.set(0); + } + else{ + pivoti.set(vitesse); + } + } + else{ + pivoti.set(vitesse); + } } public void aspirealgue(double vitesse){ algue2.set(-vitesse); @@ -52,12 +60,7 @@ public double emperagecoral(){ public double emperagealgue(){ return algue1.getOutputCurrent(); } -public void algue1Test(double vitesse){ - algue1.set(vitesse); -} -public void algue2Test(double vitesse){ - algue2.set(vitesse); -} + @Override public void periodic() { // This method will be called once per scheduler run