Merge branch 'main' of https://git.demerso.net/pls5618/2024/robot
This commit is contained in:
		@@ -45,8 +45,7 @@ public class Constants {
 | 
				
			|||||||
    // Limit switch
 | 
					    // Limit switch
 | 
				
			||||||
    public static int guideurhaut = 0;
 | 
					    public static int guideurhaut = 0;
 | 
				
			||||||
    public static int guideurbas = 1;
 | 
					    public static int guideurbas = 1;
 | 
				
			||||||
    public static int limitacc = 2;
 | 
					    public static int photocellacc = 2;
 | 
				
			||||||
    public static int limitacc2 = 3;
 | 
					 | 
				
			||||||
    public static int limithaut = 4;
 | 
					    public static int limithaut = 4;
 | 
				
			||||||
    public static int limitbas = 5;
 | 
					    public static int limitbas = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,7 @@ import frc.robot.subsystem.Grimpeur;
 | 
				
			|||||||
import frc.robot.subsystem.Guideur;
 | 
					import frc.robot.subsystem.Guideur;
 | 
				
			||||||
import frc.robot.subsystem.LED;
 | 
					import frc.robot.subsystem.LED;
 | 
				
			||||||
import frc.robot.subsystem.Lanceur;
 | 
					import frc.robot.subsystem.Lanceur;
 | 
				
			||||||
 | 
					import frc.robot.subsystem.Limelight;
 | 
				
			||||||
import frc.robot.subsystem.Pixy;
 | 
					import frc.robot.subsystem.Pixy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,11 +52,13 @@ public class RobotContainer {
 | 
				
			|||||||
  Balayer balayer = new Balayer(balayeuse, accumulateur);
 | 
					  Balayer balayer = new Balayer(balayeuse, accumulateur);
 | 
				
			||||||
  GuiderHaut guiderHaut = new GuiderHaut(guideur);
 | 
					  GuiderHaut guiderHaut = new GuiderHaut(guideur);
 | 
				
			||||||
  GuiderBas guiderBas = new GuiderBas(guideur);
 | 
					  GuiderBas guiderBas = new GuiderBas(guideur);
 | 
				
			||||||
  Lancer lancer = new Lancer(lanceur);
 | 
					  Limelight limelight = new Limelight();
 | 
				
			||||||
 | 
					  Lancer lancer = new Lancer(lanceur,limelight);
 | 
				
			||||||
  LancerNote lancernote = new LancerNote(lanceur, accumulateur);
 | 
					  LancerNote lancernote = new LancerNote(lanceur, accumulateur);
 | 
				
			||||||
  Lancerampli lancerampli = new Lancerampli(lanceur);
 | 
					  Lancerampli lancerampli = new Lancerampli(lanceur,limelight);
 | 
				
			||||||
   CommandJoystick joystick = new CommandJoystick(0);
 | 
					   CommandJoystick joystick = new CommandJoystick(0);
 | 
				
			||||||
   CommandXboxController manette = new CommandXboxController(1);
 | 
					   CommandXboxController manette = new CommandXboxController(1);
 | 
				
			||||||
 | 
					   //command
 | 
				
			||||||
   GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX);
 | 
					   GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX);
 | 
				
			||||||
  GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY);
 | 
					  GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY);
 | 
				
			||||||
  LED LED = new LED();
 | 
					  LED LED = new LED();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,14 +9,17 @@ package frc.robot.command;
 | 
				
			|||||||
import edu.wpi.first.wpilibj2.command.Command;
 | 
					import edu.wpi.first.wpilibj2.command.Command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import frc.robot.subsystem.Lanceur;
 | 
					import frc.robot.subsystem.Lanceur;
 | 
				
			||||||
 | 
					import frc.robot.subsystem.Limelight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Lancer extends Command {
 | 
					public class Lancer extends Command {
 | 
				
			||||||
  /** Creates a new Lanceur. */
 | 
					  /** Creates a new Lanceur. */
 | 
				
			||||||
 | 
					  private Limelight limelight;
 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  public Lancer(Lanceur lanceur) {
 | 
					  public Lancer(Lanceur lanceur,Limelight limelight) {
 | 
				
			||||||
 | 
					    this.limelight = limelight;
 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
    addRequirements(lanceur);
 | 
					    addRequirements(lanceur,limelight);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called when the command is initially scheduled.
 | 
					  // Called when the command is initially scheduled.
 | 
				
			||||||
@@ -26,7 +29,9 @@ 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() {
 | 
				
			||||||
 | 
					    if(limelight.getv()){
 | 
				
			||||||
    lanceur.lancerspeaker();
 | 
					    lanceur.lancerspeaker();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called once the command ends or is interrupted.
 | 
					  // Called once the command ends or is interrupted.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,15 +9,16 @@ package frc.robot.command;
 | 
				
			|||||||
import edu.wpi.first.wpilibj2.command.Command;
 | 
					import edu.wpi.first.wpilibj2.command.Command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import frc.robot.subsystem.Lanceur;
 | 
					import frc.robot.subsystem.Lanceur;
 | 
				
			||||||
 | 
					import frc.robot.subsystem.Limelight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Lancerampli extends Command {
 | 
					public class Lancerampli extends Command {
 | 
				
			||||||
  /** Creates a new Lanceur. */
 | 
					  /** Creates a new Lanceur. */
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private Lanceur lanceur;
 | 
					  private Lanceur lanceur;
 | 
				
			||||||
  
 | 
					  private Limelight limelight;
 | 
				
			||||||
  public Lancerampli(Lanceur lanceur) {
 | 
					  public Lancerampli(Lanceur lanceur,Limelight limelight) {
 | 
				
			||||||
    // Use addRequirements() here to declare subsystem dependencies.
 | 
					    // Use addRequirements() here to declare subsystem dependencies.
 | 
				
			||||||
    addRequirements(lanceur);
 | 
					    addRequirements(lanceur, limelight);
 | 
				
			||||||
 | 
					    this.limelight = limelight;
 | 
				
			||||||
    this.lanceur = lanceur;
 | 
					    this.lanceur = lanceur;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -28,7 +29,10 @@ public class Lancerampli 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() {
 | 
				
			||||||
    lanceur.lanceramp();
 | 
					    if(limelight.getv()){
 | 
				
			||||||
 | 
					      lanceur.lanceramp();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Called once the command ends or is interrupted.
 | 
					  // Called once the command ends or is interrupted.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ public class Accumulateur extends SubsystemBase {
 | 
				
			|||||||
         .getEntry(); 
 | 
					         .getEntry(); 
 | 
				
			||||||
  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 photocellacc = new DigitalInput(Constants.photocellacc);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  public void Deaccumuler(double vitesse){  
 | 
					  public void Deaccumuler(double vitesse){  
 | 
				
			||||||
    Moteuracc2.set(vitesse);
 | 
					    Moteuracc2.set(vitesse);
 | 
				
			||||||
@@ -34,7 +34,7 @@ public class Accumulateur extends SubsystemBase {
 | 
				
			|||||||
    Moteuracc.setInverted(true);
 | 
					    Moteuracc.setInverted(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  public boolean limitswitch(){
 | 
					  public boolean limitswitch(){
 | 
				
			||||||
    return limitacc.get();
 | 
					    return photocellacc.get();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  public Accumulateur() {
 | 
					  public Accumulateur() {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,9 +8,12 @@ import com.kauailabs.navx.frc.AHRS;
 | 
				
			|||||||
import com.revrobotics.CANSparkMax;
 | 
					import com.revrobotics.CANSparkMax;
 | 
				
			||||||
import com.revrobotics.CANSparkLowLevel.MotorType;
 | 
					import com.revrobotics.CANSparkLowLevel.MotorType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import edu.wpi.first.networktables.GenericEntry;
 | 
				
			||||||
import edu.wpi.first.wpilibj.DigitalInput;
 | 
					import edu.wpi.first.wpilibj.DigitalInput;
 | 
				
			||||||
import edu.wpi.first.wpilibj.DoubleSolenoid;
 | 
					import edu.wpi.first.wpilibj.DoubleSolenoid;
 | 
				
			||||||
import edu.wpi.first.wpilibj.PneumaticsModuleType;
 | 
					import edu.wpi.first.wpilibj.PneumaticsModuleType;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
 | 
				
			||||||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
 | 
					import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
					import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
				
			||||||
import frc.robot.Constants;
 | 
					import frc.robot.Constants;
 | 
				
			||||||
@@ -18,7 +21,8 @@ import frc.robot.Constants;
 | 
				
			|||||||
public class Grimpeur extends SubsystemBase {
 | 
					public class Grimpeur extends SubsystemBase {
 | 
				
			||||||
  /** Creates a new Acrocheur. */
 | 
					  /** Creates a new Acrocheur. */
 | 
				
			||||||
  // moteur
 | 
					  // moteur
 | 
				
			||||||
  public Grimpeur() {}
 | 
					  
 | 
				
			||||||
 | 
					  ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
 | 
				
			||||||
  final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless);
 | 
					  final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless);
 | 
				
			||||||
  final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless); 
 | 
					  final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless); 
 | 
				
			||||||
  // limit switch
 | 
					  // limit switch
 | 
				
			||||||
@@ -27,6 +31,23 @@ public class Grimpeur extends SubsystemBase {
 | 
				
			|||||||
  final DoubleSolenoid pistondroite= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre, Constants.pistondroiteouvre);
 | 
					  final DoubleSolenoid pistondroite= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre, Constants.pistondroiteouvre);
 | 
				
			||||||
  final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
 | 
					  final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
 | 
				
			||||||
  //fonction
 | 
					  //fonction
 | 
				
			||||||
 | 
					  public Grimpeur() {
 | 
				
			||||||
 | 
					    dashboard.add("limitgrimpeurd", droite())
 | 
				
			||||||
 | 
					    .withSize(1, 1)
 | 
				
			||||||
 | 
					    .withPosition(1, 5);
 | 
				
			||||||
 | 
					    dashboard.add("limitgrimpeurd", droite())
 | 
				
			||||||
 | 
					    .withSize(1, 1)
 | 
				
			||||||
 | 
					    .withPosition(1, 4);
 | 
				
			||||||
 | 
					    dashboard.add("grimpeurencodeurd", encoderd())
 | 
				
			||||||
 | 
					    .withSize(1, 1)
 | 
				
			||||||
 | 
					    .withPosition(1, 3);
 | 
				
			||||||
 | 
					    dashboard.add("grimpeurencodeurg", encoderg())
 | 
				
			||||||
 | 
					    .withSize(1, 1)
 | 
				
			||||||
 | 
					    .withPosition(1, 2);
 | 
				
			||||||
 | 
					    dashboard.add("pitchgyrogrimpeur", getpitch())
 | 
				
			||||||
 | 
					    .withSize(1, 1)
 | 
				
			||||||
 | 
					    .withPosition(1, 1);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
public void droit(double vitesse){
 | 
					public void droit(double vitesse){
 | 
				
			||||||
  grimpeurd.set(vitesse);
 | 
					  grimpeurd.set(vitesse);
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,17 +7,22 @@ package frc.robot.subsystem;
 | 
				
			|||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
 | 
					import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import edu.wpi.first.wpilibj.DigitalInput;
 | 
					import edu.wpi.first.wpilibj.DigitalInput;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
 | 
				
			||||||
 | 
					import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
 | 
				
			||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
					import edu.wpi.first.wpilibj2.command.SubsystemBase;
 | 
				
			||||||
import frc.robot.Constants;
 | 
					import frc.robot.Constants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Guideur extends SubsystemBase {
 | 
					public class Guideur extends SubsystemBase {
 | 
				
			||||||
  /** Creates a new Guideur. */
 | 
					  /** Creates a new Guideur. */
 | 
				
			||||||
  public Guideur() {}
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					    ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
 | 
				
			||||||
    final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur);
 | 
					    final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur);
 | 
				
			||||||
    final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut);
 | 
					    final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut);
 | 
				
			||||||
    final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas);
 | 
					    final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas);
 | 
				
			||||||
 | 
					      public Guideur() {
 | 
				
			||||||
 | 
					        dashboard.add("limitguideurhaut", haut());
 | 
				
			||||||
 | 
					        dashboard.add("limitguideurbas", bas());
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      public void guider(double vitesse){
 | 
					      public void guider(double vitesse){
 | 
				
			||||||
        guideur.set(vitesse);
 | 
					        guideur.set(vitesse);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user