From c44c8a9e9a404270c86797806c4a113f978fd018 Mon Sep 17 00:00:00 2001 From: "justin.schaare" Date: Wed, 19 Jun 2024 15:26:43 +0900 Subject: [PATCH 1/2] add IsWaitingResponse --- python/mujinplanningclient/planningclient.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/mujinplanningclient/planningclient.py b/python/mujinplanningclient/planningclient.py index dcdbc17..c9aa2d2 100644 --- a/python/mujinplanningclient/planningclient.py +++ b/python/mujinplanningclient/planningclient.py @@ -283,6 +283,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. From ed87e9329c0a6a1ce6ea1bd59d7f9c89353f75cc Mon Sep 17 00:00:00 2001 From: "justin.schaare" Date: Wed, 19 Jun 2024 15:27:03 +0900 Subject: [PATCH 2/2] add GetState to mobilerobotplanningclient --- .../mobilerobotplanningclient.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/python/mujinplanningclient/mobilerobotplanningclient.py b/python/mujinplanningclient/mobilerobotplanningclient.py index 0236008..9d04337 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) + # TODO: Adding optional parameters only for dev purpose, should be spreaded out to arg list. def ManageMobileRobotTasks(self, tasks, slaverequestid=None, timeout=None, fireandforget=None, respawnopts=None, checkpreempt=True, forcereload=False, blockwait=True, **kwargs): """