2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "IterativeRobot.h"
|
|
|
|
|
|
2017-08-27 00:11:52 -07:00
|
|
|
#include <HAL/HAL.h>
|
|
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "DriverStation.h"
|
|
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2017-07-08 10:50:56 -04:00
|
|
|
IterativeRobot::IterativeRobot() {
|
|
|
|
|
HAL_Report(HALUsageReporting::kResourceType_Framework,
|
|
|
|
|
HALUsageReporting::kFramework_Iterative);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void IterativeRobot::StartCompetition() {
|
2017-09-05 23:57:26 -07:00
|
|
|
RobotInit();
|
|
|
|
|
|
|
|
|
|
// Tell the DS that the robot is ready to be enabled
|
|
|
|
|
HAL_ObserveUserProgramStarting();
|
|
|
|
|
|
2017-07-08 10:50:56 -04:00
|
|
|
// Loop forever, calling the appropriate mode-dependent function
|
2015-06-25 15:07:55 -04:00
|
|
|
while (true) {
|
2017-11-16 00:33:51 -08:00
|
|
|
// Wait for driver station data so the loop doesn't hog the CPU
|
2017-07-08 10:50:56 -04:00
|
|
|
DriverStation::GetInstance().WaitForData();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2017-07-08 10:50:56 -04:00
|
|
|
LoopFunc();
|
2015-06-25 15:07:55 -04:00
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|