Lancer
This commit is contained in:
		@@ -4,12 +4,22 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package frc.robot.command;
 | 
					package frc.robot.command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.revrobotics.CANSparkMax;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.Command;
 | 
					import edu.wpi.first.wpilibj2.command.Command;
 | 
				
			||||||
 | 
					import frc.robot.subsystem.Accumulateur;
 | 
				
			||||||
 | 
					import frc.robot.subsystem.Lanceur;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Lancer extends Command {
 | 
					public class Lancer extends Command {
 | 
				
			||||||
  /** Creates a new Lanceur. */
 | 
					  /** Creates a new Lanceur. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private Lanceur lancer;
 | 
				
			||||||
 | 
					  private Lanceur lancer2;
 | 
				
			||||||
 | 
					  private Lanceur lancer3;
 | 
				
			||||||
 | 
					  private Lanceur lancer4;
 | 
				
			||||||
  public Lancer() {
 | 
					  public Lancer() {
 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
 | 
					    addRequirements(lancer,lancer2,lancer3,lancer4);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
@@ -18,11 +28,15 @@ public class Lancer 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() {
 | 
				
			||||||
 | 
					    lancer.lancer(0.3);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // 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) {
 | 
				
			||||||
 | 
					    lancer.lancer(0);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns true when the command should end.
 | 
					  // Returns true when the command should end.
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,14 +9,18 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
 | 
				
			|||||||
import edu.wpi.first.wpilibj.DigitalInput;
 | 
					import edu.wpi.first.wpilibj.DigitalInput;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
					import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
				
			||||||
import frc.robot.Constants;
 | 
					import frc.robot.Constants;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Accumulateur extends SubsystemBase {
 | 
					public class Accumulateur extends SubsystemBase {
 | 
				
			||||||
  /** Creates a new Accumulateur. */
 | 
					  /** Creates a new Accumulateur. */
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 | 
					  ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); 
 | 
				
			||||||
  final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2);
 | 
					  final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2);
 | 
				
			||||||
  final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc);
 | 
					  final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc);
 | 
				
			||||||
  final DigitalInput limitacc = new DigitalInput(Constants.limitacc);
 | 
					  final DigitalInput limitacc = new DigitalInput(Constants.limitacc);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  public void Deaccumuler(double vitesse){  
 | 
					  public void Deaccumuler(double vitesse){  
 | 
				
			||||||
    Moteuracc2.set(vitesse);
 | 
					    Moteuracc2.set(vitesse);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -27,7 +31,9 @@ public class Accumulateur extends SubsystemBase {
 | 
				
			|||||||
  public boolean limitswitch(){
 | 
					  public boolean limitswitch(){
 | 
				
			||||||
    return limitacc.get();
 | 
					    return limitacc.get();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  public Accumulateur() {}
 | 
					  public Accumulateur() {
 | 
				
			||||||
 | 
					    dashboard.addBoolean("limitacc", this::limitswitch);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  public void Accumuler(double vitesse){
 | 
					  public void Accumuler(double vitesse){
 | 
				
			||||||
    Moteuracc.set(vitesse);
 | 
					    Moteuracc.set(vitesse);
 | 
				
			||||||
    Moteuracc2.set(vitesse);
 | 
					    Moteuracc2.set(vitesse);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,8 @@ public class Lanceur extends SubsystemBase {
 | 
				
			|||||||
  public Lanceur() {}
 | 
					  public Lanceur() {}
 | 
				
			||||||
  final CANSparkMax lancer = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
 | 
					  final CANSparkMax lancer = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
 | 
				
			||||||
  final CANSparkMax lancer2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless);
 | 
					  final CANSparkMax lancer2 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless);
 | 
				
			||||||
  final CANSparkMax lancer3 = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);
 | 
					  final CANSparkMax lancer3 = new CANSparkMax(Constants.lancer3, MotorType.kBrushless);
 | 
				
			||||||
  final CANSparkMax lancer4 = new CANSparkMax(Constants.lancer2, MotorType.kBrushless);
 | 
					  final CANSparkMax lancer4 = new CANSparkMax(Constants.lancer4, MotorType.kBrushless);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public void lancer(double vitesse){
 | 
					  public void lancer(double vitesse){
 | 
				
			||||||
    lancer.set(vitesse);
 | 
					    lancer.set(vitesse);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user