Gyroscope

This commit is contained in:
2023-02-13 19:07:40 -05:00
parent ba6bcf1aac
commit 9d15b3410b
6 changed files with 56 additions and 2 deletions

View File

@ -4,6 +4,7 @@
package frc.robot.subsystems;
import com.kauailabs.navx.frc.AHRS;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
@ -25,8 +26,13 @@ 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();}
public void drive(double xSpeed, double zRotation){
public double getpitch() {
return gyroscope.getPitch();
}
public void drive(double xSpeed, double zRotation, int i){
drive.arcadeDrive(xSpeed, zRotation);
}
public double distance(){