angle
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -56,5 +56,6 @@
|
|||||||
"edu.wpi.first.math.proto.*",
|
"edu.wpi.first.math.proto.*",
|
||||||
"edu.wpi.first.math.**.proto.*",
|
"edu.wpi.first.math.**.proto.*",
|
||||||
"edu.wpi.first.math.**.struct.*",
|
"edu.wpi.first.math.**.struct.*",
|
||||||
]
|
],
|
||||||
|
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
import com.ctre.phoenix6.SignalLogger;
|
import com.ctre.phoenix6.SignalLogger;
|
||||||
import com.ctre.phoenix6.Utils;
|
import com.ctre.phoenix6.Utils;
|
||||||
|
import com.ctre.phoenix6.hardware.Pigeon2;
|
||||||
import com.ctre.phoenix6.swerve.SwerveDrivetrainConstants;
|
import com.ctre.phoenix6.swerve.SwerveDrivetrainConstants;
|
||||||
import com.ctre.phoenix6.swerve.SwerveModuleConstants;
|
import com.ctre.phoenix6.swerve.SwerveModuleConstants;
|
||||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
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 static final double kSimLoopPeriod = 0.004; // 4 ms
|
||||||
private Notifier m_simNotifier = null;
|
private Notifier m_simNotifier = null;
|
||||||
private double m_lastSimTime;
|
private double m_lastSimTime;
|
||||||
|
Pigeon2 pigeon2;
|
||||||
|
|
||||||
/* Blue alliance sees forward as 0 degrees (toward red alliance wall) */
|
/* Blue alliance sees forward as 0 degrees (toward red alliance wall) */
|
||||||
private static final Rotation2d kBlueAlliancePerspectiveRotation = Rotation2d.kZero;
|
private static final Rotation2d kBlueAlliancePerspectiveRotation = Rotation2d.kZero;
|
||||||
@@ -246,6 +248,13 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
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.
|
* 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.
|
* 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