This commit is contained in:
EdwardFaucher
2023-02-15 18:11:56 -05:00
14 changed files with 290 additions and 30 deletions

View File

@ -4,11 +4,12 @@
package frc.robot.subsystems;
import com.kauailabs.navx.frc.AHRS;
import com.revrobotics.CANSparkMax;
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;
@ -22,10 +23,16 @@ public class BasePilotable extends SubsystemBase {
final MotorControllerGroup droit = new MotorControllerGroup(avantdroit, arrieredroit);
final MotorControllerGroup gauche = new MotorControllerGroup(avantgauche, arrieregauche);
final DifferentialDrive drive = new DifferentialDrive(gauche, droit);
final DoubleSolenoid brakedroit = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.pistonpinceouvre, Constants.pistonpinceferme);
final DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.pistonpinceouvre, Constants.pistonpinceferme);
public void drive(double xSpeed, double zRotation){
//piston
private DoubleSolenoid brakedroit = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakedroit, Constants.brakedroit);
private DoubleSolenoid brakegauche = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakegauche, Constants.brakegauche);
//gyro
private AHRS gyroscope = new AHRS();public double getangle() {return gyroscope.getAngle();}
public double getpitch() {
return gyroscope.getPitch();
}
public void drive(double xSpeed, double zRotation, int i){
drive.arcadeDrive(xSpeed, zRotation);
}
public double distance(){
@ -40,7 +47,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);

View File

@ -9,8 +9,6 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import edu.wpi.first.wpilibj.DigitalInput;
import frc.robot.Constants;
public class Gratte extends SubsystemBase {
private WPI_TalonSRX Gratted = new WPI_TalonSRX(Constants.leverGratte);
private WPI_TalonSRX Gratteg = new WPI_TalonSRX(Constants.baisserGratte);