-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/frc/robot/localization/InterpolationData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.localization; | ||
|
||
import edu.wpi.first.math.geometry.Pose2d; | ||
import edu.wpi.first.math.geometry.Transform2d; | ||
|
||
public record InterpolationData( | ||
Pose2d measuredPose, Pose2d visionPose, Transform2d transform, String label) { | ||
public InterpolationData(Pose2d measuredPose, Pose2d visionPose, String label) { | ||
this(measuredPose, visionPose, new Transform2d(visionPose, measuredPose), label); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/frc/robot/localization/InterpolationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.localization; | ||
|
||
import edu.wpi.first.math.geometry.Pose2d; | ||
import java.util.List; | ||
|
||
public class InterpolationUtil { | ||
private static final InterpolationData SUBWOOFER = new InterpolationData(null, null, "Subwoofer"); | ||
private static final InterpolationData STAGE_FRONT = | ||
new InterpolationData(null, null, "StageFront"); | ||
private static final InterpolationData STAGE_RIGHT = | ||
new InterpolationData(null, null, "StageRight"); | ||
private static final InterpolationData STAGE_MIDDLE = | ||
new InterpolationData(null, null, "StageMiddle"); | ||
|
||
private static final List<InterpolationData> DATA_POINTS = | ||
List.of(SUBWOOFER, STAGE_FRONT, STAGE_RIGHT, STAGE_MIDDLE); | ||
|
||
public static Pose2d interpolatePose(Pose2d visionInput) { | ||
for (var dataPoint : DATA_POINTS) { | ||
double distancePoint = | ||
dataPoint.visionPose().getTranslation().getDistance(visionInput.getTranslation()); | ||
} | ||
|
||
return new Pose2d(); | ||
} | ||
} |