This commit is contained in:
Antoine PerreaultE 2023-02-13 19:19:52 -05:00
parent 862c449dc8
commit 3bd850a25e
2 changed files with 11 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
@ -24,7 +25,8 @@ public class BasePilotable extends SubsystemBase {
final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche);
final DifferentialDrive drive = new DifferentialDrive(gauche, droit);
private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();}
private DoubleSolenoid brakedroit = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakedroit, Constants.brakedroit);
private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche);
public double getpitch() {
return gyroscope.getPitch();
}
@ -44,7 +46,14 @@ public class BasePilotable extends SubsystemBase {
arrieredroit.getEncoder().setPosition(0);
arrieregauche.getEncoder().setPosition(0);
}
public void BrakeOuvre(){
brakedroit.set(Value.kForward);
brakegauche.set(Value.kForward);
}
public void BrakeFerme(){
brakedroit.set(Value.kReverse);
brakegauche.set(Value.kReverse);
}
/** Creates a new BasePilotable. */
public BasePilotable() {
droit.setInverted(true);