Package org.texastorque.torquelib.legacy
Class TorqueSwerveOdometry
java.lang.Object
org.texastorque.torquelib.legacy.TorqueSwerveOdometry
Deprecated.
Being replaced by PoseEstimator.
A modified form of the WPILIBJ SwerveOddometry class.
-
Constructor Summary
ConstructorDescriptionTorqueSwerveOdometry
(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, edu.wpi.first.math.geometry.Rotation2d gyroAngle) Deprecated.Constructs a SwerveDriveOdometry object with the default pose at the origin.TorqueSwerveOdometry
(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.geometry.Pose2d initialPose) Deprecated.Constructs a SwerveDriveOdometry object. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.geometry.Pose2d
Deprecated.Returns the position of the robot on the field.void
resetPosition
(edu.wpi.first.math.geometry.Pose2d pose, edu.wpi.first.math.geometry.Rotation2d gyroAngle) Deprecated.Resets the robot's position on the field.edu.wpi.first.math.geometry.Pose2d
update
(edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.kinematics.SwerveModuleState... moduleStates) Deprecated.Updates the robot's position on the field using forward kinematics and integration of the pose over time.edu.wpi.first.math.geometry.Pose2d
updateWithTime
(double currentTimeSeconds, edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.kinematics.SwerveModuleState... moduleStates) Deprecated.Updates the robot's position on the field using forward kinematics and integration of the pose over time.
-
Constructor Details
-
TorqueSwerveOdometry
public TorqueSwerveOdometry(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.geometry.Pose2d initialPose) Deprecated.Constructs a SwerveDriveOdometry object.- Parameters:
kinematics
- The swerve drive kinematics for your drivetrain.gyroAngle
- The angle reported by the gyroscope.initialPose
- The starting position of the robot on the field.
-
TorqueSwerveOdometry
public TorqueSwerveOdometry(edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics, edu.wpi.first.math.geometry.Rotation2d gyroAngle) Deprecated.Constructs a SwerveDriveOdometry object with the default pose at the origin.- Parameters:
kinematics
- The swerve drive kinematics for your drivetrain.gyroAngle
- The angle reported by the gyroscope.
-
-
Method Details
-
resetPosition
public void resetPosition(edu.wpi.first.math.geometry.Pose2d pose, edu.wpi.first.math.geometry.Rotation2d gyroAngle) Deprecated.Resets the robot's position on the field.The gyroscope angle does not need to be reset here on the user's robot code. The library automatically takes care of offsetting the gyro angle.
- Parameters:
pose
- The position on the field that your robot is at.gyroAngle
- The angle reported by the gyroscope.
-
getPoseMeters
public edu.wpi.first.math.geometry.Pose2d getPoseMeters()Deprecated.Returns the position of the robot on the field.- Returns:
- The pose of the robot (x and y are in meters).
-
updateWithTime
public edu.wpi.first.math.geometry.Pose2d updateWithTime(double currentTimeSeconds, edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.kinematics.SwerveModuleState... moduleStates) Deprecated.Updates the robot's position on the field using forward kinematics and integration of the pose over time. This method takes in the current time as a parameter to calculate period (difference between two timestamps). The period is used to calculate the change in distance from a velocity. This also takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics.- Parameters:
currentTimeSeconds
- The current time in seconds.gyroAngle
- The angle reported by the gyroscope.moduleStates
- The current state of all swerve modules. Please provide the states in the same order in which you instantiated your SwerveDriveKinematics.- Returns:
- The new pose of the robot.
-
update
public edu.wpi.first.math.geometry.Pose2d update(edu.wpi.first.math.geometry.Rotation2d gyroAngle, edu.wpi.first.math.kinematics.SwerveModuleState... moduleStates) Deprecated.Updates the robot's position on the field using forward kinematics and integration of the pose over time. This method automatically calculates the current time to calculate period (difference between two timestamps). The period is used to calculate the change in distance from a velocity. This also takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics.- Parameters:
gyroAngle
- The angle reported by the gyroscope.moduleStates
- The current state of all swerve modules. Please provide the states in the same order in which you instantiated your SwerveDriveKinematics.- Returns:
- The new pose of the robot.
-