Force 1 á 7
This commit is contained in:
		@@ -11,12 +11,11 @@ import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
 | 
				
			|||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
 | 
					import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.Command;
 | 
					import edu.wpi.first.wpilibj2.command.Command;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.RunCommand;
 | 
					import edu.wpi.first.wpilibj2.command.RunCommand;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
 | 
					 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
 | 
					import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
 | 
					import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
 | 
				
			||||||
import frc.robot.commands.Avancer;
 | 
					import frc.robot.commands.Avancer;
 | 
				
			||||||
 | 
					import frc.robot.commands.Force1;
 | 
				
			||||||
//import frc.robot.commands.Lancer;
 | 
					//import frc.robot.commands.Lancer;
 | 
				
			||||||
import frc.robot.commands.LancerTest;
 | 
					 | 
				
			||||||
import frc.robot.commands.Force2;
 | 
					import frc.robot.commands.Force2;
 | 
				
			||||||
import frc.robot.commands.Force3;
 | 
					import frc.robot.commands.Force3;
 | 
				
			||||||
import frc.robot.commands.Force4;
 | 
					import frc.robot.commands.Force4;
 | 
				
			||||||
@@ -61,20 +60,26 @@ public class RobotContainer {
 | 
				
			|||||||
  private void configureBindings() {
 | 
					  private void configureBindings() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  accumulateurtest accumulateurtest = new accumulateurtest(accumulateur);
 | 
					  accumulateurtest accumulateurtest = new accumulateurtest(accumulateur);
 | 
				
			||||||
  LancerTest lancertest = new LancerTest(lanceur);
 | 
					  Force1 Force1 = new Force1(lanceur, force1);
 | 
				
			||||||
   // joystick1.button(7).onTrue(new Lancer(lanceur, accumulateur, force1));
 | 
					  Force2 Force2 = new Force2(lanceur, force2);
 | 
				
			||||||
   /* joystick1.button(8).onTrue(new Lancer(lanceur, accumulateur, force2));
 | 
					  Force3 Force3 = new Force3(lanceur, force3);
 | 
				
			||||||
    joystick1.button(9).onTrue(new Lancer(lanceur, accumulateur, force3));
 | 
					  Force4 Force4 = new Force4(lanceur, force4);
 | 
				
			||||||
    joystick1.button(10).onTrue(new Lancer(lanceur, accumulateur, force4));
 | 
					  Force5 Force5 = new Force5(lanceur, force5);
 | 
				
			||||||
    joystick1.button(11).onTrue(new Lancer(lanceur, accumulateur, force5)); 
 | 
					  Force6 Force6 = new Force6(lanceur, force6);
 | 
				
			||||||
    joystick1.button(12).onTrue(new Lancer(lanceur, accumulateur, force6));*/
 | 
					  Force7 Force7 = new Force7(lanceur, force7);
 | 
				
			||||||
   // joystick1.button(3).onTrue(new Lancer(lanceur, accumulateur, force7));
 | 
					 | 
				
			||||||
    joystick1.button(5).whileTrue(accumulateurtest);
 | 
					 | 
				
			||||||
    joystick1.button(1).whileTrue(lancertest);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //touche
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    joystick1.button(3).whileTrue(accumulateurtest);
 | 
				
			||||||
 | 
					    joystick1.button(1).whileTrue(Force1);
 | 
				
			||||||
 | 
					    joystick1.button(7).whileTrue(Force2);
 | 
				
			||||||
 | 
					    joystick1.button(8).whileTrue(Force3);
 | 
				
			||||||
 | 
					    joystick1.button(9).whileTrue(Force4);
 | 
				
			||||||
 | 
					    joystick1.button(10).whileTrue(Force5);
 | 
				
			||||||
 | 
					    joystick1.button(11).whileTrue(Force6);
 | 
				
			||||||
 | 
					    joystick1.button(12).whileTrue(Force7);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
   public Command getAutonomousCommand() {
 | 
					   public Command getAutonomousCommand() {
 | 
				
			||||||
    return null;
 | 
					    return null;
 | 
				
			||||||
    /* new SequentialCommandGroup(new Avancer(drive), new Force7(lanceur, force7, accumulateur)
 | 
					    /* new SequentialCommandGroup(new Avancer(drive), new Force7(lanceur, force7, accumulateur)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package frc.robot.commands;
 | 
					package frc.robot.commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LancerTest extends CommandBase {
 | 
					public class Force1 extends CommandBase {
 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  /** Creates a new LancerTest. */
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  public LancerTest(Lanceur lanceur) {
 | 
					  public Force1(Lanceur lanceur, GenericEntry force1) {
 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
@@ -25,7 +26,7 @@ public class LancerTest extends CommandBase {
 | 
				
			|||||||
  // 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() {
 | 
				
			||||||
    lanceur.lancer(0.5);
 | 
					    lanceur.lancer(0.3);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called once the command ends or is interrupted.
 | 
					  // Called once the command ends or is interrupted.
 | 
				
			||||||
@@ -6,39 +6,27 @@ package frc.robot.commands;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force2 extends CommandBase {
 | 
					public class Force2 extends CommandBase {
 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force2;
 | 
					  public Force2(Lanceur lanceur, GenericEntry force2) {
 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force2(Lanceur lanceur,Accumulateur accumulateur, GenericEntry force2) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					 | 
				
			||||||
    this.force2 = force2;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0,0,0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
    double vitesse = (200);
 | 
					    lanceur.lancer(0.35);
 | 
				
			||||||
    lanceur.lancer(force2.getDouble(200));
 | 
					 | 
				
			||||||
    if (lanceur.vitesse() > vitesse ){
 | 
					 | 
				
			||||||
      accumulateur.tourneavant();
 | 
					 | 
				
			||||||
      accumulateur.tournearriere();
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        accumulateur.stop();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called once the command ends or is interrupted.
 | 
					  // Called once the command ends or is interrupted.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,54 +2,42 @@
 | 
				
			|||||||
// 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 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;
 | 
					package frc.robot.commands;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force3 extends CommandBase {
 | 
					public class Force3 extends CommandBase {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force3;
 | 
					  public Force3(Lanceur lanceur, GenericEntry force3) {
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force3(Lanceur lanceur,GenericEntry force3, Accumulateur accumulateur) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    this.force3 = force3; 
 | 
					 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0, 0, 0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
 | 
					    lanceur.lancer(0.4);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    double vitesse = (300);
 | 
					  // Called once the command ends or is interrupted.
 | 
				
			||||||
    lanceur.lancer(force3.getDouble(300));
 | 
					  @Override
 | 
				
			||||||
      if (lanceur.vitesse() > vitesse ){
 | 
					  public void end(boolean interrupted) {
 | 
				
			||||||
        accumulateur.tourneavant();
 | 
					    lanceur.lancer(0);
 | 
				
			||||||
        accumulateur.tournearriere();
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          accumulateur.stop();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public boolean isFinished() {
 | 
					  public boolean isFinished() {
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,59 +3,41 @@
 | 
				
			|||||||
// 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.commands;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force4 extends CommandBase {
 | 
					public class Force4 extends CommandBase {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force4;
 | 
					  public Force4(Lanceur lanceur, GenericEntry force4) {
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force4(Lanceur lanceur,GenericEntry force4, Accumulateur accumulateur) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    this.force4 = force4; 
 | 
					 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0, 0, 0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
    double vitesse = (400);
 | 
					    lanceur.lancer(0.45);
 | 
				
			||||||
      lanceur.lancer(force4.getDouble(400));
 | 
					 | 
				
			||||||
    if (lanceur.vitesse() > vitesse ){
 | 
					 | 
				
			||||||
      accumulateur.tourneavant();
 | 
					 | 
				
			||||||
      accumulateur.tournearriere();
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        accumulateur.stop();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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) {
 | 
				
			||||||
    lanceur.stop();
 | 
					    lanceur.lancer(0);
 | 
				
			||||||
    accumulateur.stop();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns true when the command should end.
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public boolean isFinished() {
 | 
					  public boolean isFinished() {
 | 
				
			||||||
    return lanceur.distance()>1;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -3,59 +3,41 @@
 | 
				
			|||||||
// 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.commands;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force5 extends CommandBase {
 | 
					public class Force5 extends CommandBase {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force5;
 | 
					  public Force5(Lanceur lanceur, GenericEntry force5) {
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force5(Lanceur lanceur,GenericEntry force5, Accumulateur accumulateur) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    this.force5 = force5; 
 | 
					 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0, 0, 0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
    double vitesse = (500);
 | 
					    lanceur.lancer(0.5);
 | 
				
			||||||
      lanceur.lancer(force5.getDouble(500));
 | 
					 | 
				
			||||||
    if (lanceur.vitesse() > vitesse ){
 | 
					 | 
				
			||||||
      accumulateur.tourneavant();
 | 
					 | 
				
			||||||
      accumulateur.tournearriere();
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        accumulateur.stop();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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) {
 | 
				
			||||||
    lanceur.stop();
 | 
					    lanceur.lancer(0);
 | 
				
			||||||
    accumulateur.stop();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns true when the command should end.
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public boolean isFinished() {
 | 
					  public boolean isFinished() {
 | 
				
			||||||
    return lanceur.distance()>1;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -3,58 +3,41 @@
 | 
				
			|||||||
// 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.commands;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force6 extends CommandBase {
 | 
					public class Force6 extends CommandBase {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force6;
 | 
					  public Force6(Lanceur lanceur, GenericEntry force6) {
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force6(Lanceur lanceur, GenericEntry force6, Accumulateur accumulateur) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    this.force6 = force6;
 | 
					 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0, 0, 0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
    double vitesse = (600);
 | 
					    lanceur.lancer(0.55);
 | 
				
			||||||
      lanceur.lancer(force6.getDouble(600));
 | 
					 | 
				
			||||||
    if (lanceur.vitesse() > vitesse ){
 | 
					 | 
				
			||||||
      accumulateur.tourneavant();
 | 
					 | 
				
			||||||
      accumulateur.tournearriere();
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        accumulateur.stop();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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) {
 | 
				
			||||||
    lanceur.stop();
 | 
					    lanceur.lancer(0);
 | 
				
			||||||
    accumulateur.stop();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns true when the command should end.
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public boolean isFinished() {
 | 
					  public boolean isFinished() {
 | 
				
			||||||
    return lanceur.distance()>1;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -3,56 +3,41 @@
 | 
				
			|||||||
// 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.commands;
 | 
				
			||||||
import frc.robot.subsystems.Accumulateur;
 | 
					
 | 
				
			||||||
import edu.wpi.first.networktables.GenericEntry;
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
					import edu.wpi.first.wpilibj2.command.CommandBase;
 | 
				
			||||||
import frc.robot.subsystems.Lanceur;
 | 
					import frc.robot.subsystems.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Force7 extends CommandBase {
 | 
					public class Force7 extends CommandBase {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  private Accumulateur accumulateur;
 | 
					  /** Creates a new LancerTest. */
 | 
				
			||||||
  GenericEntry force7;
 | 
					  public Force7(Lanceur lanceur, GenericEntry force7) {
 | 
				
			||||||
   
 | 
					 | 
				
			||||||
  /** Creates a new Force1. */
 | 
					 | 
				
			||||||
  public Force7(Lanceur lanceur,GenericEntry force7, Accumulateur accumulateur) {
 | 
					 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    addRequirements(lanceur, accumulateur);
 | 
					    addRequirements(lanceur);
 | 
				
			||||||
    this.force7 = force7; 
 | 
					 | 
				
			||||||
    this.accumulateur = accumulateur;
 | 
					 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public void initialize() {
 | 
					  public void initialize() {
 | 
				
			||||||
    lanceur.setPID(0, 0, 0);
 | 
					    lanceur.setPID(0.000000000000075572, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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() {
 | 
				
			||||||
    double vitesse = (700);
 | 
					    lanceur.lancer(0.6);
 | 
				
			||||||
      lanceur.lancer(force7.getDouble(700));
 | 
					 | 
				
			||||||
    if (lanceur.vitesse() > vitesse ){
 | 
					 | 
				
			||||||
      accumulateur.tourneavant();
 | 
					 | 
				
			||||||
      accumulateur.tournearriere();
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        accumulateur.stop();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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) {
 | 
				
			||||||
    lanceur.stop();
 | 
					    lanceur.lancer(0);
 | 
				
			||||||
    accumulateur.stop();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns true when the command should end.
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
  public boolean isFinished() {
 | 
					  public boolean isFinished() {
 | 
				
			||||||
    return lanceur.distance()>1;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user