Class SwerveDrivetrain.SwerveDriveState
java.lang.Object
com.ctre.phoenix6.swerve.SwerveDrivetrain.SwerveDriveState
- All Implemented Interfaces:
Cloneable
- Enclosing class:
SwerveDrivetrain<DriveMotorT extends CommonTalon, SteerMotorT extends CommonTalon, EncoderT extends ParentDevice>
-
Field Summary
FieldsModifier and TypeFieldDescriptionintNumber of failed data acquisitionsThe current module positionsThe target module velocitiesThe current module velocitiesdoubleThe measured odometry update period, in secondsThe current pose of the robotThe raw heading of the robot, unaffected by vision updates and odometry resetsintNumber of successful data acquisitionsdoubleThe timestamp of the state capture, in the timebase ofUtils.getCurrentTimeSeconds()The current robot-centric velocity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a deep copy of this state object.final SwerveDriveStateStructCreates an implementation of theStructinterface for this swerve drive state object.static final SwerveDriveStateStructgetStruct(int numModules) Creates an implementation of theStructinterface for a swerve drive state object.protected voidupdateFromNative(MemorySegment driveState)
-
Field Details
-
Pose
The current pose of the robot -
Velocity
The current robot-centric velocity -
ModulePositions
The current module positions -
ModuleVelocities
The current module velocities -
ModuleTargets
The target module velocities -
RawHeading
The raw heading of the robot, unaffected by vision updates and odometry resets -
Timestamp
public double TimestampThe timestamp of the state capture, in the timebase ofUtils.getCurrentTimeSeconds() -
OdometryPeriod
public double OdometryPeriodThe measured odometry update period, in seconds -
SuccessfulDaqs
public int SuccessfulDaqsNumber of successful data acquisitions -
FailedDaqs
public int FailedDaqsNumber of failed data acquisitions
-
-
Constructor Details
-
SwerveDriveState
public SwerveDriveState(int numModules) Creates a new swerve drive state.- Parameters:
numModules- The number of modules in the swerve drive state
-
-
Method Details
-
clone
Creates a deep copy of this state object. This API is not thread-safe. -
updateFromNative
- Parameters:
driveState-SwerveNative.swerve_drive_state_t
-
getStruct
Creates an implementation of theStructinterface for a swerve drive state object.- Parameters:
numModules- The number of modules in the swerve drive state objects the serializer processes- Returns:
- Struct implementation
-
getStruct
Creates an implementation of theStructinterface for this swerve drive state object.- Returns:
- Struct implementation
-