Package com.marslib.swerve
Class SwerveOdometry
java.lang.Object
com.marslib.swerve.SwerveOdometry
Encapsulates high-frequency (250Hz) odometry tracking and vision fusion. Drains timestamps
natively from hardware threads to prevent main-loop discretization error.
-
Constructor Summary
ConstructorsConstructorDescriptionSwerveOdometry(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, SwerveConfig config, edu.wpi.first.math.kinematics.SwerveModulePosition... initialPositions) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVisionMeasurement(edu.wpi.first.math.geometry.Pose2d visionRobotPoseMeters, double timestampSeconds, edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3, edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs) edu.wpi.first.math.geometry.Pose2dgetPose()edu.wpi.first.math.geometry.Pose3dgetPose3d(com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs) voidresetPose(edu.wpi.first.math.geometry.Pose2d pose, com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs, SwerveModule... modules) voidupdateOdometry(SwerveModule[] modules, com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs) Performs the high-frequency synchronous drain of the cached module vectors, updating the pose estimator with sub-loop accuracy.
-
Constructor Details
-
SwerveOdometry
public SwerveOdometry(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, SwerveConfig config, edu.wpi.first.math.kinematics.SwerveModulePosition... initialPositions)
-
-
Method Details
-
updateOdometry
public void updateOdometry(SwerveModule[] modules, com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs) Performs the high-frequency synchronous drain of the cached module vectors, updating the pose estimator with sub-loop accuracy. -
getPose
public edu.wpi.first.math.geometry.Pose2d getPose() -
getPose3d
public edu.wpi.first.math.geometry.Pose3d getPose3d(com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs) -
resetPose
public void resetPose(edu.wpi.first.math.geometry.Pose2d pose, com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs, SwerveModule... modules) -
addVisionMeasurement
public void addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d visionRobotPoseMeters, double timestampSeconds, edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3, edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs)
-