SwerveDrive2PoseEstimator3d
- class wpimath.SwerveDrive2PoseEstimator3d(*args, **kwargs)
Bases:
SwerveDrive2PoseEstimator3dBaseThis class wraps Swerve Drive Odometry to fuse latency-compensated vision measurements with swerve drive encoder distance measurements. It is intended to be a drop-in for SwerveDriveOdometry3d. It is also intended to be an easy replacement for PoseEstimator, only requiring the addition of a standard deviation for Z and appropriate conversions between 2D and 3D versions of geometry classes. (See Pose3d(Pose2d), Rotation3d(Rotation2d), Translation3d(Translation2d), and Pose3d.ToPose2d().)
Update() should be called every robot loop.
AddVisionMeasurement() can be called as infrequently as you want; if you never call it, then this class will behave as regular encoder odometry.
Overloaded function.
__init__(self: wpimath._wpimath.SwerveDrive2PoseEstimator3d, kinematics: wpimath._wpimath.SwerveDrive2Kinematics, gyroAngle: wpimath._wpimath.Rotation3d, modulePositions: Tuple[wpimath._wpimath.SwerveModulePosition, wpimath._wpimath.SwerveModulePosition], initialPose: wpimath._wpimath.Pose3d) -> None
Constructs a SwerveDrivePoseEstimator3d with default standard deviations for the model and vision measurements.
The default standard deviations of the model states are 0.1 meters for x, 0.1 meters for y, 0.1 meters for z, and 0.1 radians for angle. The default standard deviations of the vision measurements are 0.9 meters for x, 0.9 meters for y, 0.9 meters for z, and 0.9 radians for angle.
- Parameters:
kinematics – A correctly-configured kinematics object for your drivetrain.
gyroAngle – The current gyro angle.
modulePositions – The current distance and rotation measurements of the swerve modules.
initialPose – The starting pose estimate.
__init__(self: wpimath._wpimath.SwerveDrive2PoseEstimator3d, kinematics: wpimath._wpimath.SwerveDrive2Kinematics, gyroAngle: wpimath._wpimath.Rotation3d, modulePositions: Tuple[wpimath._wpimath.SwerveModulePosition, wpimath._wpimath.SwerveModulePosition], initialPose: wpimath._wpimath.Pose3d, stateStdDevs: Tuple[typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex], visionMeasurementStdDevs: Tuple[typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex, typing.SupportsFloat | typing.SupportsIndex]) -> None
Constructs a SwerveDrivePoseEstimator3d.
- Parameters:
kinematics – A correctly-configured kinematics object for your drivetrain.
gyroAngle – The current gyro angle.
modulePositions – The current distance and rotation measurements of the swerve modules.
initialPose – The starting pose estimate.
stateStdDevs – Standard deviations of the pose estimate (x position in meters, y position in meters, and heading in radians). Increase these numbers to trust your state estimate less.
visionMeasurementStdDevs – Standard deviations of the vision pose measurement (x position in meters, y position in meters, and heading in radians). Increase these numbers to trust the vision pose measurement less.