private void KeepAlive()
{
while (true)
{
keepAliveCommand.Execute();
if (!allowCommand())
{
//Console.WriteLine("***Emergency stop enabled***");
if (emergencyLeftStopCommand == null)
{
emergencyLeftStopCommand = new MovementCommand(EMERGENCY_LEFT_STOP);
}
if (emergencyRightStopCommand == null)
{
emergencyRightStopCommand = new MovementCommand(EMERGENCY_RIGHT_STOP);
}
emergencyLeftStopCommand.Execute();
emergencyRightStopCommand.Execute();
}
Thread.Sleep(_sleepPeriod);
}
}