Skip to content

Commit

Permalink
Remove custom struct handling
Browse files Browse the repository at this point in the history
`SwerveModuleState` and `Trajectory` are included in WPILib 2024.1.1-beta-4
  • Loading branch information
jwbonner committed Dec 15, 2023
1 parent e575b87 commit c4ab50f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

package org.littletonrobotics.junction;

import edu.wpi.first.math.kinematics.SwerveModuleState;
import edu.wpi.first.math.proto.Trajectory;
import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d;
import edu.wpi.first.units.Measure;
import java.lang.reflect.Field;
Expand Down Expand Up @@ -329,13 +327,6 @@ private static void registerField(String key, Class<?> type, Supplier<?> supplie
if (value != null)
Logger.recordOutput(key, (String[]) value);
});
} else if (componentType.equals(SwerveModuleState.class)) {
callbacks.add(
() -> {
Object value = supplier.get();
if (value != null)
Logger.recordOutput(key, (SwerveModuleState[]) value);
});
} else {
callbacks.add(
() -> {
Expand Down Expand Up @@ -403,13 +394,6 @@ private static void registerField(String key, Class<?> type, Supplier<?> supplie
if (value != null)
Logger.recordOutput(key, (Measure<?>) value);
});
} else if (type.equals(Trajectory.class)) {
callbacks.add(
() -> {
Object value = supplier.get();
if (value != null)
Logger.recordOutput(key, (Trajectory) value);
});
} else if (type.equals(Mechanism2d.class)) {
callbacks.add(
() -> {
Expand Down

This file was deleted.

28 changes: 0 additions & 28 deletions junction/core/src/org/littletonrobotics/junction/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import edu.wpi.first.math.MathShared;
import edu.wpi.first.math.MathSharedStore;
import edu.wpi.first.math.MathUsageId;
import edu.wpi.first.math.kinematics.SwerveModuleState;
import edu.wpi.first.math.trajectory.Trajectory;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.wpilibj.DriverStation;
Expand Down Expand Up @@ -719,32 +717,6 @@ public static <T> void recordOutput(String key, T... value) {
}
}

/**
* Records a single output field for easy access when viewing the log. On the
* simulator, use this method to record extra data based on the original inputs.
*
* The trajectory is logged as a series of poses.
*
* @param key The name of the field to record. It will be stored under
* "/RealOutputs" or "/ReplayOutputs"
* @param value The value of the field.
*/
public static void recordOutput(String key, Trajectory value) {
recordOutput(key, Pose2d.struct, value.getStates().stream().map(state -> state.poseMeters).toArray(Pose2d[]::new));
}

/**
* Records a single output field for easy access when viewing the log. On the
* simulator, use this method to record extra data based on the original inputs.
*
* @param key The name of the field to record. It will be stored under
* "/RealOutputs" or "/ReplayOutputs"
* @param value The value of the field.
*/
public static void recordOutput(String key, SwerveModuleState... value) {
recordOutput(key, CustomStructs.swerveModuleState, value);
}

/**
* Records a single output field for easy access when viewing the log. On the
* simulator, use this method to record extra data based on the original inputs.
Expand Down

0 comments on commit c4ab50f

Please sign in to comment.