From 1262adeaec389dea8905f78231046e9038b3e763 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Thu, 5 Oct 2017 09:57:17 -0700 Subject: [PATCH] build a named tuple for 'getConnectionInfo' remove debug code --- .../PhysicsServerCommandProcessor.cpp | 34 +------------------ examples/pybullet/pybullet.c | 18 +++------- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 9fce685ae..271450a0d 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -3003,39 +3003,7 @@ int PhysicsServerCommandProcessor::createBodyInfoStream(int bodyUniqueId, char* bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes ) { // BT_PROFILE("processCommand"); - int szc = sizeof(SharedMemoryCommand); - int sz = sizeof(SharedMemoryStatus); - - int sz1 = sizeof(BulletDataStreamArgs); - int sz2 = sizeof(SdfLoadedArgs); - int sz3 = sizeof(SendActualStateArgs);//30k - int sz4= sizeof(SendDebugLinesArgs); - int sz5= sizeof(SendPixelDataArgs); - int sz6 = sizeof(RigidBodyCreateArgs); - int sz7 = sizeof(CalculateInverseDynamicsResultArgs); - int sz8 = sizeof(CalculateJacobianResultArgs); - int sz9 = sizeof(CalculateMassMatrixResultArgs);//130k - int sz10 = sizeof(SendContactDataArgs); - int sz11 = sizeof(SendOverlappingObjectsArgs); - int sz12 = sizeof(CalculateInverseKinematicsResultArgs); - int sz13 = sizeof(SendVisualShapeDataArgs); - int sz14 = sizeof(UserDebugDrawResultArgs); - int sz15 = sizeof(b3UserConstraint); - int sz16 = sizeof(SendVREvents); - int sz17 = sizeof(SendKeyboardEvents); - int sz18 = sizeof(SendRaycastHits); - int sz19 = sizeof(StateLoggingResultArgs); - int sz20 = sizeof(b3OpenGLVisualizerCameraInfo); - int sz21 = sizeof(b3ObjectArgs); - int sz22 = sizeof(b3DynamicsInfo); - int sz23 = sizeof(b3CreateCollisionShapeResultArgs); - int sz24 = sizeof(b3CreateVisualShapeResultArgs); - int sz25 = sizeof(b3CreateMultiBodyResultArgs); - int sz26 = sizeof(b3SendCollisionInfoArgs); - int sz27 = sizeof(SendMouseEvents); - int sz28 = sizeof(b3LoadTextureResultArgs); - int sz29 = sizeof(b3CustomCommandResultArgs); - + bool hasStatus = false; { diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index f08b4c4d4..b3be00d45 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -509,6 +509,7 @@ static PyObject* pybullet_getConnectionInfo(PyObject* self, PyObject* args, PyOb int isConnected=0; int method=0; PyObject* pylist = 0; + PyObject* val = 0; b3PhysicsClientHandle sm = 0; static char* kwlist[] = {"physicsClientId", NULL}; if (!PyArg_ParseTupleAndKeywords(args, keywds, "|i", kwlist, &physicsClientId)) @@ -525,10 +526,8 @@ static PyObject* pybullet_getConnectionInfo(PyObject* self, PyObject* args, PyOb } } - pylist = PyTuple_New(2); - PyTuple_SetItem(pylist, 0, PyInt_FromLong(isConnected)); - PyTuple_SetItem(pylist, 1, PyInt_FromLong(method)); - return pylist; + val = Py_BuildValue("{s:i,s:i}","isConnected", isConnected, "connectionMethod", method); + return val; } @@ -948,19 +947,10 @@ static PyObject* pybullet_setPhysicsEngineParameter(PyObject* self, PyObject* ar { b3PhysicsParamSetDefaultFrictionERP(command,frictionERP); } - //ret = b3PhysicsParamSetRealTimeSimulation(command, enableRealTimeSimulation); statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command); } -#if 0 - b3SharedMemoryCommandHandle b3InitPhysicsParamCommand(b3PhysicsClientHandle physClient); - int b3PhysicsParamSetGravity(b3SharedMemoryCommandHandle commandHandle, double gravx, double gravy, double gravz); - int b3PhysicsParamSetTimeStep(b3SharedMemoryCommandHandle commandHandle, double timeStep); - int b3PhysicsParamSetDefaultContactERP(b3SharedMemoryCommandHandle commandHandle, double defaultContactERP); - int b3PhysicsParamSetNumSubSteps(b3SharedMemoryCommandHandle commandHandle, int numSubSteps); - int b3PhysicsParamSetRealTimeSimulation(b3SharedMemoryCommandHandle commandHandle, int enableRealTimeSimulation); - int b3PhysicsParamSetNumSolverIterations(b3SharedMemoryCommandHandle commandHandle, int numSolverIterations); -#endif + Py_INCREF(Py_None); return Py_None;