diff --git a/src/backend/simulation_runner.cc b/src/backend/simulation_runner.cc index e42c5312d..2801eab90 100644 --- a/src/backend/simulation_runner.cc +++ b/src/backend/simulation_runner.cc @@ -383,9 +383,12 @@ void SimulationRunner::SendWorldStats() { void SimulationRunner::ProcessWorldControlMessage( const ignition::msgs::WorldControl& msg) { if (msg.has_pause()) { - if (msg.pause()) { + /* If we press the play-pause button quickly, + more than one play/pause message will be sent + so we just ignore it. */ + if (msg.pause() && !IsSimulationPaused()) { PauseSimulation(); - } else { + } else if (IsSimulationPaused()) { UnpauseSimulation(); } } else if (msg.has_step() && msg.step()) {