Limit swich elevateur + limit switch pince (testé en simulation-Fonctionne)
This commit is contained in:
		| @@ -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(); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user