Skip to content

Commit

Permalink
Merge pull request #224 from brandonzx3/dev
Browse files Browse the repository at this point in the history
Update the vision simulation on Vision#updatePoseEstimation
  • Loading branch information
thenetworkgrinch authored Aug 29, 2024
2 parents c7970ca + f2224bc commit b215996
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/frc/robot/subsystems/swervedrive/Vision.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,13 @@ public Vision(Supplier<Pose2d> currentPose, Field2d field)
*/
public void updatePoseEstimation(SwerveDrive swerveDrive)
{
for (EstimatedRobotPose i : getEstimatedGlobalPose())
{
swerveDrive.addVisionMeasurement(i.estimatedPose.toPose2d(), i.timestampSeconds);
}
ArrayList<EstimatedRobotPose> estimatedRobotPoses = getEstimatedGlobalPose();
if(Robot.isReal()) {
for (EstimatedRobotPose i : estimatedRobotPoses)
{
swerveDrive.addVisionMeasurement(i.estimatedPose.toPose2d(), i.timestampSeconds);
}
} else visionSim.update(swerveDrive.getPose());
}

/**
Expand Down

0 comments on commit b215996

Please sign in to comment.