Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IsWaitingResponse to planningclient, Add GetState to mobilerobotplanningclient #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions python/mujinplanningclient/mobilerobotplanningclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions python/mujinplanningclient/planningclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down