Basepilotable gyroscope
This commit is contained in:
parent
7c3eb49b8b
commit
9bb20dfccd
@ -5,6 +5,7 @@
|
|||||||
package frc.robot.subsystems;
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||||
|
import com.kauailabs.navx.frc.AHRS;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
@ -23,8 +24,12 @@ private WPI_TalonSRX arriereDroit = new WPI_TalonSRX(Constants.MoteurArriereDroi
|
|||||||
|
|
||||||
private MecanumDrive mecanum = new MecanumDrive(avantGauche, arriereGauche, avantDroit, arriereDroit);
|
private MecanumDrive mecanum = new MecanumDrive(avantGauche, arriereGauche, avantDroit, arriereDroit);
|
||||||
|
|
||||||
private void drive(double y, double x, double rot){
|
private AHRS gyroscope = new AHRS();
|
||||||
mecanum.driveCartesian(y, x, rot, 0);
|
public double getangle() {
|
||||||
|
return gyroscope.getAngle();
|
||||||
|
}
|
||||||
|
public void drive(double y, double x, double rot){
|
||||||
|
mecanum.driveCartesian(y, x, rot, getangle());
|
||||||
}
|
}
|
||||||
/** Creates a new BasePilotable. */
|
/** Creates a new BasePilotable. */
|
||||||
public BasePilotable() {
|
public BasePilotable() {
|
||||||
@ -36,4 +41,5 @@ private void drive(double y, double x, double rot){
|
|||||||
public void periodic() {
|
public void periodic() {
|
||||||
// This method will be called once per scheduler run
|
// This method will be called once per scheduler run
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user