as2_python_api.behavior_manager.behavior_manager module

Behavior manager.

class as2_python_api.behavior_manager.behavior_manager.DroneBehaviorManager

Bases: object

Handle behavior control.

static drone_behavior_func(behaviors: list | str, uav: DroneInterfaceBase, func)

Call behavior method.

Parameters:
  • behavior (list | str) – _description_

  • uav (DroneInterfaceBase) – _description_

  • func (_type_) – _description_

Returns:

_description_

Return type:

_type_

static get_behavior_status(uav: DroneInterfaceBase)

Get behavior status for an interface.

Returns:

dictionary with namespace and behavior status

Return type:

dict(namespace, list(int))

static pause_all_behaviors(uav: DroneInterfaceBase)

Pause all behaviors for a drone.

Returns:

_description_

Return type:

dict {behavior: bool}

static pause_behaviors(behaviors: list | str, uav: DroneInterfaceBase)

Pause all behaviors in list.

Parameters:
Returns:

_description_

Return type:

_type_

static resume_all_behaviors(uav: DroneInterfaceBase)

Resume all behaviors for a drone.

Returns:

_description_

Return type:

dict {behavior: bool}

static resume_behaviors(behaviors: list | str, uav: DroneInterfaceBase)

Resume all behaviors in list.

Parameters:

behavior (_type_) – _description_

Returns:

_description_

Return type:

bool

static stop_all_behaviors(uav: DroneInterfaceBase)

Stop all behaviors for a drone.

Returns:

_description_

Return type:

dict {behavior: bool}

static stop_behaviors(behaviors: list | str, uav: DroneInterfaceBase)

Stop all behaviors in list.

Parameters:

behavior (_type_) – _description_

Returns:

_description_

Return type:

bool

class as2_python_api.behavior_manager.behavior_manager.SwarmBehaviorManager

Bases: object

Swam Behavior Manager.

static get_behaviors_status(drone_interface_list: list[DroneInterfaceBase])

Get behavior status for each interface.

Returns:

dictionary with namespace and behavior status

Return type:

dict {drone_id:{behavior:status(int)}}

static pause_all_behaviors(drone_interface_list: list[DroneInterfaceBase])

Pause all behaviors for each interface.

Parameters:

drone_id_list (_type_, optional) – _description_, defaults to None

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static pause_behaviors(behavior_dict)

Pause behaviors.

Parameters:

behavior_dict (_type_) – _description_

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static resume_all_behaviors(drone_interface_list: list[DroneInterfaceBase])

Resume all behaviors for all drones in the swarm.

Parameters:

drone_id_list (_type_, optional) – _description_, defaults to None

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static resume_behaviors(behavior_dict)

Resume behaviors.

Parameters:

behavior_dict (_type_) – _description_

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static stop_all_behaviors(drone_interface_list: list[DroneInterfaceBase])

Stop all behaviors for all drones in the swarm.

Parameters:

drone_id_list (_type_, optional) – _description_, defaults to None

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static stop_behaviors(behavior_dict)

Stop behaviors.

Parameters:

behavior_dict (_type_) – _description_

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static swarm_all_behavior_func(drone_interface_list, func)

Execute a behavior function for all drones in the swarm.

Parameters:
  • func (_type_) – _description_

  • drone_interface_list (_type_) – _description_

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

static swarm_behavior_func(behavior_dict, func)

Execute a behavior function for all drones in the swarm.

Parameters:
  • func (_type_) – _description_

  • behavior_dict (_type_) – _description_

Returns:

_description_

Return type:

dict {drone_id:{behavior: bool}}

class as2_python_api.behavior_manager.behavior_manager.ThreadWithReturnValue(group=None, target=None, name=None, args=(), kwargs={}, Verbose=None)

Bases: Thread

join(*args)

Wait until the thread terminates.

This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.

When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.

run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.