mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Add constructors to pose estimators with default standard deviations (#4754)
This commit is contained in:
@@ -51,6 +51,36 @@ public class DifferentialDrivePoseEstimator {
|
||||
private final TimeInterpolatableBuffer<InterpolationRecord> m_poseBuffer =
|
||||
TimeInterpolatableBuffer.createBuffer(1.5);
|
||||
|
||||
/**
|
||||
* Constructs a DifferentialDrivePoseEstimator with default standard deviations for the model and
|
||||
* vision measurements.
|
||||
*
|
||||
* <p>The default standard deviations of the model states are 0.02 meters for x, 0.02 meters for
|
||||
* y, and 0.01 radians for heading. The default standard deviations of the vision measurements are
|
||||
* 0.1 meters for x, 0.1 meters for y, and 0.1 radians for heading.
|
||||
*
|
||||
* @param kinematics A correctly-configured kinematics object for your drivetrain.
|
||||
* @param gyroAngle The current gyro angle.
|
||||
* @param leftDistanceMeters The distance traveled by the left encoder.
|
||||
* @param rightDistanceMeters The distance traveled by the right encoder.
|
||||
* @param initialPoseMeters The starting pose estimate.
|
||||
*/
|
||||
public DifferentialDrivePoseEstimator(
|
||||
DifferentialDriveKinematics kinematics,
|
||||
Rotation2d gyroAngle,
|
||||
double leftDistanceMeters,
|
||||
double rightDistanceMeters,
|
||||
Pose2d initialPoseMeters) {
|
||||
this(
|
||||
kinematics,
|
||||
gyroAngle,
|
||||
leftDistanceMeters,
|
||||
rightDistanceMeters,
|
||||
initialPoseMeters,
|
||||
VecBuilder.fill(0.02, 0.02, 0.01),
|
||||
VecBuilder.fill(0.1, 0.1, 0.1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a DifferentialDrivePoseEstimator.
|
||||
*
|
||||
|
||||
@@ -51,6 +51,33 @@ public class MecanumDrivePoseEstimator {
|
||||
private final TimeInterpolatableBuffer<InterpolationRecord> m_poseBuffer =
|
||||
TimeInterpolatableBuffer.createBuffer(1.5);
|
||||
|
||||
/**
|
||||
* Constructs a MecanumDrivePoseEstimator with default standard deviations for the model and
|
||||
* vision measurements.
|
||||
*
|
||||
* <p>The default standard deviations of the model states are 0.1 meters for x, 0.1 meters for y,
|
||||
* and 0.1 radians for heading. The default standard deviations of the vision measurements are
|
||||
* 0.45 meters for x, 0.45 meters for y, and 0.45 radians for heading.
|
||||
*
|
||||
* @param kinematics A correctly-configured kinematics object for your drivetrain.
|
||||
* @param gyroAngle The current gyro angle.
|
||||
* @param wheelPositions The distances driven by each wheel.
|
||||
* @param initialPoseMeters The starting pose estimate.
|
||||
*/
|
||||
public MecanumDrivePoseEstimator(
|
||||
MecanumDriveKinematics kinematics,
|
||||
Rotation2d gyroAngle,
|
||||
MecanumDriveWheelPositions wheelPositions,
|
||||
Pose2d initialPoseMeters) {
|
||||
this(
|
||||
kinematics,
|
||||
gyroAngle,
|
||||
wheelPositions,
|
||||
initialPoseMeters,
|
||||
VecBuilder.fill(0.1, 0.1, 0.1),
|
||||
VecBuilder.fill(0.45, 0.45, 0.45));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a MecanumDrivePoseEstimator.
|
||||
*
|
||||
|
||||
@@ -50,6 +50,33 @@ public class SwerveDrivePoseEstimator {
|
||||
private final TimeInterpolatableBuffer<InterpolationRecord> m_poseBuffer =
|
||||
TimeInterpolatableBuffer.createBuffer(1.5);
|
||||
|
||||
/**
|
||||
* Constructs a SwerveDrivePoseEstimator with default standard deviations for the model and vision
|
||||
* measurements.
|
||||
*
|
||||
* <p>The default standard deviations of the model states are 0.1 meters for x, 0.1 meters for y,
|
||||
* and 0.1 radians for heading. The default standard deviations of the vision measurements are 0.9
|
||||
* meters for x, 0.9 meters for y, and 0.9 radians for heading.
|
||||
*
|
||||
* @param kinematics A correctly-configured kinematics object for your drivetrain.
|
||||
* @param gyroAngle The current gyro angle.
|
||||
* @param modulePositions The current distance measurements and rotations of the swerve modules.
|
||||
* @param initialPoseMeters The starting pose estimate.
|
||||
*/
|
||||
public SwerveDrivePoseEstimator(
|
||||
SwerveDriveKinematics kinematics,
|
||||
Rotation2d gyroAngle,
|
||||
SwerveModulePosition[] modulePositions,
|
||||
Pose2d initialPoseMeters) {
|
||||
this(
|
||||
kinematics,
|
||||
gyroAngle,
|
||||
modulePositions,
|
||||
initialPoseMeters,
|
||||
VecBuilder.fill(0.1, 0.1, 0.1),
|
||||
VecBuilder.fill(0.9, 0.9, 0.9));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a SwerveDrivePoseEstimator.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user