mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -12,9 +12,9 @@
|
||||
#include "wpi/system/Errors.hpp"
|
||||
#include "wpi/util/print.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
IterativeRobotBase::IterativeRobotBase(units::second_t period)
|
||||
IterativeRobotBase::IterativeRobotBase(wpi::units::second_t period)
|
||||
: m_period(period),
|
||||
m_watchdog(period, [this] { PrintLoopOverrunMessage(); }) {}
|
||||
|
||||
@@ -33,7 +33,7 @@ void IterativeRobotBase::TestInit() {}
|
||||
void IterativeRobotBase::RobotPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ void IterativeRobotBase::RobotPeriodic() {
|
||||
void IterativeRobotBase::SimulationPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void IterativeRobotBase::SimulationPeriodic() {
|
||||
void IterativeRobotBase::DisabledPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void IterativeRobotBase::DisabledPeriodic() {
|
||||
void IterativeRobotBase::AutonomousPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ void IterativeRobotBase::AutonomousPeriodic() {
|
||||
void IterativeRobotBase::TeleopPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void IterativeRobotBase::TeleopPeriodic() {
|
||||
void IterativeRobotBase::TestPeriodic() {
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
wpi::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
wpi::util::print("Default {}() method... Override me!\n", __FUNCTION__);
|
||||
firstRun = false;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ void IterativeRobotBase::SetNetworkTablesFlushEnabled(bool enabled) {
|
||||
m_ntFlushEnabled = enabled;
|
||||
}
|
||||
|
||||
units::second_t IterativeRobotBase::GetPeriod() const {
|
||||
wpi::units::second_t IterativeRobotBase::GetPeriod() const {
|
||||
return m_period;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ void IterativeRobotBase::LoopFunc() {
|
||||
|
||||
// Flush NetworkTables
|
||||
if (m_ntFlushEnabled) {
|
||||
nt::NetworkTableInstance::GetDefault().FlushLocal();
|
||||
wpi::nt::NetworkTableInstance::GetDefault().FlushLocal();
|
||||
}
|
||||
|
||||
// Warn on loop time overruns
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "wpi/driverstation/DriverStation.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
bool RobotState::IsDisabled() {
|
||||
return DriverStation::IsDisabled();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "wpi/hal/UsageReporting.h"
|
||||
#include "wpi/system/Errors.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
void TimedRobot::StartCompetition() {
|
||||
if constexpr (IsSimulation()) {
|
||||
@@ -75,7 +75,7 @@ void TimedRobot::EndCompetition() {
|
||||
HAL_StopNotifier(m_notifier, &status);
|
||||
}
|
||||
|
||||
TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) {
|
||||
TimedRobot::TimedRobot(wpi::units::second_t period) : IterativeRobotBase(period) {
|
||||
m_startTime = std::chrono::microseconds{RobotController::GetFPGATime()};
|
||||
AddPeriodic([=, this] { LoopFunc(); }, period);
|
||||
|
||||
@@ -87,7 +87,7 @@ TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) {
|
||||
HAL_ReportUsage("Framework", "TimedRobot");
|
||||
}
|
||||
|
||||
TimedRobot::TimedRobot(units::hertz_t frequency) : TimedRobot{1 / frequency} {}
|
||||
TimedRobot::TimedRobot(wpi::units::hertz_t frequency) : TimedRobot{1 / frequency} {}
|
||||
|
||||
TimedRobot::~TimedRobot() {
|
||||
if (m_notifier != HAL_kInvalidHandle) {
|
||||
@@ -102,7 +102,7 @@ uint64_t TimedRobot::GetLoopStartTime() {
|
||||
}
|
||||
|
||||
void TimedRobot::AddPeriodic(std::function<void()> callback,
|
||||
units::second_t period, units::second_t offset) {
|
||||
wpi::units::second_t period, wpi::units::second_t offset) {
|
||||
m_callbacks.emplace(
|
||||
callback, m_startTime,
|
||||
std::chrono::microseconds{static_cast<int64_t>(period.value() * 1e6)},
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
|
||||
#include "wpi/system/Errors.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
TimesliceRobot::TimesliceRobot(units::second_t robotPeriodicAllocation,
|
||||
units::second_t controllerPeriod)
|
||||
TimesliceRobot::TimesliceRobot(wpi::units::second_t robotPeriodicAllocation,
|
||||
wpi::units::second_t controllerPeriod)
|
||||
: m_nextOffset{robotPeriodicAllocation},
|
||||
m_controllerPeriod{controllerPeriod} {}
|
||||
|
||||
void TimesliceRobot::Schedule(std::function<void()> func,
|
||||
units::second_t allocation) {
|
||||
wpi::units::second_t allocation) {
|
||||
if (m_nextOffset + allocation > m_controllerPeriod) {
|
||||
throw FRC_MakeError(err::Error,
|
||||
"Function scheduled at offset {} with allocation {} "
|
||||
|
||||
Reference in New Issue
Block a user