Skip to content

Commit cefaa31

Browse files
authored
Add an overload of resetHeadingData() which takes in a Rotation3d (#2013)
1 parent 4b5bc6a commit cefaa31

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public void setLastPose(Pose2d lastPose) {
316316
* Add robot heading data to buffer. Must be called periodically for the
317317
* <b>PNP_DISTANCE_TRIG_SOLVE</b> strategy.
318318
*
319-
* @param timestampSeconds timestamp of the robot heading data.
319+
* @param timestampSeconds Timestamp of the robot heading data.
320320
* @param heading Field-relative robot heading at given timestamp. Standard WPILIB field
321321
* coordinates.
322322
*/
@@ -328,7 +328,7 @@ public void addHeadingData(double timestampSeconds, Rotation3d heading) {
328328
* Add robot heading data to buffer. Must be called periodically for the
329329
* <b>PNP_DISTANCE_TRIG_SOLVE</b> strategy.
330330
*
331-
* @param timestampSeconds timestamp of the robot heading data.
331+
* @param timestampSeconds Timestamp of the robot heading data.
332332
* @param heading Field-relative robot heading at given timestamp. Standard WPILIB field
333333
* coordinates.
334334
*/
@@ -340,7 +340,20 @@ public void addHeadingData(double timestampSeconds, Rotation2d heading) {
340340
* Clears all heading data in the buffer, and adds a new seed. Useful for preventing estimates
341341
* from utilizing heading data provided prior to a pose or rotation reset.
342342
*
343-
* @param timestampSeconds timestamp of the robot heading data.
343+
* @param timestampSeconds Timestamp of the robot heading data.
344+
* @param heading Field-relative robot heading at given timestamp. Standard WPILIB field
345+
* coordinates.
346+
*/
347+
public void resetHeadingData(double timestampSeconds, Rotation3d heading) {
348+
headingBuffer.clear();
349+
addHeadingData(timestampSeconds, heading);
350+
}
351+
352+
/**
353+
* Clears all heading data in the buffer, and adds a new seed. Useful for preventing estimates
354+
* from utilizing heading data provided prior to a pose or rotation reset.
355+
*
356+
* @param timestampSeconds Timestamp of the robot heading data.
344357
* @param heading Field-relative robot heading at given timestamp. Standard WPILIB field
345358
* coordinates.
346359
*/

0 commit comments

Comments
 (0)