mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Use FPGA Time instead of wall clock time for odometry (#1996)
This commit is contained in:
committed by
Peter Johnson
parent
d4430b765e
commit
8e333c0aad
@@ -7,6 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.kinematics;
|
||||
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.geometry.Pose2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Rotation2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Twist2d;
|
||||
@@ -116,7 +117,7 @@ public class DifferentialDriveOdometry {
|
||||
*/
|
||||
public Pose2d update(Rotation2d angle,
|
||||
DifferentialDriveWheelSpeeds wheelSpeeds) {
|
||||
return updateWithTime(System.currentTimeMillis() / 1000.0,
|
||||
return updateWithTime(Timer.getFPGATimestamp(),
|
||||
angle, wheelSpeeds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.kinematics;
|
||||
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.geometry.Pose2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Rotation2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Twist2d;
|
||||
@@ -109,7 +110,7 @@ public class MecanumDriveOdometry {
|
||||
*/
|
||||
public Pose2d update(Rotation2d angle,
|
||||
MecanumDriveWheelSpeeds wheelSpeeds) {
|
||||
return updateWithTime(System.currentTimeMillis() / 1000.0, angle,
|
||||
return updateWithTime(Timer.getFPGATimestamp(), angle,
|
||||
wheelSpeeds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.kinematics;
|
||||
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.geometry.Pose2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Rotation2d;
|
||||
import edu.wpi.first.wpilibj.geometry.Twist2d;
|
||||
@@ -113,6 +114,6 @@ public class SwerveDriveOdometry {
|
||||
* @return The new pose of the robot.
|
||||
*/
|
||||
public Pose2d update(Rotation2d angle, SwerveModuleState... moduleStates) {
|
||||
return updateWithTime(System.currentTimeMillis() / 1000.0, angle, moduleStates);
|
||||
return updateWithTime(Timer.getFPGATimestamp(), angle, moduleStates);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user