as2_python_api.behavior_actions package

Submodules

as2_python_api.behavior_actions.behavior_handler module

behavior_handler.py

class as2_python_api.behavior_actions.behavior_handler.BehaviorHandler(node: Node, action_msg, behavior_name)[source]

Bases: ABC

Behavior handler

exception BehaviorNotAvailable[source]

Bases: Exception

Behavior not available exception

exception GoalRejected[source]

Bases: Exception

Goal rejected exception

exception ResultUnknown[source]

Bases: Exception

Result unknown exception

TIMEOUT = 1
destroy() None[source]

Clean exit

property feedback

Behavior feedback

Returns:

rclpy.Feedback

modify(goal_msg)[source]
pause() bool[source]

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[source]

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[source]

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 status

Returns:

IDLE, PAUSED, RUNNING

Return type:

int

stop() bool[source]

Stop current behavior

Returns:

stop succeed or not

Return type:

bool

wait_to_result() bool[source]

Wait to inner action to finish

Raises:

GoalFailed – When behavior result not succeeded

Returns:

succeeded or not

Return type:

bool

as2_python_api.behavior_actions.follow_reference_behavior module

follow_reference_behavior.py

class as2_python_api.behavior_actions.follow_reference_behavior.FollowReferenceBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

FollowReference Behavior

modify(pose: Tuple[Pose, PoseStamped], frame_id: str, speed_x: float, speed_y: float, speed_z: float, yaw_mode: int, yaw_angle: float)[source]
start(pose: Tuple[Pose, PoseStamped], frame_id: str, speed_x: float, speed_y: float, speed_z: float, yaw_mode: int, yaw_angle: float, wait_result: bool = False) bool[source]

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

as2_python_api.behavior_actions.followpath_behavior module

followpath_behavior.py

class as2_python_api.behavior_actions.followpath_behavior.FollowPathBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

FollowPath Behavior

modify(path: list | tuple | Path | geographic_msgs.msg.GeoPath | as2_msgs.msg.PoseWithID, speed: float, yaw_mode: int, yaw_angle: float, frame_id: str = 'earth')[source]
start(path: list | tuple | Path | geographic_msgs.msg.GeoPath | as2_msgs.msg.PoseWithID, speed: float, yaw_mode: int, yaw_angle: float, frame_id: str = 'earth', wait_result: bool = True) bool[source]

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

as2_python_api.behavior_actions.go_to_behavior module

go_to_behavior.py

class as2_python_api.behavior_actions.go_to_behavior.GoToBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

GoTo Behavior

modify(pose: Tuple[Pose, PoseStamped, geographic_msgs.msg.GeoPose, geographic_msgs.msg.GeoPoseStamped], speed: float, yaw_mode: int, yaw_angle: float, frame_id: str = 'earth')[source]
start(pose: Tuple[Pose, PoseStamped, geographic_msgs.msg.GeoPose, geographic_msgs.msg.GeoPoseStamped], speed: float, yaw_mode: int, yaw_angle: float, frame_id: str = 'earth', wait_result: bool = True) bool[source]

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

as2_python_api.behavior_actions.land_behavior module

land_behavior.py

class as2_python_api.behavior_actions.land_behavior.LandBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

Land Behavior

modify(speed: float)[source]
start(speed: float, wait_result: bool = True) bool[source]

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

as2_python_api.behavior_actions.point_gimbal_behavior module

point_gimbal_behavior.py

class as2_python_api.behavior_actions.point_gimbal_behavior.PointGimbalBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

PointGimbal Behavior

modify(pose: Tuple[Pose, PoseStamped], frame_id: str)[source]
start(pose: Tuple[Pose, PoseStamped], frame_id: str, wait_result: bool = False) bool[source]

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

as2_python_api.behavior_actions.takeoff_behavior module

takeoff_behavior.py

class as2_python_api.behavior_actions.takeoff_behavior.TakeoffBehavior(drone: DroneInterfaceBase)[source]

Bases: BehaviorHandler

Takeoff Behavior

modify(height: float, speed: float) bool[source]
start(height: float, speed: float, wait_result: bool = True) bool[source]

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

Module contents