From ee15cc172a5ee8e7e8099b7e8d5fe7d3fadcc828 Mon Sep 17 00:00:00 2001 From: Tim Winters Date: Sun, 28 Jan 2024 02:51:00 -0500 Subject: [PATCH] [commands] Reset timer in quasistatic SysIdRoutine test (#6322) --- .../edu/wpi/first/wpilibj2/command/sysid/SysIdRoutine.java | 2 +- .../src/main/native/cpp/frc2/command/sysid/SysIdRoutine.cpp | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/sysid/SysIdRoutine.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/sysid/SysIdRoutine.java index f0f81c861d2..053a404c779 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/sysid/SysIdRoutine.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/sysid/SysIdRoutine.java @@ -226,7 +226,7 @@ public Command quasistatic(Direction direction) { Timer timer = new Timer(); return m_mechanism .m_subsystem - .runOnce(timer::start) + .runOnce(timer::restart) .andThen( m_mechanism.m_subsystem.run( () -> { diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/sysid/SysIdRoutine.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/sysid/SysIdRoutine.cpp index ea95db029a6..359c8d824d4 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/sysid/SysIdRoutine.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/sysid/SysIdRoutine.cpp @@ -18,11 +18,7 @@ frc2::CommandPtr SysIdRoutine::Quasistatic(Direction direction) { double outputSign = direction == Direction::kForward ? 1.0 : -1.0; - return m_mechanism.m_subsystem - ->RunOnce([this] { - timer.Reset(); - timer.Start(); - }) + return m_mechanism.m_subsystem->RunOnce([this] { timer.Restart(); }) .AndThen( m_mechanism.m_subsystem ->Run([this, state, outputSign] {