Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new C++ API request to get actual simulation clock rate #4612

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AirLib/include/api/RpcLibClientBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace airlib
int getMinRequiredClientVersion() const;

bool simIsPaused() const;
float getSimClockRate() const;
void simPause(bool is_paused);
void simContinueForTime(double seconds);
void simContinueForFrames(uint32_t frames);
Expand Down
5 changes: 5 additions & 0 deletions AirLib/src/api/RpcLibClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ __pragma(warning(disable : 4239))
return pimpl_->client.call("simIsPaused").as<bool>();
}

float RpcLibClientBase::getSimClockRate() const
{
return pimpl_->client.call("getSimClockRate").as<float>();
}

void RpcLibClientBase::simPause(bool is_paused)
{
pimpl_->client.call("simPause", is_paused);
Expand Down
4 changes: 4 additions & 0 deletions AirLib/src/api/RpcLibServerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ namespace airlib
return getWorldSimApi()->isPaused();
});

pimpl_->server.bind("getSimClockRate", [&]() -> float {
return ClockFactory::get()->getTrueScaleWrtWallClock();
});

pimpl_->server.bind("simContinueForTime", [&](double seconds) -> void {
getWorldSimApi()->continueForTime(seconds);
});
Expand Down