copapy.Task#

class copapy.Task(outputs, period=None, priority=None, mem=None)#

Bases: object

Part of a copapy program that computes the given outputs.

A periodic task is released every period, starting at time 0. A task without period only runs on request by exec of the target.

A task reads its inputs at its release and publishes its outputs at the end of its period: copapy values (inputs written by the host) and outputs of other tasks are read from the copies made at the release. Everything else required for the outputs is computed by the task itself.

Create a task.

Parameters:
  • outputs (Any) – Values, vectors, tensors and arrays computed by the task, also in (nested) sequences or as values of dicts. They can be read by read_value of the target and used by other tasks.

  • period (float | None) – Period in seconds, a multiple of the tick of the target. None for a task that only runs on request (exec).

  • priority (int | None) – Tasks with higher priority preempt tasks with lower priority. None is priority 0. Of tasks with equal priority the task with the shorter period runs first.

  • mem (Any) – Memory region for the data of the task on targets with several memory regions