diff --git a/python/mujinplanningclient/mobilerobotplanningclient.py b/python/mujinplanningclient/mobilerobotplanningclient.py index 3c7804d..e143ec3 100644 --- a/python/mujinplanningclient/mobilerobotplanningclient.py +++ b/python/mujinplanningclient/mobilerobotplanningclient.py @@ -15,6 +15,23 @@ def __init__(self, **kwargs): kwargs['tasktype'] = self.tasktype # override task type super(MobileRobotPlanningClient, self).__init__(**kwargs) + def GetState(self, timeout=10, fireandforget=False, **kwargs): + """ + Args: + timeout (float, optional): Time in seconds after which the command is assumed to have failed. (Default: 10.0) + fireandforget (bool, optional): If True, does not wait for the command to finish and returns immediately. The command remains queued on the server. (Default: False) + unit (str, optional): The unit of the given values. (Default: 'mm') + robotname (str, optional): Name of the robot + toolname (str, optional): Name of the manipulator. Defaults to currently selected tool + robotBridgeConnectionInfo (dict, optional): Information to set up a client to the robot bridge. + locationCollisionInfos (dict, optional): List of external collision IOs to be computed and sent in realtime. + """ + taskparameters = { + 'command': 'GetState', + } + taskparameters.update(kwargs) + return self.ExecuteCommand(taskparameters, timeout=timeout, fireandforget=fireandforget) + def ManageMobileRobotTasks(self, tasks, timeout=None, fireandforget=None, checkpreempt=True, blockwait=True, **kwargs): """ This function will initialize the planning thread if it's not started. diff --git a/python/mujinplanningclient/planningclient.py b/python/mujinplanningclient/planningclient.py index 8197fea..f613bc8 100644 --- a/python/mujinplanningclient/planningclient.py +++ b/python/mujinplanningclient/planningclient.py @@ -284,6 +284,12 @@ def ExecuteCommand(self, taskparameters, slaverequestid=None, timeout=None, fire return None return self._ProcessCommandResponse(response, command=command) + def IsWaitingResponse(self): + # type: () -> bool + """Returns whether the client is waiting for response on the command socket, and caller should call WaitForCommandResponse(). + """ + return self._commandsocket.IsWaitingReply() + def WaitForCommandResponse(self, timeout=None, command=None): """Waits for a response for a command sent on the RPC socket.