TaskHandler

Module

The TaskHandler module allows the execution of a sequence of tasks, specified by a Lua script, which can either be written by hand or generated by using the graphical programming interface TaskEditor.

See Lua Script for more information on how to write a script by hand.

Most functions require a special permission, see pilot.permission_e.

Functions

Common Parameters

Hash64 jobid
Optional job id, to identify a new program execution. If not specified (or set to zero) will generate a new random id. See vnx.Hash64.

Execute Functions

The following functions will cancel any running program beforehand, start to execute the new program and return immediately.

void execute_file(string filename, vector<Variant> params, Hash64 jobid, bool blocking)

Starts to execute the specified Lua script file, i.e. executes its main function with the given parameters. The filename is relative to the pilot home folder, e.g. ~/pilot/. If blocking is set to true, the call blocks until the program is finished or aborted, otherwise it returns immediately. Requires permission EXECUTE_SCRIPT.

void execute_program(string program, vector<Variant> params, Hash64 jobid, bool blocking)

Starts to execute the given Lua script code, i.e. executes its main function with the given parameters. If blocking is set to true, the call blocks until the program is finished or aborted, otherwise it returns immediately. Requires permission UPLOAD_SCRIPT.

Intervene Functions

void cancel_program()

Will cancel a running program at the next opportunity, usually after finishing the current task. Requires permission INTERVENE_SCRIPT.

void pause_program()

Will pause a running program at the next opportunity, usually after finishing the current task. Requires permission INTERVENE_SCRIPT.

void resume_program()

Will resume executing a paused program. Requires permission INTERVENE_SCRIPT.