allow to specify hostName

This commit is contained in:
Erwin Coumans
2020-12-22 20:13:03 -08:00
parent df09fd9ed3
commit 3f9d0197ec
2 changed files with 6 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ import pybullet
class BulletClient(object):
"""A wrapper for pybullet to manage different clients."""
def __init__(self, connection_mode=None):
def __init__(self, connection_mode=None, hostName=None):
"""Creates a Bullet client and connects to a simulation.
Args:
@@ -27,7 +27,10 @@ class BulletClient(object):
return
else:
connection_mode = pybullet.DIRECT
self._client = pybullet.connect(connection_mode)
if hostName is None:
self._client = pybullet.connect(connection_mode)
else:
self._client = pybullet.connect(connection_mode, hostName=hostName)
def __del__(self):
"""Clean up connection if not already done."""

View File

@@ -403,6 +403,7 @@ static PyObject* pybullet_connectPhysicsServer(PyObject* self, PyObject* args, P
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|is", kwlist1, &method, &key, &options))
{
PyErr_Clear();
int port = -1;
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|sis", kwlist2, &method, &hostName, &port, &options))
{