Package frc.robot.localization
Class DrivetrainState
java.lang.Object
frc.robot.localization.DrivetrainState
Maintains the drivetrain pose estimate using wheel odometry and vision observations.
-
Constructor Summary
ConstructorsConstructorDescriptionDrivetrainState(SwerveModulePosition[] wheelPositions, Rotation2d gyroYaw) Creates the drivetrain state estimator from the initial module positions and gyro yaw. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOdometryObservation(SwerveModulePosition[] wheelPositions, Rotation2d gyroYaw, double timestamp) Updates odometry from a timestamped swerve measurement.voidaddVisionObservation(VisionObservation observation) Initializes or corrects the pose estimate with a processed vision observation.Returns the latest measured chassis speeds in the field frame.Returns the current estimated robot pose in field coordinates.voidAllows the next accepted vision observation to initialize the pose again.voidResets the estimated pose to a known field pose.voidupdateMeasuredSpeeds(ChassisSpeeds robotRelativeSpeeds) Updates the field-relative drivetrain speeds used when weighting vision observations.
-
Constructor Details
-
DrivetrainState
Creates the drivetrain state estimator from the initial module positions and gyro yaw.
-
-
Method Details
-
resetPose
Resets the estimated pose to a known field pose. -
resetInit
public void resetInit()Allows the next accepted vision observation to initialize the pose again. -
addOdometryObservation
public void addOdometryObservation(SwerveModulePosition[] wheelPositions, Rotation2d gyroYaw, double timestamp) Updates odometry from a timestamped swerve measurement. -
updateMeasuredSpeeds
Updates the field-relative drivetrain speeds used when weighting vision observations. -
addVisionObservation
Initializes or corrects the pose estimate with a processed vision observation. -
getGlobalPoseEstimate
Returns the current estimated robot pose in field coordinates. -
getFieldRelativeSpeeds
Returns the latest measured chassis speeds in the field frame.
-