Skip to content
Merged
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
6 changes: 5 additions & 1 deletion src/main/java/com/team2813/subsystems/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public class Drive extends SubsystemBase implements AutoCloseable {
private final DoubleArrayPublisher modulePositionsPublisher;
private final DoublePublisher ambiguityPublisher =
NetworkTableInstance.getDefault().getDoubleTopic("Ambiguity").publish();
private final StructPublisher<Rotation3d> anglePublisher;

/** This measurement is <em>IN INCHES</em> */
private static final double WHEEL_RADIUS_IN = 1.537;
Expand Down Expand Up @@ -330,6 +331,7 @@ public Drive(
networkTable.getStructArrayTopic("actual state", SwerveModuleState.struct).publish();
currentPosePublisher = networkTable.getStructTopic("current pose", Pose2d.struct).publish();
modulePositionsPublisher = networkTable.getDoubleArrayTopic("module positions").publish();
anglePublisher = networkTable.getStructTopic("pigeon angle", Rotation3d.struct).publish();

setDefaultCommand(createDefaultCommand());

Expand Down Expand Up @@ -534,9 +536,11 @@ public void periodic() {
// Publish data to NetworkTables
expectedStatePublisher.set(drivetrain.getState().ModuleTargets);
actualStatePublisher.set(drivetrain.getState().ModuleStates);
Rotation3d rotation = getRotation3d();
if (config.usePnpDistanceTrigSolveStrategy) {
photonPoseEstimator.addHeadingData(Timer.getTimestamp(), getRotation3d());
photonPoseEstimator.addHeadingData(Timer.getTimestamp(), rotation);
}
anglePublisher.set(rotation);
photonPoseEstimator.update(this::handlePhotonPose);
Pose2d drivePose = getPose();
currentPosePublisher.set(drivePose);
Expand Down