Class SwerveOdometry

java.lang.Object
com.marslib.swerve.SwerveOdometry

public class SwerveOdometry extends Object
Encapsulates high-frequency (250Hz) odometry tracking and vision fusion. Drains timestamps natively from hardware threads to prevent main-loop discretization error.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwerveOdometry(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, SwerveConfig config, edu.wpi.first.math.kinematics.SwerveModulePosition... initialPositions)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
     
    edu.wpi.first.math.geometry.Pose2d
     
    edu.wpi.first.math.geometry.Pose3d
    getPose3d(com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs)
     
    void
    resetPose(edu.wpi.first.math.geometry.Pose2d pose, com.marslib.swerve.GyroIOInputsAutoLogged gyroInputs, SwerveModule... modules)
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)