more fixes in pybullet_gym envs/data.

implement pybullet.setAdditionalSearchPath
This commit is contained in:
Erwin Coumans
2017-08-27 19:34:00 -07:00
parent d9faea8c1c
commit 1569f3845c
18 changed files with 151 additions and 197 deletions

View File

@@ -3701,6 +3701,36 @@ static PyObject* pybullet_stopStateLogging(PyObject* self, PyObject* args, PyObj
return Py_None;
}
static PyObject* pybullet_setAdditionalSearchPath(PyObject* self, PyObject* args, PyObject* keywds)
{
static char* kwlist[] = {"path", "physicsClientId", NULL};
char* path = 0;
int physicsClientId = 0;
b3PhysicsClientHandle sm = 0;
if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|i", kwlist,
&path, &physicsClientId))
return NULL;
if (path)
{
b3SharedMemoryCommandHandle commandHandle;
b3SharedMemoryStatusHandle statusHandle;
sm = getPhysicsClient(physicsClientId);
if (sm == 0)
{
PyErr_SetString(SpamError, "Not connected to physics server.");
return NULL;
}
commandHandle = b3SetAdditionalSearchPath(sm, path);
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
}
Py_INCREF(Py_None);
return Py_None;
}
static PyObject* pybullet_setTimeOut(PyObject* self, PyObject* args, PyObject* keywds)
{
static char* kwlist[] = {"timeOutInSeconds", "physicsClientId", NULL};
@@ -7215,6 +7245,10 @@ static PyMethodDef SpamMethods[] = {
{"setTimeOut", (PyCFunction)pybullet_setTimeOut, METH_VARARGS | METH_KEYWORDS,
"Set the timeOut in seconds, used for most of the API calls."},
{"setAdditionalSearchPath", (PyCFunction)pybullet_setAdditionalSearchPath,
METH_VARARGS | METH_KEYWORDS,
"Set an additional search path, used to load URDF/SDF files."},
{"getAPIVersion", (PyCFunction)pybullet_getAPIVersion,
METH_VARARGS | METH_KEYWORDS,
"Get version of the API. Compatibility exists for connections using the same API version. Make sure both client and server use the same number of bits (32-bit or 64bit)."},