as2_python_api.behavior_actions.behavior_handler module

Behavior handler. Abstract class to handle behaviors.

class as2_python_api.behavior_actions.behavior_handler.BehaviorHandler(node: rclpy.node.Node, action_msg, behavior_name)

Bases: ABC

Behavior handler.

exception BehaviorNotAvailable

Bases: Exception

Behavior not available exception.

exception GoalRejected

Bases: Exception

Goal rejected exception.

exception ResultUnknown

Bases: Exception

Result unknown exception.

TIMEOUT = 1
destroy() None

Clean exit.

property feedback

Behavior feedback.

Returns:

rclpy.Feedback

is_running() bool

Check if behavior is running.

Returns:

running or not

modify(goal_msg)
pause() bool

Pause current behavior.

Returns:

pause succeed or not

Return type:

bool

property result

Behavior result.

Raises:

self.ResultUnknown – on result not ready

Returns:

rclpy.Result

property result_status

Behavior result status.

Returns:

rclpy.GoalStatus

resume(wait_result: bool = True) bool

Continue with current behavior.

Parameters:

wait_result (bool, optional) – wait to behavior end, defaults to True

Returns:

resume succeed or not

Return type:

bool

start(goal_msg, wait_result: bool = True) bool

Start behavior.

Parameters:
  • goal_msg (Goal) – behavior goal

  • wait_result (bool, optional) – wait to behavior end, defaults to True

Raises:

self.GoalRejected – on goal rejection

Returns:

succeeded or not

Return type:

bool

property status: int

Behavior internal status.

Returns:

IDLE, PAUSED, RUNNING

Return type:

int

stop() bool

Stop current behavior.

Returns:

stop succeed or not

Return type:

bool

wait_to_result() bool

Wait to inner action to finish.

Raises:

GoalFailed – When behavior result not succeeded

Returns:

succeeded or not

Return type:

bool