action_server.client

Classes

TaskOutcome

Client

A client for the action server

Functions

task_outcome_from_result(result)

Converts action_server_msgs.msg.TaskResult to TaskOutcome class

Module Contents

class action_server.client.TaskOutcome(result=RESULT_UNKNOWN, messages=None, missing_field='')[source]

Bases: object

RESULT_MISSING_INFORMATION = 0
RESULT_TASK_EXECUTION_FAILED = 1
RESULT_UNKNOWN = 2
RESULT_SUCCEEDED = 3
result = 2
missing_field = ''
messages = None
property succeeded
__repr__()[source]
action_server.client.task_outcome_from_result(result)[source]

Converts action_server_msgs.msg.TaskResult to TaskOutcome class

Parameters:

result – (action_server_msgs.msg.TaskResult) result input

Returns:

(TaskOutcome) result output

class action_server.client.Client(robot_name)[source]

Bases: object

A client for the action server

Wraps the client side of the actionlib interface so that it can be easily used in client side applications.

Example

client = Client(‘amigo’) semantics = “{‘actions’: [{‘action’: ‘say’, ‘sentence’: ‘ROBOT_NAME’}]}” client.send_task(semantics)

_action_client
get_actions_proxy
get_actions()[source]

Query the available actions from the action server.

Returns:

List of action names as registered with the action server, or an empty list if the service call fails.

send_async_task(semantics, done_cb=None, feedback_cb=None)[source]

Send a task to the action server and return immediately. A task is composed of one or multiple actions.

Parameters:
  • semantics – A json string with a list of dicts, every dict in the list has at least an ‘action’ field, and depending on the type of action, several parameter fields may be required.

  • done_cb – (callable) Callback that gets called on transitions to Done. The callback should take one parameter: TaskOutCome

  • feedback_cb – (callable)Callback that gets called whenever feedback for this goal is received. Takes one parameter: the feedback.

send_task(semantics)[source]

Send a task to the action server. A task is composed of one or multiple actions.

Parameters:

semantics – A json string with a list of dicts, every dict in the list has at least an ‘action’ field, and depending on the type of action, several parameter fields may be required.

Returns:

result output, which provides information about success of the task execution and some information messages

Return type:

TaskOutcome

cancel_all()[source]

Cancels all goals of the action client

cancel_all_async()[source]

Cancels all goals of the action client and returns directly without waiting for the result