angle
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import com.ctre.phoenix6.SignalLogger;
|
||||
import com.ctre.phoenix6.Utils;
|
||||
import com.ctre.phoenix6.hardware.Pigeon2;
|
||||
import com.ctre.phoenix6.swerve.SwerveDrivetrainConstants;
|
||||
import com.ctre.phoenix6.swerve.SwerveModuleConstants;
|
||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||
@@ -42,6 +43,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
private static final double kSimLoopPeriod = 0.004; // 4 ms
|
||||
private Notifier m_simNotifier = null;
|
||||
private double m_lastSimTime;
|
||||
Pigeon2 pigeon2;
|
||||
|
||||
/* Blue alliance sees forward as 0 degrees (toward red alliance wall) */
|
||||
private static final Rotation2d kBlueAlliancePerspectiveRotation = Rotation2d.kZero;
|
||||
@@ -246,6 +248,13 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
if(pigeon2.getYaw().getValueAsDouble() > 360){
|
||||
pigeon2.setYaw(pigeon2.getYaw().getValueAsDouble()-360);
|
||||
}
|
||||
else if(pigeon2.getYaw().getValueAsDouble() < 0){
|
||||
pigeon2.setYaw(pigeon2.getYaw().getValueAsDouble()+360);
|
||||
}
|
||||
|
||||
/*
|
||||
* Periodically try to apply the operator perspective.
|
||||
* If we haven't applied the operator perspective before, then we should apply it regardless of DS state.
|
||||
|
||||
Reference in New Issue
Block a user