Replace large timeout (1024*1024*1024) using real-time clock timeout (10 seconds default)

Change SHARED_MEMORY_MAGIC_NUMBER to make sure server/client are using the same version (shared memory)
add --realtimesimulation to physics server (GUI, VR)
remove --G Xcode from build_cmake_pybullet_double.sh
This commit is contained in:
Erwin Coumans
2017-02-22 09:33:30 -08:00
parent 35b92c43d3
commit bd30ba30ce
13 changed files with 172 additions and 80 deletions

View File

@@ -464,26 +464,32 @@ bool UdpNetworkedPhysicsProcessor::processCommand(const struct SharedMemoryComma
printf("PhysicsClientUDP::processCommand\n");
}
// int sz = sizeof(SharedMemoryCommand);
int timeout = 1024 * 1024 * 1024;
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
m_data->m_cs->lock();
m_data->m_clientCmd = clientCmd;
m_data->m_hasCommand = true;
m_data->m_cs->unlock();
while (m_data->m_hasCommand && (timeout-- > 0))
while ((m_data->m_hasCommand) && (clock.getTimeInSeconds()-startTime < timeOutInSeconds))
{
b3Clock::usleep(0);
}
#if 0
timeout = 1024 * 1024 * 1024;
bool hasStatus = false;
b3Clock clock;
double startTime = clock.getTimeInSeconds();
double timeOutInSeconds = 10;
const SharedMemoryStatus* stat = 0;
while ((!hasStatus) && (timeout-- > 0))
while ((!hasStatus) && (clock.getTimeInSeconds() - startTime < timeOutInSeconds))
{
hasStatus = receiveStatus(serverStatusOut, bufferServerToClient, bufferSizeInBytes);
b3Clock::usleep(100);