Class SwerveState

java.lang.Object
org.team1126.lib.swerve.SwerveState

public final class SwerveState extends Object
Represents the state of the robot's drivetrain.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Contains information about swerve module states and positions.
    static final class 
    Represents the state of the odometry thread.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Information about module states and positions.
    edu.wpi.first.math.geometry.Pose2d
    The uncorrected blue origin relative odometry pose of the robot.
    The state of the odometry thread.
    edu.wpi.first.math.geometry.Rotation2d
    The robot's pitch.
    edu.wpi.first.math.geometry.Pose2d
    The current blue origin relative pose of the robot.
    All pose estimates from the odometry thread since the SwerveState has been refreshed.
    edu.wpi.first.math.geometry.Rotation2d
    The robot's roll.
    edu.wpi.first.math.geometry.Rotation2d
    The robot's rotation (yaw) as reported from the pose estimator.
    final edu.wpi.first.math.kinematics.ChassisSpeeds
    The current measured robot-relative speeds.
    final edu.wpi.first.math.kinematics.ChassisSpeeds
    The next target robot-relative speeds.
    double
    The timestamp of the swerve state in seconds (FPGA time).
    edu.wpi.first.math.geometry.Translation2d
    The current blue origin relative translation of the robot.
    double
    The directionless measured velocity of the robot.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • modules

      public final SwerveState.Modules modules
      Information about module states and positions.
    • odometryThread

      public final SwerveState.OdometryThread odometryThread
      The state of the odometry thread.
    • poseHistory

      public final List<TimestampedPose> poseHistory
      All pose estimates from the odometry thread since the SwerveState has been refreshed.
    • speeds

      public final edu.wpi.first.math.kinematics.ChassisSpeeds speeds
      The current measured robot-relative speeds.
    • targetSpeeds

      public final edu.wpi.first.math.kinematics.ChassisSpeeds targetSpeeds
      The next target robot-relative speeds. Updated when using applySpeeds().
    • velocity

      public double velocity
      The directionless measured velocity of the robot.
    • pose

      public edu.wpi.first.math.geometry.Pose2d pose
      The current blue origin relative pose of the robot.
    • pitch

      public edu.wpi.first.math.geometry.Rotation2d pitch
      The robot's pitch.
    • roll

      public edu.wpi.first.math.geometry.Rotation2d roll
      The robot's roll.
    • odometryPose

      public edu.wpi.first.math.geometry.Pose2d odometryPose
      The uncorrected blue origin relative odometry pose of the robot.
    • translation

      public edu.wpi.first.math.geometry.Translation2d translation
      The current blue origin relative translation of the robot.
    • rotation

      public edu.wpi.first.math.geometry.Rotation2d rotation
      The robot's rotation (yaw) as reported from the pose estimator.
    • timestamp

      public double timestamp
      The timestamp of the swerve state in seconds (FPGA time).