Add ability to end startCompetition() main loop (#2032)

This is useful for both cleanly exiting from simulation and for unit testing
at a framework level.

This change required removing move constructor/assignment from IterativeRobot.
This commit is contained in:
Peter Johnson
2019-11-05 21:33:09 -08:00
committed by GitHub
parent f5b4be16db
commit 7508aada93
14 changed files with 185 additions and 35 deletions

View File

@@ -473,6 +473,13 @@ double DriverStation::GetBatteryVoltage() const {
return voltage;
}
void DriverStation::WakeupWaitForData() {
std::scoped_lock waitLock(m_waitForDataMutex);
// Nofify all threads
m_waitForDataCounter++;
m_waitForDataCond.notify_all();
}
void DriverStation::GetData() {
{
// Compute the pressed and released buttons
@@ -494,13 +501,7 @@ void DriverStation::GetData() {
}
}
{
std::scoped_lock waitLock(m_waitForDataMutex);
// Nofify all threads
m_waitForDataCounter++;
m_waitForDataCond.notify_all();
}
WakeupWaitForData();
SendMatchData();
}