Skip to content

Scheduling System

Tom Tzook edited this page Aug 9, 2019 · 8 revisions

The Scheduling System is a management tool for running operations with the robot which allows execution complex tasks concurrently.

Introduction

Consider an operating system. Modern operating systems contain a component for scheduling process execution. This component, which did not exist in initial operating systems, is what allows the operating system to run multiple processes concurrently.

Similarly, we found that trying to manage tasks for multiple robot systems, which could actually run at the same, is extremely difficult. This is exactly what the Scheduling System offers robot developers.

API

The scheduler is implemented in the Scheduler class.

Execution

The scheduler can execute tasks and actions. Tasks are simple operations, which can be executed once, or repeatedly. Actions are complex tasks, which support dependencies, execution steps, and are generally more powerful.

Execution is synchronous to the robot main thread, and done in a batch. Basically, this means that thread-safety is largely unnecessary. In addition, this means the executing heavy tasks, such as IO operations is not recommended.

Execution Modes

The scheduler supports several execution modes:

  • ALL: execute both tasks and actions
  • ACTIONS_ONLY: execute only actions
  • TASKS_ONLY: execute only tasks
  • NOTHING: don't execute anything

Executing Tasks

Tasks take the form of SchedulerTask. This interface has a single method run, which returns true to continue running, or false to stop running.

To add a task for execution, call Scheduler.add. You may remove a task by calling Scheduler.remove. Due to the synchronous nature of the scheduler, a new task will only start when the scheduler has performed it's iteration, but removal is immediate.

Use the Tasks class for helper methods for creating tasks.

Executing Actions

Clone this wiki locally