diff --git a/wpilibc/src/main/native/cpp/IterativeRobot.cpp b/wpilibc/src/main/native/cpp/IterativeRobot.cpp deleted file mode 100644 index ffc4e8e175..0000000000 --- a/wpilibc/src/main/native/cpp/IterativeRobot.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// 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 "frc/IterativeRobot.h" - -#include -#include - -#include "frc/DriverStation.h" - -using namespace frc; - -static constexpr auto kPacketPeriod = 0.02_s; - -IterativeRobot::IterativeRobot() : IterativeRobotBase(kPacketPeriod) { - HAL_Report(HALUsageReporting::kResourceType_Framework, - HALUsageReporting::kFramework_Iterative); -} - -void IterativeRobot::StartCompetition() { - RobotInit(); - - if constexpr (IsSimulation()) { - SimulationInit(); - } - - // Tell the DS that the robot is ready to be enabled - HAL_ObserveUserProgramStarting(); - - // Loop forever, calling the appropriate mode-dependent function - while (true) { - // Wait for driver station data so the loop doesn't hog the CPU - DriverStation::GetInstance().WaitForData(); - if (m_exit) { - break; - } - - LoopFunc(); - } -} - -void IterativeRobot::EndCompetition() { - m_exit = true; - DriverStation::GetInstance().WakeupWaitForData(); -} diff --git a/wpilibc/src/main/native/include/frc/IterativeRobot.h b/wpilibc/src/main/native/include/frc/IterativeRobot.h deleted file mode 100644 index f6c1532917..0000000000 --- a/wpilibc/src/main/native/include/frc/IterativeRobot.h +++ /dev/null @@ -1,50 +0,0 @@ -// 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. - -#pragma once - -#include - -#include "frc/IterativeRobotBase.h" - -namespace frc { - -/** - * IterativeRobot implements the IterativeRobotBase robot program framework. - * - * The IterativeRobot class is intended to be subclassed by a user creating a - * robot program. - * - * Periodic() functions from the base class are called each time a new packet is - * received from the driver station. - * - * @deprecated Use TimedRobot instead. It's a drop-in replacement that provides - * more regular execution periods. - */ -class IterativeRobot : public IterativeRobotBase { - public: - WPI_DEPRECATED( - "Use TimedRobot instead. It's a drop-in replacement that provides more " - "regular execution periods.") - IterativeRobot(); - ~IterativeRobot() override = default; - - /** - * Provide an alternate "main loop" via StartCompetition(). - * - * This specific StartCompetition() implements "main loop" behavior synced - * with the DS packets. - */ - void StartCompetition() override; - - /** - * Ends the main loop in StartCompetition(). - */ - void EndCompetition() override; - - private: - std::atomic m_exit{false}; -}; - -} // namespace frc diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java deleted file mode 100644 index ba3cb2c40a..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -package edu.wpi.first.wpilibj; - -import edu.wpi.first.hal.FRCNetComm.tInstances; -import edu.wpi.first.hal.FRCNetComm.tResourceType; -import edu.wpi.first.hal.HAL; - -/** - * IterativeRobot implements the IterativeRobotBase robot program framework. - * - *

The IterativeRobot class is intended to be subclassed by a user creating a robot program. - * - *

periodic() functions from the base class are called each time a new packet is received from - * the driver station. - * - * @deprecated Use TimedRobot instead. It's a drop-in replacement that provides more regular - * execution periods. - */ -@Deprecated -public class IterativeRobot extends IterativeRobotBase { - private static final double kPacketPeriod = 0.02; - private volatile boolean m_exit; - - /** Create a new IterativeRobot. */ - public IterativeRobot() { - super(kPacketPeriod); - - HAL.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Iterative); - } - - /** Provide an alternate "main loop" via startCompetition(). */ - @Override - public void startCompetition() { - robotInit(); - - if (isSimulation()) { - simulationInit(); - } - - // Tell the DS that the robot is ready to be enabled - HAL.observeUserProgramStarting(); - - // Loop forever, calling the appropriate mode-dependent function - while (!Thread.currentThread().isInterrupted()) { - // Wait for new data to arrive - m_ds.waitForData(); - if (m_exit) { - break; - } - - loopFunc(); - } - } - - /** Ends the main loop in startCompetition(). */ - @Override - public void endCompetition() { - m_exit = true; - m_ds.wakeupWaitForData(); - } -}