Merge pull request #1059 from jacobdeery/master

Allow user to specify timeout for Python clients
This commit is contained in:
Shital Shah 2018-05-04 15:33:32 -07:00 коммит произвёл GitHub
Родитель c122d2efc7 a48c68fc97
Коммит d088719d0b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -211,8 +211,8 @@ class CameraInfo(MsgpackMixin):
fov = -1
class AirSimClientBase:
def __init__(self, ip, port):
self.client = msgpackrpc.Client(msgpackrpc.Address(ip, port), timeout = 3600, pack_encoding = 'utf-8', unpack_encoding = 'utf-8')
def __init__(self, ip, port, timeout_value = 3600):
self.client = msgpackrpc.Client(msgpackrpc.Address(ip, port), timeout = timeout_value, pack_encoding = 'utf-8', unpack_encoding = 'utf-8')
@staticmethod
def stringToUint8Array(bstr):
@ -509,10 +509,10 @@ class AirSimClientBase:
# ----------------------------------- Multirotor APIs ---------------------------------------------
class MultirotorClient(AirSimClientBase, object):
def __init__(self, ip = ""):
def __init__(self, ip = "", timeout = 3600):
if (ip == ""):
ip = "127.0.0.1"
super(MultirotorClient, self).__init__(ip, 41451)
super(MultirotorClient, self).__init__(ip, 41451, timeout_value = timeout)
def takeoff(self, max_wait_seconds = 15):
return self.client.call('takeoff', max_wait_seconds)
@ -604,10 +604,10 @@ class MultirotorClient(AirSimClientBase, object):
# ----------------------------------- Car APIs ---------------------------------------------
class CarClient(AirSimClientBase, object):
def __init__(self, ip = ""):
def __init__(self, ip = "", timeout = 3600):
if (ip == ""):
ip = "127.0.0.1"
super(CarClient, self).__init__(ip, 42451)
super(CarClient, self).__init__(ip, 42451, timeout_value = timeout)
def setCarControls(self, controls):
self.client.call('setCarControls', controls)