mx_task

Versión 1.0.2 (97,7 KB) por Carlos Ma
A simple to use MATLAB library for "real-time" multi-tasking.
37 Descargas
Actualizado 29 jul 2019

# mx_task
A simple to use MATLAB library for "real-time" multi-tasking.

Multitasking with tic-toc and robotics.Rate require full CPU usage which is sometimes undesired.

The new mx_task class allows users to achieve an almost real-time multitasking functionality in MATLAB, whilst not requiring full CPU usage.

---
Supports Linux and Windows. Linux systems generally have a better RT behaviour.

Functionality verified on:
- a 18.04LTS machine with MATLAB R2016b and R2019a,
- a Windows 10 machine with MATLAB R2018b.

Example 0 shows the basic functionalities of the mx_task library.

Example 1 shows how to implement multi-tasking.

Example 2 is a benchmarking script for comparisons between the scheduling capabilities of mx_task, tictoc, and robotics.Rate.

# Usage
1. First define a task with a function and affix it to a new mx_task instance. Define the desired task period at the second input.

myTask = mx_task(@()myFunc, 1/10);

function myFunc()

fprintf("Hello world.\n");

end

2. Capture the start time in [seconds since epoch] with mx_sleep().

time_start = mx_sleep(0); % sleeps for 0 seconds

time_now = time_start;

3. Create a while loop with a simulation time trap in the condition. mx_sleep for 1us for an almost real-time scheduling quality. Run task by task.run(time_now).

while (time_now <= time_start + 10) % run tasks for 10 seconds.

time_now = mx_sleep(1/1000000); % 1MHz scheduler frequency. Set to mx_sleep(0) for an enhanced real-time behaviour (at 100% CPU though).

myTask.run(time_now);

end

# Installation
Move to the mx_task directory and run the install script.

Citar como

Carlos Ma (2026). mx_task (https://github.com/carl0sma/mx_task), GitHub. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2019a
Compatible con cualquier versión desde R2016b hasta R2019a
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Performance and Memory en Help Center y MATLAB Answers.

No se pueden descargar versiones que utilicen la rama predeterminada de GitHub

Versión Publicado Notas de la versión
1.0.2

Validated Windows compatibility. A Linux system is still recommended for superior RT performances.

1.0.1

Validated Windows support, although its RT behaviour is much worse than at on a Linux system.

1.0.0

Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.