rcognita.callbacks

This module contains callbacks. Callbacks are lightweight event handlers, used mainly for logging.

To make a method of a class trigger callbacks, one needs to decorate the class (or its base class) with @introduce_callbacks() and then also decorate the method with @apply_callbacks.

Callbacks can be registered by simply supplying them in the respective keyword argument:

@rcognita.main(callbacks=[...], ...)
def my_app(config):
    ...

Functions

apply_callbacks(method)

Decorator that applies a list of callbacks to a given method of an object.

method_callback(method_name[, class_name, …])

Creates a callback class that logs the output of a specific method of a class or any class.

Classes

Callback(logger[, log_level])

This is the base class for a callback object.

ObjectiveCallback(logger[, log_level])

A Callback class that logs the current objective value of an Actor instance.

StateCallback(logger[, log_level])

StateCallback is a subclass of the Callback class that logs the state of a system object when the compute_closed_loop_rhs method of the System class is called.

introduce_callbacks([default_callbacks])

A class decorator that introduces a callbacks attribute to the decorated class.