mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +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
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "DifferentialDriveKinematics.h"
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "frc2/Timer.h"
|
||||
|
||||
namespace frc {
|
||||
/**
|
||||
@@ -86,9 +87,7 @@ class DifferentialDriveOdometry {
|
||||
*/
|
||||
const Pose2d& Update(const Rotation2d& angle,
|
||||
const DifferentialDriveWheelSpeeds& wheelSpeeds) {
|
||||
const auto now = std::chrono::system_clock::now().time_since_epoch();
|
||||
units::second_t time{now};
|
||||
return UpdateWithTime(time, angle, wheelSpeeds);
|
||||
return UpdateWithTime(frc2::Timer::GetFPGATimestamp(), angle, wheelSpeeds);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user