Add realtime parameter to visual global.
PiperOrigin-RevId: 478775714 Change-Id: Ic2d178a5c57d298d005215219ce8470392c4651b
This commit is contained in:
committed by
Copybara-Service
parent
f85cfb8ed2
commit
bc1490b7a8
@@ -1648,6 +1648,18 @@ void Simulate::loadmodel() {
|
||||
// clear request
|
||||
this->loadrequest = 0;
|
||||
cond_loadrequest.notify_all();
|
||||
|
||||
// set real time index
|
||||
int numclicks = sizeof(this->percentRealTime) / sizeof(this->percentRealTime[0]);
|
||||
float min_error = 1e6;
|
||||
float desired = mju_log(100*this->m->vis.global.realtime);
|
||||
for (int click=0; click<numclicks; click++) {
|
||||
float error = mju_abs(mju_log(this->percentRealTime[click]) - desired);
|
||||
if (error < min_error) {
|
||||
min_error = error;
|
||||
this->realTimeIndex = click;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ class MJSIMULATEAPI Simulate {
|
||||
char previous_filename[kMaxFilenameLength] = "";
|
||||
|
||||
// time synchronization
|
||||
int realTimeIndex = 0;
|
||||
int realTimeIndex;
|
||||
bool speedChanged = true;
|
||||
float measuredSlowdown = 1.0;
|
||||
// logarithmically spaced realtime slow-down coefficients (percent)
|
||||
|
||||
Reference in New Issue
Block a user