Merge branch 'main' of https://git.demerso.net/pls5618/2024/robot
This commit is contained in:
		| @@ -12,14 +12,11 @@ import frc.robot.subsystem.Lanceur; | ||||
|  | ||||
| public class Lancer extends Command { | ||||
|   /** Creates a new Lanceur. */ | ||||
|  | ||||
|   private Lanceur lancer; | ||||
|   private Lanceur lancer2; | ||||
|   private Lanceur lancer3; | ||||
|   private Lanceur lancer4; | ||||
|   private Lanceur lanceur; | ||||
|   public Lancer() { | ||||
|     this.lanceur = lanceur; | ||||
|     // Use addRequirements() here to declare subsystem dependencies. | ||||
|     addRequirements(lancer,lancer2,lancer3,lancer4); | ||||
|     addRequirements(lanceur); | ||||
|   } | ||||
|  | ||||
|   // Called when the command is initially scheduled. | ||||
| @@ -29,13 +26,13 @@ public class Lancer extends Command { | ||||
|   // Called every time the scheduler runs while the command is scheduled. | ||||
|   @Override | ||||
|   public void execute() { | ||||
|     lancer.lancer(0.3); | ||||
|     lanceur.lancer(0.3); | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   @Override | ||||
|   public void end(boolean interrupted) { | ||||
|     lancer.lancer(0); | ||||
|     lanceur.lancer(0); | ||||
|   } | ||||
|  | ||||
|   // Returns true when the command should end. | ||||
|   | ||||
							
								
								
									
										44
									
								
								src/main/java/frc/robot/command/LancerNote.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/main/java/frc/robot/command/LancerNote.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| // 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.Accumulateur; | ||||
| import frc.robot.subsystem.Lanceur; | ||||
|  | ||||
| public class LancerNote extends Command { | ||||
|   private Lanceur lancer; | ||||
|   private Accumulateur accumulateur; | ||||
|   /** Creates a new LancerNote. */ | ||||
|   public LancerNote(Lanceur lancer, Accumulateur accumulateur) { | ||||
|     this.lancer = lancer; | ||||
|     this.accumulateur = accumulateur; | ||||
|     // 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() { | ||||
|     double vitesse = 100; | ||||
|     lancer.lancer(vitesse); | ||||
|     if(lancer.vitesse(vitesse)>vitesse){ | ||||
|       accumulateur.Accumuler(0.6); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // 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; | ||||
|   } | ||||
| } | ||||
| @@ -13,13 +13,12 @@ import frc.robot.subsystem.Lanceur; | ||||
| public class Lancerampli extends Command { | ||||
|   /** Creates a new Lanceur. */ | ||||
|  | ||||
|   private Lanceur lancer; | ||||
|   private Lanceur lancer2; | ||||
|   private Lanceur lancer3; | ||||
|   private Lanceur lancer4; | ||||
|   private Lanceur lanceur; | ||||
|    | ||||
|   public Lancerampli() { | ||||
|     // Use addRequirements() here to declare subsystem dependencies. | ||||
|     addRequirements(lancer,lancer2,lancer3,lancer4); | ||||
|     addRequirements(lanceur); | ||||
|     this.lanceur = lanceur; | ||||
|   } | ||||
|  | ||||
|   // Called when the command is initially scheduled. | ||||
| @@ -29,13 +28,13 @@ public class Lancerampli extends Command { | ||||
|   // Called every time the scheduler runs while the command is scheduled. | ||||
|   @Override | ||||
|   public void execute() { | ||||
|     lancer.lancer(0.1); | ||||
|     lanceur.lancer(0.1); | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   @Override | ||||
|   public void end(boolean interrupted) { | ||||
|     lancer.lancer(0); | ||||
|     lanceur.lancer(0); | ||||
|   } | ||||
|  | ||||
|   // Returns true when the command should end. | ||||
|   | ||||
| @@ -25,6 +25,9 @@ public class Lanceur extends SubsystemBase { | ||||
|   } | ||||
|   public void lancer(double vitesse){ | ||||
|     lancer.set(vitesse); | ||||
|   } | ||||
|   public double vitesse(double vitesse){ | ||||
|     return lancer.getEncoder().getVelocity(); | ||||
|   } | ||||
|     public void lanceur(){ | ||||
|     lancer2.follow(lancer); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user