diff --git a/scripts/packaging/files_msys64.txt b/scripts/packaging/files_msys64.txt index 9926518a30b..55e1f929e99 100644 --- a/scripts/packaging/files_msys64.txt +++ b/scripts/packaging/files_msys64.txt @@ -19,6 +19,7 @@ /mingw64/bin/libpcre2-16-0.dll /mingw64/bin/libpng16-16.dll /mingw64/bin/libssl-3-x64.dll +/mingw64/bin/libwinpthread-1.dll /mingw64/bin/Qt6Core.dll /mingw64/bin/Qt6Gui.dll /mingw64/bin/Qt6Network.dll diff --git a/src/webots/engine/WbSimulationWorld.cpp b/src/webots/engine/WbSimulationWorld.cpp index 319df02a665..ec450c4ecea 100644 --- a/src/webots/engine/WbSimulationWorld.cpp +++ b/src/webots/engine/WbSimulationWorld.cpp @@ -73,8 +73,6 @@ WbSimulationWorld::WbSimulationWorld(WbTokenizer *tokenizer) : } } - mSleepRealTime = basicTimeStep(); - WbPerformanceLog *log = WbPerformanceLog::instance(); if (log) log->setTimeStep(basicTimeStep()); @@ -128,6 +126,7 @@ WbSimulationWorld::WbSimulationWorld(WbTokenizer *tokenizer) : if (log) log->stopMeasure(WbPerformanceLog::LOADING); + mTimer->setTimerType(Qt::PreciseTimer); connect(mTimer, &QTimer::timeout, this, &WbSimulationWorld::triggerStepFromTimer); const WbSimulationState *const s = WbSimulationState::instance(); connect(s, &WbSimulationState::rayTracingEnabled, this, &WbSimulationWorld::rayTracingEnabled); @@ -185,37 +184,6 @@ void WbSimulationWorld::step() { const double timeStep = basicTimeStep(); - if (WbSimulationState::instance()->isRealTime()) { - const int elapsed = mRealTimeTimer.restart(); - - // computing the mean of an history of several elapsedTime - // improves significantly the stability of the algorithm - // in case of simulations where elapsedTime oscillates often - // above and below basicTimeStep. - // Moreover it improves the stability of simulations where - // basicTimeStep contains significant decimals - mElapsedTimeHistory.append(elapsed); - if (mElapsedTimeHistory.size() > qMax(4.0, 128.0 / timeStep)) // history size found empirically - mElapsedTimeHistory.pop_front(); - double mean = 0.0; - foreach (const int &v, mElapsedTimeHistory) - mean += v; - mean /= mElapsedTimeHistory.size(); - - // useful hack: uncomment to run Webots at 90% of the real-time - // (if the real-time mode is enabled, of course) - // mean *= 0.90; - - if (mean > timeStep && mSleepRealTime > 0.0) { - mSleepRealTime -= 0.03 * timeStep; - if (mSleepRealTime < 0) - mSleepRealTime = 0.0; - } else if (mean < timeStep) - mSleepRealTime += 0.03 * timeStep; - - mTimer->start(mSleepRealTime); - } - emit physicsStepStarted(); if (log) @@ -317,10 +285,9 @@ void WbSimulationWorld::modeChanged() { WbSoundEngine::setMute(WbPreferences::instance()->value("Sound/mute").toBool()); break; case WbSimulationState::REALTIME: - mRealTimeTimer.start(); WbSoundEngine::setPause(false); WbSoundEngine::setMute(WbPreferences::instance()->value("Sound/mute").toBool()); - mTimer->start(mSleepRealTime); + mTimer->start(basicTimeStep()); break; case WbSimulationState::FAST: WbSoundEngine::setPause(false); diff --git a/src/webots/engine/WbSimulationWorld.hpp b/src/webots/engine/WbSimulationWorld.hpp index 59b528855d1..1cfcbf4a9d5 100644 --- a/src/webots/engine/WbSimulationWorld.hpp +++ b/src/webots/engine/WbSimulationWorld.hpp @@ -76,9 +76,6 @@ protected slots: WbOdeContext *mOdeContext; WbPhysicsPlugin *mPhysicsPlugin; QTimer *mTimer; - QElapsedTimer mRealTimeTimer; - double mSleepRealTime; - QList mElapsedTimeHistory; QVector mAddedNode; // list of nodes added since the simulation started void storeLastSaveTime() override;