synchros2.action_client module

class synchros2.action_client.ActionClientWrapper[source]

Bases: ActionClient

A wrapper for ros2’s ActionClient for extra functionality

__init__(action_type: Type, action_name: str, node: rclpy.node.Node | None = None, wait_for_server: bool = True) None[source]

Constructor

Parameters:
  • action_type (Type) – The type of the action

  • action_name (str) – The name of the action (for logging purposes)

  • node (Optional[Node]) – optional node for action client, defaults to the current process node

  • wait_for_server (bool) – Whether to wait for the server

send_goal_and_wait(action_name: str, goal: Any | None, timeout_sec: float | None = None) Any | None[source]

Sends an action goal and waits for the result

Parameters:
  • action_name (str) – A representative name of the action for logging

  • goal (Any) – The Action Goal sent to the action server

  • timeout_sec (Optional[float]) – A timeout for waiting on a response/result

  • timeout (from the action server. Setting to None creates no)

Return type:

Optional[Any]

send_goal_async_handle(action_name: str, goal: Any, *, result_callback: Callable[[Any], None] | None = None, feedback_callback: Callable[[Any], None] | None = None, on_failure_callback: Callable[[], None] | None = None) ActionHandle[source]

Sends an action goal asynchronously and create an ActionHandle

Parameters:
  • action_name (str) – A representative name of the action for logging

  • goal (Action.Goal) – The Action Goal sent to the action server

  • result_callback (Optional[Callable[[Action.Result], None]]) – A callback to process/handle

  • command (the feedback received during the execution of the)

  • feedback_callback (Optional[Callable[[Action.Feedback], None]]) – A callback to process/handle

  • command

  • on_failure_callback (Optional[Callable[[None], None]]) – A callback to process/handle when

  • reasons (the action fails for various)

Returns:

An object to manage the asynchronous lifecycle of the action request

Return type:

ActionHandle