btlib.logs

Functions to read logs and convert them to values per bt node.

Module Contents

Functions

_get_id_and_state_from_line

Get id and return state from line.

read_log_fbl

Read log file and return values per node.

merge_values

Merge values of two value maps.

Data

logger

API

btlib.logs.logger = 'getLogger(...)'
btlib.logs._get_id_and_state_from_line(line: str) Tuple[int, btlib.common.NODE_STATE]

Get id and return state from line.

btlib.logs.read_log_fbl(fname: str, g: networkx.Graph) Tuple[btlib.VALUE_MAP, btlib.VALUE_MAP_RETURN_STATES]

Read log file and return values per node.

Parameters:
  • fname – Log file name.

  • g – Graph representing the behavior tree.

Returns:

Tuple of values_count: How often a node was executed. values_success: How often a node was successful (positive value) vs failed (negative value).

btlib.logs.merge_values(values1: Optional[Union[btlib.VALUE_MAP, btlib.VALUE_MAP_RETURN_STATES]], values2: Optional[Union[btlib.VALUE_MAP, btlib.VALUE_MAP_RETURN_STATES]]) Union[btlib.VALUE_MAP, btlib.VALUE_MAP_RETURN_STATES]

Merge values of two value maps.

On the lowest level this will add the two values if they are present.