Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

The Mode Supervisor


Detailed Description

In order to facilitate defining and controlling composite operational scenarios within a complete robotic system, RHexLib uses "modes". Modes are entities that provide convenient facilities for receiving commands and parameters and sending state updates from and to remote clients. Switching between modes is handled by the mode supervisor, which is a configurable high level module that can also be accessed through the network. This page outlines how these tools can be used, while the specific details can be found in the documentation for individual classes.

Programs using the mode supervisor facilities usually create an instance of the ModeSupervisor class in main(), which is then be added to the module manager's database and activated. Often, this is the only module explicitly activated during initialization and all further module control is performed from within individual modes and modules.

The mode supervisor uses the database facilities to accept commands from a remote user interface or execution master. The structures ModeSupervisorCommands_t and ModeSupervisorState_t define the contents of the database entries that are used to transfer commands and states, respectively. In particular, commands are sent to the mode supervisor through the entry with the name defined in MS_COMMANDS_ENTRY_NAME whereas the mode supervisor responds with the received commands through the entry with the name defined in MS_CURCOMMANDS_ENTRY_NAME. Finally, the supervisor state is published in the entry whose name is determined by the macro MS_STATE_ENTRY_NAME. Clients should subscribe to these entries to communicate with the mode supervisor.

The mode supervisor also publishes in the database, a list of modes currently in its database. This is done through a collection of entries, all prefixed with the string defined in the macro MS_MODELIST_ENTRY_PREFIX, appended with a three digit count. Clients can determine the number of modes through ModeSupervisorState_t::numOfModes and iterate through these entries (with contents of type ModeInfo_t) to find out about modes recognized by the supervisor.

The mode supervisor periodically monitors the contents of the "command" entry in the blackboard and attempts to perform the requested task. After each check, it publishes the commands that it receives in the "current commands" entry and publishes the results in the "state" entry. Remote clients can monitor the "current commands" and "state" entries for feedback on success/failure of their requests.

When the mode supervisor receives a mode change command through ModeSupervisorCommands_t::newmode, it first checks whether the new mode is ready for entry (see RHexMode::entryPostureCheck). If the mode is ready, the requested mode becomes active and acquires control. Mode pause and kill commands are also processed appropriately.

The operation of the mode supervisor also depends on two special modes: a calibration mode and a "safe" mode. The calibration mode can be chosen through the method ModeSupervisor::setCalib and must be successfully activated before any other mode can be used. The class RHexCalibMode defines the interface that calibration modes must be derived from.

The mode supervisor also needs to know how to put the robot in a safe state when the communication channel becomes unreliable. This accomplished through a "safe mode", chosen through ModeSupervisor::setSafe. Regardless of the state that the robot is in, this mode will be activated when communication with the OCU is disrupted for a configurable amount of time.

The following configuration file symbols are recognized by the mode supervisor:


Compounds

struct  ModeInfo_t
 Blackboard entry format for mode descriptions. More...

class  ModeSupervisor
 Generic module for switching and remote control of modes. More...

struct  ModeSupervisorCommands_t
 Blackboard entry format for mode supervisor commands. More...

struct  ModeSupervisorState_t
 Blackboard entry format for mode supervisor state. More...

class  RHexCalibMode
 Abstract base class for all calibration modes. More...

class  RHexMode
 Template class for all modes recognized by the mode supervisor. More...


Defines

#define MS_CLIENT_TIMEOUT
#define MS_COMMANDS_ENTRY_NAME
#define MS_CURCOMMANDS_ENTRY_NAME
#define MS_STATE_ENTRY_NAME
#define MS_MODELIST_ENTRY_PREFIX

Enumerations

enum  ModeSupervisorStatus_t {
  MS_SUCCESS, MS_INV_CMD, MS_NOMODE, MS_NOCALIB,
  MS_NOTREADY
}


Define Documentation

#define MS_CLIENT_TIMEOUT
 

Default time in msec we will continue operation without communication

#define MS_COMMANDS_ENTRY_NAME
 

Blackboard entry name for incoming commands to the mode supervisor.

#define MS_CURCOMMANDS_ENTRY_NAME
 

Blackboard entry name for command confirmations from the mode supervisor.

#define MS_MODELIST_ENTRY_PREFIX
 

Blackboard name prefix for mode supervisor mode description entries.

#define MS_STATE_ENTRY_NAME
 

Blackboard entry name for mode supervisor state broadcast.


Enumeration Type Documentation

enum ModeSupervisorStatus_t
 

Mode supervisor status as a result of the last command.

Enumeration values:
MS_SUCCESS  Mode switch successful
MS_INV_CMD  Invalid command
MS_NOMODE  Requested mode not found
MS_NOCALIB  Calibration not completed
MS_NOTREADY  Mode is not ready for entry


RHexLib Reference Documentation