mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Adds a RobotPeriodic method to IterativeRobot (#226)
Called globally during each IterativeRobot loop
This commit is contained in:
committed by
Peter Johnson
parent
4fc7daedc9
commit
f271185cbc
@@ -135,6 +135,7 @@ public class IterativeRobot extends RobotBase {
|
||||
teleopPeriodic();
|
||||
}
|
||||
}
|
||||
robotPeriodic();
|
||||
m_ds.waitForData();
|
||||
}
|
||||
}
|
||||
@@ -204,6 +205,22 @@ public class IterativeRobot extends RobotBase {
|
||||
}
|
||||
|
||||
/* ----------- Overridable periodic code ----------------- */
|
||||
|
||||
private boolean m_rpFirstRun = true;
|
||||
|
||||
/**
|
||||
* Periodic code for all robot modes should go here.
|
||||
*
|
||||
* <p>Users should override this method for code which will be called periodically at a regular
|
||||
* rate while the robot is in any mode.
|
||||
*/
|
||||
public void robotPeriodic() {
|
||||
if (m_rpFirstRun) {
|
||||
System.out.println("Default IterativeRobot.robotPeriodic() method... Overload me!");
|
||||
m_rpFirstRun = false;
|
||||
}
|
||||
Timer.delay(0.001);
|
||||
}
|
||||
|
||||
private boolean m_dpFirstRun = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user