mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
I left "free speed" alone since that's the technical term for it. In general, velocity is a vector quantity, and speed is a magnitude (i.e., a strictly positive value). This PR also replaces the speed verbiage in MotorController with duty cycle. Fixes #8423.
25 lines
567 B
C++
25 lines
567 B
C++
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
#include "commands/TurnTime.hpp"
|
|
|
|
void TurnTime::Initialize() {
|
|
m_timer.Start();
|
|
m_drive->ArcadeDrive(0, 0);
|
|
}
|
|
|
|
void TurnTime::Execute() {
|
|
m_drive->ArcadeDrive(0, m_velocity);
|
|
}
|
|
|
|
void TurnTime::End(bool interrupted) {
|
|
m_drive->ArcadeDrive(0, 0);
|
|
m_timer.Stop();
|
|
m_timer.Reset();
|
|
}
|
|
|
|
bool TurnTime::IsFinished() {
|
|
return m_timer.HasElapsed(m_duration);
|
|
}
|