Compare commits
	
		
			12 Commits
		
	
	
		
			grimpe
			...
			c81f118058
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | c81f118058 | ||
|  | 7848c4aaf2 | ||
|  | 1d1d6e962d | ||
|  | d6420659e9 | ||
|  | aafb2a62b5 | ||
|  | 0fdfa4269d | ||
|  | 017f168b3c | ||
|  | 5ffa28596c | ||
|  | e7b4b47928 | ||
|  | 0577ce368a | ||
|  | 7521c0d94e | ||
|  | b16d11b70a | 
| @@ -1,97 +0,0 @@ | |||||||
| { |  | ||||||
|   "System Joysticks": { |  | ||||||
|     "window": { |  | ||||||
|       "enabled": false |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   "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 |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -4,40 +4,15 @@ | |||||||
|  |  | ||||||
| package frc.robot; | package frc.robot; | ||||||
|  |  | ||||||
| import edu.wpi.first.math.MathUtil; |  | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import edu.wpi.first.wpilibj2.command.Commands; | import edu.wpi.first.wpilibj2.command.Commands; | ||||||
| import edu.wpi.first.wpilibj2.command.RunCommand; |  | ||||||
| import edu.wpi.first.wpilibj2.command.button.CommandXboxController; |  | ||||||
| import frc.robot.commands.GrimperHaut; |  | ||||||
| import frc.robot.commands.GrimpeurBas; |  | ||||||
| import frc.robot.commands.GrimpeurManuel; |  | ||||||
| import frc.robot.commands.ResetGrimpeur; |  | ||||||
| import frc.robot.subsystems.Bougie; |  | ||||||
| import frc.robot.subsystems.Grimpeur; |  | ||||||
|  |  | ||||||
| public class RobotContainer { | public class RobotContainer { | ||||||
|   CommandXboxController manette1 = new CommandXboxController(0); |  | ||||||
|   CommandXboxController manette2 = new CommandXboxController(1); |  | ||||||
|   Grimpeur grimpeur = new Grimpeur(); |  | ||||||
|   Bougie bougie = new Bougie(); |  | ||||||
|   GrimpeurManuel grimpeurManuel = new GrimpeurManuel(grimpeur, manette2::getLeftY); |  | ||||||
|   public RobotContainer() { |   public RobotContainer() { | ||||||
|     grimpeur.setDefaultCommand(new RunCommand(()->{ |  | ||||||
|       if(grimpeur.stop()){ |  | ||||||
|        grimpeur.grimpe(0);  |  | ||||||
|       } |  | ||||||
|       else{ |  | ||||||
|         grimpeur.grimpe(MathUtil.applyDeadband(manette2.getLeftY(), 0.2)); |  | ||||||
|     }}, grimpeur)); |  | ||||||
|     configureBindings(); |     configureBindings(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private void configureBindings() { |   private void configureBindings() {} | ||||||
|     manette2.leftBumper().whileTrue(new GrimperHaut(grimpeur,bougie)); |  | ||||||
|     manette2.rightBumper().whileTrue(new GrimpeurBas(grimpeur)); |  | ||||||
|     manette2.a().whileTrue(new ResetGrimpeur(grimpeur)); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   public Command getAutonomousCommand() { |   public Command getAutonomousCommand() { | ||||||
|     return Commands.print("No autonomous command configured"); |     return Commands.print("No autonomous command configured"); | ||||||
|   | |||||||
| @@ -2,18 +2,18 @@ | |||||||
| // Open Source Software; you can modify and/or share it under the terms of | // 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. | // the WPILib BSD license file in the root directory of this project. | ||||||
| 
 | 
 | ||||||
| package frc.robot.commands; | package frc.robot.command; | ||||||
| 
 | 
 | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import frc.robot.subsystems.Grimpeur; | 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 */ | /* 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 ResetGrimpeur extends Command { | public class AlgueExpire extends Command { | ||||||
|   private Grimpeur grimpeur; |   private Pince pince; | ||||||
|   /** Creates a new ResetGrimpeur. */ |   /** Creates a new CoralAlgue. */ | ||||||
|   public ResetGrimpeur(Grimpeur grimpeur) { |   public AlgueExpire(Pince pince) { | ||||||
|     this.grimpeur = grimpeur; |     this.pince = pince; | ||||||
|     addRequirements(grimpeur); |     addRequirements(pince); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @@ -24,12 +24,14 @@ public class ResetGrimpeur extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     grimpeur.reset(); |     pince.aspirealgue(0.5); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   @Override |   @Override | ||||||
|   public void end(boolean interrupted) {} |   public void end(boolean interrupted) { | ||||||
|  |     pince.aspirealgue(0);  | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   // Returns true when the command should end. |   // Returns true when the command should end. | ||||||
|   @Override |   @Override | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/CoralAlgueInspire.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/CoralAlgueInspire.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.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 CoralAlgueInspire extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new CoralAlgue. */ | ||||||
|  |   public CoralAlgueInspire(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.aspirecoral(-.5); | ||||||
|  |     if(pince.emperagealgue()>8){ | ||||||
|  |       pince.aspirealgue(0); | ||||||
|  |      }  | ||||||
|  |      else{ | ||||||
|  |       pince.aspirealgue(0.5); | ||||||
|  |       } | ||||||
|  |      | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.aspirecoral(0); | ||||||
|  |     pince.aspirealgue(0);  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -2,18 +2,18 @@ | |||||||
| // Open Source Software; you can modify and/or share it under the terms of | // 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. | // the WPILib BSD license file in the root directory of this project. | ||||||
| 
 | 
 | ||||||
| package frc.robot.commands; | package frc.robot.command; | ||||||
| 
 | 
 | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import frc.robot.subsystems.Bougie; | 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 */ | /* 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 RainBow extends Command { | public class CoralExpire extends Command { | ||||||
|   /** Creates a new RainBow. */ |   private Pince pince; | ||||||
|   private Bougie bougie; |   /** Creates a new CoralAlgue. */ | ||||||
|   public RainBow(Bougie bougie) { |   public CoralExpire(Pince pince) { | ||||||
|     this.bougie = bougie; |     this.pince = pince; | ||||||
|     addRequirements(bougie); |     addRequirements(pince); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @@ -24,13 +24,13 @@ public class RainBow extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     bougie.RainBow(); |     pince.aspirecoral(.5); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   @Override |   @Override | ||||||
|   public void end(boolean interrupted) { |   public void end(boolean interrupted) { | ||||||
|     bougie.RainBowStop(); |     pince.aspirecoral(0); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Returns true when the command should end. |   // Returns true when the command should end. | ||||||
| @@ -2,18 +2,18 @@ | |||||||
| // Open Source Software; you can modify and/or share it under the terms of | // 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. | // the WPILib BSD license file in the root directory of this project. | ||||||
| 
 | 
 | ||||||
| package frc.robot.commands; | package frc.robot.command; | ||||||
| 
 | 
 | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import frc.robot.subsystems.Grimpeur; | 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 */ | /* 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 GrimpeurBas extends Command { | public class CoralInspire extends Command { | ||||||
|   private Grimpeur grimpeur; |   private Pince pince; | ||||||
|   /** Creates a new GrimpeurBas. */ |   /** Creates a new CoralAlgue. */ | ||||||
|   public GrimpeurBas(Grimpeur grimpeur) { |   public CoralInspire(Pince pince) { | ||||||
|     this.grimpeur = grimpeur; |     this.pince = pince; | ||||||
|     addRequirements(grimpeur); |     addRequirements(pince); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @@ -24,20 +24,18 @@ public class GrimpeurBas extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     if(grimpeur.encodeur()>=-38.5 && grimpeur.encodeur()<=-39.19){ |     if(pince.emperagecoral()>8){ | ||||||
|       grimpeur.grimpe(0); |     pince.aspirecoral(0);   | ||||||
|     } |     } | ||||||
|     else if(grimpeur.encodeur()>=-38.5){ |     else{ | ||||||
|       grimpeur.grimpe(-0.5); |       pince.aspirecoral(.5); | ||||||
|     } |     } | ||||||
|    else{grimpeur.grimpe(0.5); |  | ||||||
|   }  |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   @Override |   @Override | ||||||
|   public void end(boolean interrupted) { |   public void end(boolean interrupted) { | ||||||
|     grimpeur.grimpe(0); |     pince.aspirecoral(0); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Returns true when the command should end. |   // Returns true when the command should end. | ||||||
							
								
								
									
										47
									
								
								src/main/java/frc/robot/command/Depart.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/main/java/frc/robot/command/Depart.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | |||||||
|  | // 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.subsystems.Elevateur; | ||||||
|  |  | ||||||
|  | /* 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 Depart extends Command { | ||||||
|  |   private Elevateur elevateur; | ||||||
|  |   /** Creates a new L2. */ | ||||||
|  |   public Depart(Elevateur elevateur) { | ||||||
|  |     this.elevateur = elevateur; | ||||||
|  |     addRequirements(elevateur); | ||||||
|  |     // 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(elevateur.limit2()==true){ | ||||||
|  |       elevateur.vitesse(0); | ||||||
|  |       elevateur.reset(); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       elevateur.vitesse(-.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     elevateur.vitesse(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return elevateur.limit2()==true; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										47
									
								
								src/main/java/frc/robot/command/DepartPince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/main/java/frc/robot/command/DepartPince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | |||||||
|  | // 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.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 DepartPince extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new DepartPince. */ | ||||||
|  |   public DepartPince(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() { | ||||||
|  |     if(pince.position()==true){ | ||||||
|  |       pince.pivote(0); | ||||||
|  |       pince.reset(); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.pivote(.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.pivote(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -2,21 +2,22 @@ | |||||||
| // Open Source Software; you can modify and/or share it under the terms of | // 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. | // the WPILib BSD license file in the root directory of this project. | ||||||
| 
 | 
 | ||||||
| package frc.robot.commands; | package frc.robot.command; | ||||||
|  | 
 | ||||||
|  | import java.util.function.DoubleSupplier; | ||||||
| 
 | 
 | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import frc.robot.subsystems.Bougie; | import frc.robot.subsystems.Elevateur; | ||||||
| import frc.robot.subsystems.Grimpeur; |  | ||||||
| 
 | 
 | ||||||
| /* 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 */ | /* 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 GrimperHaut extends Command { | public class ElevateurManuel extends Command { | ||||||
|   private Grimpeur grimpeur; |   private DoubleSupplier doubleSupplier; | ||||||
|   private Bougie bougie; |   private Elevateur elevateur; | ||||||
|   /** Creates a new Grimper. */ |   /** Creates a new ElevateurManuel. */ | ||||||
|   public GrimperHaut(Grimpeur grimpeur, Bougie bougie) { |   public ElevateurManuel(Elevateur elevateur,DoubleSupplier doubleSupplier) { | ||||||
|     this.grimpeur = grimpeur; |     this.doubleSupplier = doubleSupplier; | ||||||
|     this.bougie = bougie; |     this.elevateur = elevateur; | ||||||
|     addRequirements(grimpeur,bougie); |     addRequirements(elevateur); | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @@ -27,30 +28,21 @@ public class GrimperHaut extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     if(grimpeur.stop()==true){ |     if(elevateur.limit2()==true){ | ||||||
|       grimpeur.grimpe(0); |       elevateur.vitesse(0); | ||||||
|       grimpeur.reset(); |  | ||||||
|       bougie.RainBow(); |  | ||||||
|     } |  | ||||||
|     else{ |  | ||||||
|       grimpeur.grimpe(0.5); |  | ||||||
|       bougie.RainBowStop(); |  | ||||||
|     } |     } | ||||||
|  |     elevateur.vitesse(doubleSupplier.getAsDouble()); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   @Override |   @Override | ||||||
|   public void end(boolean interrupted) { |   public void end(boolean interrupted) { | ||||||
|     grimpeur.grimpe(0); |     elevateur.vitesse(0); | ||||||
|    if(grimpeur.stop()){ |  | ||||||
|     bougie.RainBow(); |  | ||||||
|    } |  | ||||||
| 
 |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Returns true when the command should end. |   // Returns true when the command should end. | ||||||
|   @Override |   @Override | ||||||
|   public boolean isFinished() { |   public boolean isFinished() { | ||||||
|     return grimpeur.stop()==true; |     return false; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @@ -2,22 +2,18 @@ | |||||||
| // Open Source Software; you can modify and/or share it under the terms of | // 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. | // the WPILib BSD license file in the root directory of this project. | ||||||
| 
 | 
 | ||||||
| package frc.robot.commands; | package frc.robot.command; | ||||||
| 
 |  | ||||||
| import java.util.function.DoubleSupplier; |  | ||||||
| 
 | 
 | ||||||
| import edu.wpi.first.wpilibj2.command.Command; | import edu.wpi.first.wpilibj2.command.Command; | ||||||
| import frc.robot.subsystems.Grimpeur; | import frc.robot.subsystems.Elevateur; | ||||||
| 
 | 
 | ||||||
| /* 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 */ | /* 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 GrimpeurManuel extends Command { | public class L2 extends Command { | ||||||
|   private Grimpeur grimpeur; |   private Elevateur elevateur; | ||||||
|   private DoubleSupplier x; |   /** Creates a new L2. */ | ||||||
|   /** Creates a new GrimpeurManuel. */ |   public L2(Elevateur elevateur) { | ||||||
|   public GrimpeurManuel(Grimpeur grimpeur,DoubleSupplier x) { |     this.elevateur = elevateur; | ||||||
|     this.grimpeur = grimpeur; |     addRequirements(elevateur); | ||||||
|     this.x = x; |  | ||||||
|     addRequirements(grimpeur); |  | ||||||
|     // Use addRequirements() here to declare subsystem dependencies. |     // Use addRequirements() here to declare subsystem dependencies. | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @@ -28,11 +24,14 @@ public class GrimpeurManuel extends Command { | |||||||
|   // Called every time the scheduler runs while the command is scheduled. |   // Called every time the scheduler runs while the command is scheduled. | ||||||
|   @Override |   @Override | ||||||
|   public void execute() { |   public void execute() { | ||||||
|     if(grimpeur.stop()){ |     if(elevateur.position()>=500 && elevateur.position()<=510){ | ||||||
|       grimpeur.grimpe(0); |       elevateur.vitesse(0); | ||||||
|  |     } | ||||||
|  |     else if(elevateur.position()>=510){ | ||||||
|  |       elevateur.vitesse(-0.3); | ||||||
|     } |     } | ||||||
|     else{ |     else{ | ||||||
|     grimpeur.grimpe(x.getAsDouble());   |       elevateur.vitesse(.3); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
| @@ -40,7 +39,7 @@ public class GrimpeurManuel extends Command { | |||||||
|   // Called once the command ends or is interrupted. |   // Called once the command ends or is interrupted. | ||||||
|   @Override |   @Override | ||||||
|   public void end(boolean interrupted) { |   public void end(boolean interrupted) { | ||||||
|     grimpeur.grimpe(0); |     elevateur.vitesse(0); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Returns true when the command should end. |   // Returns true when the command should end. | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/L2Pince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/L2Pince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.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 L2Pince extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new L2Pince. */ | ||||||
|  |   public L2Pince(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() { | ||||||
|  |     if(pince.encodeurpivot()>=500 && pince.encodeurpivot()<=510){ | ||||||
|  |       pince.pivote(0); | ||||||
|  |     } | ||||||
|  |     else if(pince.encodeurpivot()>=510){ | ||||||
|  |       pince.pivote(-0.3); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.pivote(0.3); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.pivote(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/L3.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/L3.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.subsystems.Elevateur; | ||||||
|  |  | ||||||
|  | /* 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 L3 extends Command { | ||||||
|  |   private Elevateur elevateur; | ||||||
|  |   /** Creates a new L2. */ | ||||||
|  |   public L3(Elevateur elevateur) { | ||||||
|  |     this.elevateur = elevateur; | ||||||
|  |     addRequirements(elevateur); | ||||||
|  |     // 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(elevateur.position()>=700 && elevateur.position()<=710){ | ||||||
|  |       elevateur.vitesse(0); | ||||||
|  |     } | ||||||
|  |     else if(elevateur.position()>=510){ | ||||||
|  |       elevateur.vitesse(-0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       elevateur.vitesse(.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     elevateur.vitesse(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/L3Pince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/L3Pince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.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 L3Pince extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new L2Pince. */ | ||||||
|  |   public L3Pince(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() { | ||||||
|  |     if(pince.encodeurpivot()>=700 && pince.encodeurpivot()<=710){ | ||||||
|  |       pince.pivote(0); | ||||||
|  |     } | ||||||
|  |     else if(pince.encodeurpivot()>=710){ | ||||||
|  |       pince.pivote(-0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.pivote(0.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.pivote(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/L4.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/L4.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.subsystems.Elevateur; | ||||||
|  |  | ||||||
|  | /* 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 L4 extends Command { | ||||||
|  |   private Elevateur elevateur; | ||||||
|  |   /** Creates a new L2. */ | ||||||
|  |   public L4(Elevateur elevateur) { | ||||||
|  |     this.elevateur = elevateur; | ||||||
|  |     addRequirements(elevateur); | ||||||
|  |     // 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(elevateur.position()>=800 && elevateur.position()<=810){ | ||||||
|  |       elevateur.vitesse(0); | ||||||
|  |     } | ||||||
|  |     else if(elevateur.position()>=810){ | ||||||
|  |       elevateur.vitesse(-0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       elevateur.vitesse(.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     elevateur.vitesse(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return elevateur.position()>=800; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/L4Pince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/L4Pince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.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 L4Pince extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new L2Pince. */ | ||||||
|  |   public L4Pince(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() { | ||||||
|  |     if(pince.encodeurpivot()>=800 && pince.encodeurpivot()<=810){ | ||||||
|  |       pince.pivote(0); | ||||||
|  |     } | ||||||
|  |     else if(pince.encodeurpivot()>=810){ | ||||||
|  |       pince.pivote(-0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.pivote(0.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.pivote(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								src/main/java/frc/robot/command/StationPince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/main/java/frc/robot/command/StationPince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | // 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.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 StationPince extends Command { | ||||||
|  |   private Pince pince; | ||||||
|  |   /** Creates a new L2Pince. */ | ||||||
|  |   public StationPince(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() { | ||||||
|  |     if(pince.encodeurpivot()>=900 && pince.encodeurpivot()<=910){ | ||||||
|  |       pince.pivote(0); | ||||||
|  |     } | ||||||
|  |     else if(pince.encodeurpivot()>=910){ | ||||||
|  |       pince.pivote(-0.5); | ||||||
|  |     } | ||||||
|  |     else{ | ||||||
|  |       pince.pivote(0.5); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Called once the command ends or is interrupted. | ||||||
|  |   @Override | ||||||
|  |   public void end(boolean interrupted) { | ||||||
|  |     pince.pivote(0); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // Returns true when the command should end. | ||||||
|  |   @Override | ||||||
|  |   public boolean isFinished() { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -1,38 +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.subsystems; |  | ||||||
|  |  | ||||||
| import com.ctre.phoenix.led.CANdle; |  | ||||||
| import com.ctre.phoenix.led.CANdleConfiguration; |  | ||||||
| import com.ctre.phoenix.led.RainbowAnimation; |  | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; |  | ||||||
|  |  | ||||||
| public class Bougie extends SubsystemBase { |  | ||||||
|   CANdle candle = new CANdle(5); |  | ||||||
|   CANdleConfiguration config = new CANdleConfiguration(); |  | ||||||
|   RainbowAnimation rainbowAnim = new RainbowAnimation(1, 0.5, 64); |  | ||||||
|   /** Creates a new Bougie. */ |  | ||||||
|   public Bougie() { |  | ||||||
|     config.brightnessScalar = 0.5; |  | ||||||
|     candle.configAllSettings(config); |  | ||||||
|   } |  | ||||||
|   public void Rouge() { |  | ||||||
|    candle.setLEDs(255, 0, 0); |  | ||||||
|   } |  | ||||||
|   public void Vert() { |  | ||||||
|    candle.setLEDs(0, 255, 0); |  | ||||||
|   } |  | ||||||
|   public void Bleu() { |  | ||||||
|    candle.setLEDs(0, 0, 255); |  | ||||||
|   } |  | ||||||
|   public void RainBow(){candle.animate(rainbowAnim);} |  | ||||||
|   public void RainBowStop(){candle.animate(null);} |  | ||||||
|   @Override |  | ||||||
|   public void periodic() { |  | ||||||
|     // This method will be called once per scheduler run |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								src/main/java/frc/robot/subsystems/Elevateur.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/main/java/frc/robot/subsystems/Elevateur.java
									
									
									
									
									
										Normal file
									
								
							| @@ -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.subsystems; | ||||||
|  |  | ||||||
|  | import edu.wpi.first.wpilibj.DigitalInput; | ||||||
|  | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  | import com.revrobotics.spark.SparkMax; | ||||||
|  | import com.revrobotics.spark.SparkLowLevel.MotorType; | ||||||
|  | public class Elevateur extends SubsystemBase { | ||||||
|  |   /** Creates a new Elevateur. */ | ||||||
|  |   public Elevateur() {} | ||||||
|  |   final SparkMax  monte = new SparkMax(0, MotorType.kBrushless); | ||||||
|  |   final DigitalInput limit2 = new DigitalInput(0); | ||||||
|  |   public double position(){ | ||||||
|  |     return monte.getEncoder().getPosition(); | ||||||
|  |   } | ||||||
|  |   public void vitesse(double vitesse){ | ||||||
|  |     monte.set(vitesse); | ||||||
|  |   } | ||||||
|  |   public boolean limit2(){ | ||||||
|  |     return limit2.get(); | ||||||
|  |   }  | ||||||
|  |   public void reset(){ | ||||||
|  |     monte.getEncoder().setPosition(0); | ||||||
|  |   } | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -4,35 +4,21 @@ | |||||||
|  |  | ||||||
| package frc.robot.subsystems; | package frc.robot.subsystems; | ||||||
|  |  | ||||||
| import com.revrobotics.spark.SparkMax; |  | ||||||
| import com.revrobotics.spark.SparkLowLevel.MotorType; |  | ||||||
|  |  | ||||||
| import edu.wpi.first.wpilibj.DigitalInput; | import edu.wpi.first.wpilibj.DigitalInput; | ||||||
| import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; | import edu.wpi.first.wpilibj.motorcontrol.Spark; | ||||||
| import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; |  | ||||||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  |  | ||||||
| public class Grimpeur extends SubsystemBase { | public class Grimpeur extends SubsystemBase { | ||||||
|   /** Creates a new Grimpeur. */ |   /** Creates a new Grimpeur. */ | ||||||
|   ShuffleboardTab teb = Shuffleboard.getTab("teb"); |   public Grimpeur() {} | ||||||
|   public Grimpeur() { |   final Spark grimpeur = new Spark(0); | ||||||
|     teb.addBoolean("limit grimpeur", this::stop); |   final DigitalInput limit1 = new DigitalInput(0); | ||||||
|     teb.addDouble("encodeur grimpeur", this::encodeur); |  | ||||||
|   } |  | ||||||
|   final SparkMax grimpeur = new SparkMax(21,MotorType.kBrushless); |  | ||||||
|   final DigitalInput limit1 = new DigitalInput(2); |  | ||||||
|   public void grimpe(double vitesse){ |   public void grimpe(double vitesse){ | ||||||
|     grimpeur.set(vitesse); |     grimpeur.set(vitesse); | ||||||
|   } |   } | ||||||
|   public boolean stop(){ |   final void stop(){ | ||||||
|    return limit1.get(); |     limit1.get(); | ||||||
|   } |   } | ||||||
|   public double encodeur(){ |  | ||||||
|   return grimpeur.getEncoder().getPosition(); |  | ||||||
|   } |  | ||||||
|   public void reset(){ |  | ||||||
|      grimpeur.getEncoder().setPosition(0); |  | ||||||
|     } |  | ||||||
|   @Override |   @Override | ||||||
|   public void periodic() { |   public void periodic() { | ||||||
|     // This method will be called once per scheduler run |     // This method will be called once per scheduler run | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								src/main/java/frc/robot/subsystems/Pince.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/main/java/frc/robot/subsystems/Pince.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | // 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.subsystems; | ||||||
|  |  | ||||||
|  | import com.revrobotics.spark.SparkLowLevel.MotorType; | ||||||
|  | import com.revrobotics.spark.SparkMax; | ||||||
|  |  | ||||||
|  | import edu.wpi.first.wpilibj.DigitalInput; | ||||||
|  | import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||||||
|  |  | ||||||
|  | public class Pince extends SubsystemBase { | ||||||
|  |   /** Creates a new Pince. */ | ||||||
|  |   public Pince() {} | ||||||
|  |   final SparkMax coral = new SparkMax(0, MotorType.kBrushless); | ||||||
|  |   final SparkMax pivoti = new SparkMax(0, MotorType.kBrushless); | ||||||
|  |   final SparkMax algue1 = new SparkMax(0, MotorType.kBrushless); | ||||||
|  |   final SparkMax algue2 = new SparkMax(0, MotorType.kBrushless); | ||||||
|  |   final DigitalInput limit6 = new DigitalInput(0); | ||||||
|  |   public void aspirecoral(double vitesse){ | ||||||
|  |     coral.set(vitesse); | ||||||
|  |   } | ||||||
|  | public void pivote(double vitesse){ | ||||||
|  |   pivoti.set(vitesse); | ||||||
|  | } | ||||||
|  | public void aspirealgue(double vitesse){ | ||||||
|  |   algue2.set(vitesse); | ||||||
|  |   algue1.set(-vitesse); | ||||||
|  | } | ||||||
|  | public double encodeurpivot(){ | ||||||
|  |   return pivoti.getEncoder().getPosition(); | ||||||
|  | } | ||||||
|  | public boolean position(){ | ||||||
|  |  return limit6.get(); | ||||||
|  | } | ||||||
|  | public void reset(){ | ||||||
|  |   pivoti.getEncoder().setPosition(0); | ||||||
|  | } | ||||||
|  | public double emperagecoral(){ | ||||||
|  |   return coral.getOutputCurrent(); | ||||||
|  | } | ||||||
|  | public double emperagealgue(){ | ||||||
|  |   return algue1.getOutputCurrent(); | ||||||
|  | } | ||||||
|  |   @Override | ||||||
|  |   public void periodic() { | ||||||
|  |     // This method will be called once per scheduler run | ||||||
|  |   } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user