PyBullet: tweak in TCP server for VR - ROS bridge

This commit is contained in:
Erwin Coumans 2018-07-03 16:30:54 -07:00
parent c0183d4834
commit 2ce1e65b53

View File

@ -177,22 +177,30 @@ int main(int argc, char *argv[])
SharedMemoryCommand cmd;
SharedMemoryCommand* cmdPtr = 0;
int type = *(int*)&bytesReceived[0];
//performance test
if (numBytesRec == sizeof(int))
{
cmdPtr = &cmd;
cmd.m_type = *(int*)&bytesReceived[0];
}
if (numBytesRec == sizeof(SharedMemoryCommand))
{
cmdPtr = (SharedMemoryCommand*)&bytesReceived[0];
}
else
{
cmdPtr = (SharedMemoryCommand*)&bytesReceived[0];
if (numBytesRec == sizeof(SharedMemoryCommand))
{
cmdPtr = (SharedMemoryCommand*)&bytesReceived[0];
}
else
{
if (numBytesRec==36)
{
cmdPtr = &cmd;
memcpy(&cmd, &bytesReceived[0], numBytesRec);
}
}
}
if (cmdPtr)
{