Skip to content

Commit

Permalink
Added vision measurement stddevs function
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Aug 4, 2024
1 parent 89f1801 commit a34b989
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/swervelib/SwerveDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,21 @@ public void addVisionMeasurement(Pose2d robotPose, double timestamp,
odometryLock.unlock();
}

/**
* Sets the pose estimator's trust of global measurements. This might be used to change trust in vision measurements
* after the autonomous period, or to change trust as distance to a vision target increases.
*
* @param visionMeasurementStdDevs Standard deviations of the vision measurements. Increase these numbers to trust
* global measurements from vision less. This matrix is in the form [x, y, theta]ᵀ,
* with units in meters and radians.
*/
public void setVisionMeasurementStdDevs(Matrix<N3, N1> visionMeasurementStdDevs)
{
odometryLock.lock();
swerveDrivePoseEstimator.setVisionMeasurementStdDevs(visionMeasurementStdDevs);
odometryLock.unlock();
}

/**
* Add a vision measurement to the {@link SwerveDrivePoseEstimator} and update the {@link SwerveIMU} gyro reading with
* the given timestamp of the vision measurement.
Expand Down

0 comments on commit a34b989

Please sign in to comment.