mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
fix simulation auto
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
{
|
{
|
||||||
"System Joysticks": {
|
|
||||||
"window": {
|
|
||||||
"enabled": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"keyboardJoysticks": [
|
"keyboardJoysticks": [
|
||||||
{
|
{
|
||||||
"axisConfig": [
|
"axisConfig": [
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ public final class BuildConstants {
|
|||||||
public static final String MAVEN_GROUP = "";
|
public static final String MAVEN_GROUP = "";
|
||||||
public static final String MAVEN_NAME = "2026KPopRobotHunters";
|
public static final String MAVEN_NAME = "2026KPopRobotHunters";
|
||||||
public static final String VERSION = "unspecified";
|
public static final String VERSION = "unspecified";
|
||||||
public static final int GIT_REVISION = 156;
|
public static final int GIT_REVISION = 157;
|
||||||
public static final String GIT_SHA = "0d98232f30a0663939bef0d21533e1603090c7cd";
|
public static final String GIT_SHA = "2de8c605970a55114d3a66ebfb26160df3e0aa50";
|
||||||
public static final String GIT_DATE = "2026-03-12 18:13:33 MDT";
|
public static final String GIT_DATE = "2026-03-12 18:35:44 MDT";
|
||||||
public static final String GIT_BRANCH = "MiraOrg";
|
public static final String GIT_BRANCH = "MiraOrg";
|
||||||
public static final String BUILD_DATE = "2026-03-12 18:30:13 MDT";
|
public static final String BUILD_DATE = "2026-03-14 15:24:12 MDT";
|
||||||
public static final long BUILD_UNIX_TIME = 1773361813662L;
|
public static final long BUILD_UNIX_TIME = 1773523452704L;
|
||||||
public static final int DIRTY = 1;
|
public static final int DIRTY = 1;
|
||||||
|
|
||||||
private BuildConstants(){}
|
private BuildConstants(){}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import edu.wpi.first.math.geometry.Pose2d;
|
|||||||
import edu.wpi.first.math.geometry.Rotation2d;
|
import edu.wpi.first.math.geometry.Rotation2d;
|
||||||
import edu.wpi.first.math.geometry.Translation2d;
|
import edu.wpi.first.math.geometry.Translation2d;
|
||||||
import edu.wpi.first.math.kinematics.ChassisSpeeds;
|
import edu.wpi.first.math.kinematics.ChassisSpeeds;
|
||||||
|
import edu.wpi.first.wpilibj.DriverStation;
|
||||||
|
import edu.wpi.first.wpilibj.RobotBase;
|
||||||
import frc4388.robot.subsystems.vision.VisionIO.PoseObservation;
|
import frc4388.robot.subsystems.vision.VisionIO.PoseObservation;
|
||||||
|
|
||||||
public class SimpleSwerveSim implements SwerveIO {
|
public class SimpleSwerveSim implements SwerveIO {
|
||||||
@@ -100,9 +102,27 @@ public class SimpleSwerveSim implements SwerveIO {
|
|||||||
lastTimeNs = now;
|
lastTimeNs = now;
|
||||||
|
|
||||||
lastPose = pose;
|
lastPose = pose;
|
||||||
|
double dxField;
|
||||||
|
double dyField;
|
||||||
|
|
||||||
|
if (DriverStation.isAutonomous()) {
|
||||||
|
double dxRobot = vx * dt;
|
||||||
|
double dyRobot = vy * dt;
|
||||||
|
|
||||||
|
Rotation2d r = pose.getRotation();
|
||||||
|
double cos = r.getCos();
|
||||||
|
double sin = r.getSin();
|
||||||
|
|
||||||
|
dxField = dxRobot * cos - dyRobot * sin;
|
||||||
|
dyField = dxRobot * sin + dyRobot * cos;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dxField = vx * dt;
|
||||||
|
dyField = vy * dt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double dxField = vx * dt;
|
|
||||||
double dyField = vy * dt;
|
|
||||||
double dTheta = omega * dt;
|
double dTheta = omega * dt;
|
||||||
|
|
||||||
Translation2d newTrans = pose.getTranslation().plus(new Translation2d(dxField, dyField));
|
Translation2d newTrans = pose.getTranslation().plus(new Translation2d(dxField, dyField));
|
||||||
|
|||||||
Reference in New Issue
Block a user