Compare commits
	
		
			2 Commits
		
	
	
		
			c81f118058
			...
			elevateur
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 36456f1fe4 | ||
|  | 0567735a6f | 
| @@ -1,41 +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.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 AlgueExpire extends Command { | ||||
|   private Pince pince; | ||||
|   /** Creates a new CoralAlgue. */ | ||||
|   public AlgueExpire(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.aspirealgue(0.5); | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   @Override | ||||
|   public void end(boolean interrupted) { | ||||
|     pince.aspirealgue(0);  | ||||
|   } | ||||
|  | ||||
|   // Returns true when the command should end. | ||||
|   @Override | ||||
|   public boolean isFinished() { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| @@ -1,49 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -1,41 +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.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 CoralExpire extends Command { | ||||
|   private Pince pince; | ||||
|   /** Creates a new CoralAlgue. */ | ||||
|   public CoralExpire(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); | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   @Override | ||||
|   public void end(boolean interrupted) { | ||||
|     pince.aspirecoral(0); | ||||
|   } | ||||
|  | ||||
|   // Returns true when the command should end. | ||||
|   @Override | ||||
|   public boolean isFinished() { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| @@ -1,46 +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.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 CoralInspire extends Command { | ||||
|   private Pince pince; | ||||
|   /** Creates a new CoralAlgue. */ | ||||
|   public CoralInspire(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.emperagecoral()>8){ | ||||
|     pince.aspirecoral(0);   | ||||
|     } | ||||
|     else{ | ||||
|       pince.aspirecoral(.5); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // Called once the command ends or is interrupted. | ||||
|   @Override | ||||
|   public void end(boolean interrupted) { | ||||
|     pince.aspirecoral(0); | ||||
|   } | ||||
|  | ||||
|   // Returns true when the command should end. | ||||
|   @Override | ||||
|   public boolean isFinished() { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| @@ -1,47 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -1,49 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -1,49 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -1,49 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -1,49 +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.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; | ||||
|   } | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
| // 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; | ||||
| package frc.robot.commands; | ||||
| 
 | ||||
| import edu.wpi.first.wpilibj2.command.Command; | ||||
| import frc.robot.subsystems.Elevateur; | ||||
| @@ -2,7 +2,7 @@ | ||||
| // 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; | ||||
| package frc.robot.commands; | ||||
| 
 | ||||
| import java.util.function.DoubleSupplier; | ||||
| 
 | ||||
| @@ -2,7 +2,7 @@ | ||||
| // 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; | ||||
| package frc.robot.commands; | ||||
| 
 | ||||
| import edu.wpi.first.wpilibj2.command.Command; | ||||
| import frc.robot.subsystems.Elevateur; | ||||
| @@ -2,7 +2,7 @@ | ||||
| // 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; | ||||
| package frc.robot.commands; | ||||
| 
 | ||||
| import edu.wpi.first.wpilibj2.command.Command; | ||||
| import frc.robot.subsystems.Elevateur; | ||||
| @@ -2,7 +2,7 @@ | ||||
| // 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; | ||||
| package frc.robot.commands; | ||||
| 
 | ||||
| import edu.wpi.first.wpilibj2.command.Command; | ||||
| import frc.robot.subsystems.Elevateur; | ||||
| @@ -11,7 +11,7 @@ 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 SparkMax  monte = new SparkMax(22, MotorType.kBrushless); | ||||
|   final DigitalInput limit2 = new DigitalInput(0); | ||||
|   public double position(){ | ||||
|     return monte.getEncoder().getPosition(); | ||||
|   | ||||
| @@ -1,50 +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.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