Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�5cotl4u46bgtxgg5b27ftytpuy����X-��ʏ��y+.��instrumentedOutput�[\Q�8��)8�U�metadataDir�)C��e9=�*�s@���propertyUpgradeReportOutput���y�ޜ3�&���;��
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�5cotl4u46bgtxgg5b27ftytpuy~G`*:*� ���-���instrumentedOutput�̑�ӣzI)t-j5�metadataDir�)C��e9=�*�s@���propertyUpgradeReportOutput���y�ޜ3�&���;��
Binary file not shown.
Binary file added .gradle-user-home/caches/8.11/md-rule/md-rule.lock
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions .gradle-user-home/caches/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by Gradle.
# For information about cache directory tags, see:
# https://bford.info/cachedir/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .gradle-user-home/caches/jars-9/jars-9.lock
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle-user-home/caches/journal-1/file-access.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Wed Mar 25 22:19:18 EDT 2026
inceptionTimestamp=1774491558414
Binary file added .gradle-user-home/caches/journal-1/journal-1.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .gradle-user-home/caches/modules-2/modules-2.lock
Binary file not shown.
Binary file added .gradle-user-home/daemon/8.11/registry.bin
Binary file not shown.
Binary file added .gradle-user-home/daemon/8.11/registry.bin.lock
Binary file not shown.
4 changes: 4 additions & 0 deletions .gradle-user-home/daemon/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by Gradle.
# For information about cache directory tags, see:
# https://bford.info/cachedir/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
5 changes: 5 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,10 @@
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard0"
}
]
}
115 changes: 115 additions & 0 deletions src/main/deploy/autos/paths/Middle_to_depot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"path_elements": [
{
"type": "waypoint",
"translation_target": {
"x_meters": 13.361426533523543,
"y_meters": 2.6083523537803153,
"intermediate_handoff_radius_meters": 0.25
},
"rotation_target": {
"rotation_radians": 3.141592653589793,
"profiled_rotation": true
}
},
{
"type": "event_trigger",
"t_ratio": 0.0,
"lib_key": "intake"
},
{
"type": "rotation",
"rotation_radians": 0.0,
"t_ratio": 0.46635262064706745,
"profiled_rotation": true
},
{
"type": "waypoint",
"translation_target": {
"x_meters": 15.087902995720405,
"y_meters": 2.4117459175884877,
"intermediate_handoff_radius_meters": 0.25
},
"rotation_target": {
"rotation_radians": 0.0,
"profiled_rotation": true
}
},
{
"type": "event_trigger",
"t_ratio": 0.0,
"lib_key": "deploy"
},
{
"type": "waypoint",
"translation_target": {
"x_meters": 15.829598984635563,
"y_meters": 2.399,
"intermediate_handoff_radius_meters": 0.1
},
"rotation_target": {
"rotation_radians": 0.0,
"profiled_rotation": true
}
},
{
"type": "translation",
"x_meters": 14.757243618343884,
"y_meters": 1.7609543509272472,
"intermediate_handoff_radius_meters": 0.25
},
{
"type": "waypoint",
"translation_target": {
"x_meters": 15.83,
"y_meters": 1.6514122681883032,
"intermediate_handoff_radius_meters": 0.1
},
"rotation_target": {
"rotation_radians": 0.0,
"profiled_rotation": true
}
},
{
"type": "waypoint",
"translation_target": {
"x_meters": 14.319480741797435,
"y_meters": 2.5342906939501617,
"intermediate_handoff_radius_meters": 0.25
},
"rotation_target": {
"rotation_radians": 0.0,
"profiled_rotation": true
}
}
],
"constraints": {
"max_velocity_meters_per_sec": [
{
"value": 1.65,
"start_ordinal": 0,
"end_ordinal": 1
},
{
"value": 0.75,
"start_ordinal": 2,
"end_ordinal": 2
},
{
"value": 1.35,
"start_ordinal": 3,
"end_ordinal": 3
},
{
"value": 0.75,
"start_ordinal": 4,
"end_ordinal": 4
},
{
"value": 1.25,
"start_ordinal": 5,
"end_ordinal": 5
}
]
}
}
12 changes: 12 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import frc.robot.constants.FieldConstants;
import frc.robot.lib.BLine.FollowPath;
import frc.robot.lib.util.PhoenixUtil;
import frc.robot.sim.MapleSimManager;

/**
* The VM is configured to automatically run this class, and to call the
Expand Down Expand Up @@ -258,10 +259,21 @@ public void testPeriodic() {
/** This function is called once when the robot is first started up. */
@Override
public void simulationInit() {
if (shouldUseMapleSimulation()) {
MapleSimManager.getInstance().resetFieldForAuto();
}
}

/** This function is called periodically whilst in simulation. */
@Override
public void simulationPeriodic() {
if (shouldUseMapleSimulation()) {
MapleSimManager.getInstance().simulationPeriodic();
}
}

private boolean shouldUseMapleSimulation() {
return Constants.shouldUseSimulation(Constants.SimOnlySubsystems.SWERVE)
|| Constants.shouldUseSimulation(Constants.SimOnlySubsystems.VISION);
}
}
31 changes: 19 additions & 12 deletions src/main/java/frc/robot/RobotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import frc.robot.configs.RobotStateConfig;
import frc.robot.configs.SwerveConfig;
import frc.robot.configs.SwerveDrivetrainConfig;
import frc.robot.constants.Constants;
import frc.robot.lib.util.ConfigLoader;
import frc.robot.sim.MapleSimManager;
import frc.robot.subsystems.swerve.SwerveDrive;

import java.util.NoSuchElementException;
import org.littletonrobotics.junction.AutoLogOutput;
import org.littletonrobotics.junction.Logger;

Expand Down Expand Up @@ -116,6 +117,10 @@ private RobotState() {

/** Add odometry observation */
public void addOdometryObservation(OdometryObservation observation) {
if (!Double.isFinite(observation.timestampsSeconds()) || !Double.isFinite(observation.yawVelocityRadPerSec())) {
return;
}

observation = new OdometryObservation(
observation.timestampsSeconds(),
observation.isGyroConnected(),
Expand Down Expand Up @@ -188,19 +193,17 @@ public void addOdometryObservation(OdometryObservation observation) {
}

public void addVisionObservation(VisionObservation observation) {
if (!Double.isFinite(observation.timestampSeconds())
|| !Double.isFinite(observation.visionRobotPoseMeters().getX())
|| !Double.isFinite(observation.visionRobotPoseMeters().getY())) {
return;
}

boolean shouldLogObservation = shouldLogVisionObservation();
// If measurement is old enough to be outside the pose buffer's timespan, skip.
try {
if (poseBuffer.getInternalBuffer().lastKey() - robotStateConfig.poseBufferSizeSeconds > observation.timestampSeconds()) {
incrementVisionRejectedCount();
if (shouldLogObservation) {
logVisionObservationMetrics(null, observation.timestampSeconds(), false);
}
return;
}
}

catch (NoSuchElementException ex) {
var internalBuffer = poseBuffer.getInternalBuffer();
if (internalBuffer.isEmpty()
|| internalBuffer.lastKey() - robotStateConfig.poseBufferSizeSeconds > observation.timestampSeconds()) {
incrementVisionRejectedCount();
if (shouldLogObservation) {
logVisionObservationMetrics(null, observation.timestampSeconds(), false);
Expand Down Expand Up @@ -239,6 +242,10 @@ public void addVisionObservation(VisionObservation observation) {
*/
public void resetPose(Pose2d initialPose) {
SwerveDrive.getInstance().resetGyro(initialPose.getRotation());
if (Constants.shouldUseSimulation(Constants.SimOnlySubsystems.SWERVE)
&& Constants.currentMode != Constants.Mode.REPLAY) {
MapleSimManager.getInstance().resetRobotPose(initialPose);
}
swerveDrivePoseEstimator.resetPosition(initialPose.getRotation(), lastWheelPositions, initialPose);
accumulatedYawRad = initialPose.getRotation().getRadians();
lastWrappedYawRad = initialPose.getRotation().getRadians();
Expand Down
Loading