Skip to content

Commit

Permalink
Allow user to specify timeout for Python clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdeery committed May 4, 2018
1 parent 297f1c4 commit a48c68f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PythonClient/AirSimClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -509,10 +509,10 @@ def simContinueForTime(self, seconds):

# ----------------------------------- 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)
Expand Down Expand Up @@ -604,10 +604,10 @@ def setRCData(self, rcdata = RCData()):

# ----------------------------------- 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)
Expand Down

0 comments on commit a48c68f

Please sign in to comment.