s
This commit is contained in:
parent
108f73436b
commit
f86be6301c
@ -10,14 +10,12 @@ import com.revrobotics.CANSparkLowLevel.MotorType;
|
|||||||
|
|
||||||
import edu.wpi.first.networktables.GenericEntry;
|
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.PneumaticsModuleType;
|
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
||||||
import edu.wpi.first.wpilibj.Solenoid;
|
import edu.wpi.first.wpilibj.Solenoid;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
|
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.wpilibj.shuffleboard.BuiltInLayouts;
|
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
|
||||||
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;
|
||||||
|
|
||||||
@ -33,14 +31,11 @@ public class Grimpeur extends SubsystemBase {
|
|||||||
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
|
||||||
final DigitalInput limitdroite = new DigitalInput(Constants.limithaut);
|
|
||||||
final DigitalInput limitgauche = new DigitalInput(Constants.limitbas);
|
|
||||||
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre);
|
final Solenoid pistondroite= new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondroiteouvre);
|
||||||
final Solenoid pistondgauche = new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre);
|
final Solenoid pistondgauche = new Solenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre);
|
||||||
//fonction
|
//fonction
|
||||||
public Grimpeur() {
|
public Grimpeur() {
|
||||||
layout.addBoolean("limitgrimpeurd", limitdroite::get);
|
|
||||||
layout.addBoolean("limitgrimpeurg", limitdroite::get);
|
|
||||||
layout.add("grimpeurencodeurd", encoderd());
|
layout.add("grimpeurencodeurd", encoderd());
|
||||||
layout.add("grimpeurencodeurg", encoderg());
|
layout.add("grimpeurencodeurg", encoderg());
|
||||||
layout.add("pitchgyrogrimpeur", getpitch());
|
layout.add("pitchgyrogrimpeur", getpitch());
|
||||||
@ -51,12 +46,6 @@ public void droit(double vitesse){
|
|||||||
public void gauche(double vitesse){
|
public void gauche(double vitesse){
|
||||||
grimpeurg.set(vitesse);
|
grimpeurg.set(vitesse);
|
||||||
}
|
}
|
||||||
public boolean droite(){
|
|
||||||
return limitdroite.get();
|
|
||||||
}
|
|
||||||
public boolean gauche(){
|
|
||||||
return limitgauche.get();
|
|
||||||
}
|
|
||||||
public void resetencodeurd(){
|
public void resetencodeurd(){
|
||||||
grimpeurd.getEncoder().setPosition(0);
|
grimpeurd.getEncoder().setPosition(0);
|
||||||
}
|
}
|
||||||
@ -84,14 +73,5 @@ public AHRS gyroscope = new AHRS();
|
|||||||
public boolean piston(){
|
public boolean piston(){
|
||||||
return pistondgauche.get();
|
return pistondgauche.get();
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void periodic() {
|
|
||||||
// This method will be called once per scheduler run
|
|
||||||
if(droite()) {
|
|
||||||
resetencodeurd();
|
|
||||||
}
|
|
||||||
if(gauche()) {
|
|
||||||
resetencodeurg();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user