A task is a database record of some experiment that we want to run.
Usually, a task will involve an object, a hand, and some sort of experiment, such as planning grasps and recording them in the database. This class encapsulates a task, plus it offers some connections so that the task can be run automatically by a DBTaskDispatcher.
A DBTask is responsible for its own event management. It can use a callback system (i.e. surrender control and then get it back later via its own timers or callbacks). For example, this can be achieved by using one of the EGPlanners, which do that natively.
A DBTask must implement the following interface:
- if the DBTask is one-shot, it can do all the work in start() and set its status to either DONE or ERROR at the end. The Dispatcher will see this, clean up and go to the next Task.
- if the DBTask is event based, start() must set up the DBTask event loop, then leave mStatus = RUNNING, and then surrender control. The Dispatcher will in turn surrender control and let the DBTask event loop do its thing.
- when the DBTask is done, it is responsible for setting its own mStatus to DONE. The DBTaskDispatcher wakes up periodically and checks on this. When it sees that the status of the DBTask is DONE it will clean up and continue to another task.
Definition at line 79 of file dbTask.h.