CogTask
A general-purpose low-latency application to serve cognitive tasks, built with egui.
Installation
The most reliable way to install CogTask is by installing Cargo through rustup and compiling the binaries locally.
Install Cargo:
|
Build binaries (choose one):
Features
By default (no features), this package should compile and run out-of-the-box on a reasonably recent macOS or Linux distribution. Some types of actions however depend on features that can be enabled during installation. These features are not enabled by default because they rely on system libraries that might not be installed on the OS out-of-the-box.
Currently, there are 4 main features that can be enabled:
- audio -- enables the
Audioaction via the ALSA sound library. - gstreamer -- enables the
StreamandVideoactions via the gstreamer backend. - ffmpeg (incomplete) -- enables the
StreamandVideoactions via the ffmpeg backend. - full -- a shorthand to enable the previous three features.
Examples:
- Stable binaries with full support:
- Nightly binaries with audio and gstreamer support:
Requirements:
Some features depend on certain libraries that might not come preinstalled on your OS. In these cases, before building the binaries with said features enabled, you need to first install the requirements:
audio
On linux, requires installing pkg-config and ALSA, e.g.:
gstreamer
On macOS, requires installing gstreamer, e.g.:
On linux, requires installing libgstreamer, e.g.:
ffmpeg
On linux, requires installing pkg-config and libavutil, e.g.:
- NOTE: Although it is not a requirement at compile time, to be able to use the ffmpeg backend, you need to have the ffmpeg library installed on the system during runtime.
Usage
This crate installs two binaries -- cog-launcher and cog-server.
cog-launcher: A launcher that provides a graphical interface to find and load tasks from disk.
cog-server /path/to/task: Used to run a specific task by providing the path to its directory. cog-launcher runs this binary when starting a task, so make sure both binaries are in the same directory.
For example, to run the Basic task in this repo, you would do the following:
Alternatively, you can run:
Then use the leftmost control icon to load the example/basic/ directory. Or, you can use the second button to open the parent example/ directory which contains all the example tasks within. The former, directly runs cog-server on the chosen task. The latter, displays a list of all tasks located in the chosen directory, which can be started by clicking the corresponding button.
Changelog
Version 0.2.0 has gone through a massive overhaul, transitioning from the GUI framework of iced to egui. The transition was done to solve a screen update skipping issue (which it did). There have been other pros and cons too:
- Text and widget styling is (much) more difficult in
egui. egui's Glow backend supports image/SVG.- Separating the
viewandupdatecalls allowed redesigning block architecture (the dependency graph) into an action tree. This change makes it very difficult to design a buggy task, and significantly simplifies task definition style. It slightly limits the task design flexibility, but it's worth it. This change also comes with an increased overhead sinceupdate/viewcalls traverse the entire active subset of the tree, instead of jumping to the end nodes. However, the tree overhead is generally low compared to action-specific overheads, so that's not a huge deal.