The VisAO Camera
VisAO::VisAOSimpleMotorCtrl Class Reference

A class to provide VisAO functionality to the adopt motor controller. More...

#include <VisAOSimpleMotorCtrl.h>

+ Inheritance diagram for VisAO::VisAOSimpleMotorCtrl:

Public Types

enum  control_modes {
  CMODE_NONE, CMODE_REMOTE, CMODE_LOCAL, CMODE_SCRIPT,
  CMODE_AUTO, CMODE_max
}
 The control modes.
 

Public Member Functions

 VisAOSimpleMotorCtrl (std::string name, const std::string &conffile) throw (AOException)
 Standard adopt style config file constructor.
 
 VisAOSimpleMotorCtrl (int argc, char **argv) throw (AOException)
 Standard adopt style command line constructor.
 
virtual int request_control (int cmode)
 Calls request_control(cmode, 0).
 
virtual int request_control (int cmode, bool override)
 Attempts to change the control type. More...
 
double getAbortPos ()
 Exposes the abort Position (_abortPos) for use in PosReqChanged (which is static)
 

Static Public Member Functions

static int CModeReqChanged (void *pt, Variable *msgb)
 RTDB handler for a control mode change request from the AO Supervisor.
 
static int VisAO_PosReqChanged (void *pt, Variable *msgb)
 RTDB handler for a position change by the AO Supervisor. More...
 
static int VisAO_PosLocalReqChanged (void *pt, Variable *msgb)
 RTDB handler for a position change by the AO Supervisor. More...
 
static int VisAO_PosScriptReqChanged (void *pt, Variable *msgb)
 RTDB handler for a position change by the AO Supervisor. More...
 

Static Public Attributes

static int control_mode = VisAOSimpleMotorCtrl::CMODE_REMOTE
 The current control mode. More...
 
static int default_control_mode = -1
 The default control mode. More...
 

Protected Member Functions

void SetupVars ()
 Virtual function to setup variables in RTDB.
 
virtual SimpleMotor * CreateMotor ()
 Overridden to test if this is a VisAOFilterWheel. More...
 
virtual void updatePos (bool force=false)
 Update position variables in RTDB.
 
std::string GetPosName (double pos)
 Get the position name from wheel position.
 
int GetType (double pos)
 Get the position type from the wheel position.
 

Protected Attributes

RTDBvar var_cmode_cur
 The current control mode in the RTDB.
 
RTDBvar var_cmode_req
 The requested control mode in the RTDB.
 
double cur_pos
 
map< std::string, float >::iterator cpos_it
 An iterator for accessing the custom pos list.
 
multimap< int, float > _customTypes
 Custom filter types list.
 
multimap< int, float >::iterator ctype_it
 An iterator for accessing the custom pos list.
 

Detailed Description

Uses the control logic unchanged from SimpleMotorCtrl, and adds the VisAOApp_base command fifos for local and script control using a signal thread. No remote fifo is provided, as remote control is via the RTDB. Intercepts the PosReqChanged notification to test if in remote control, and provides the facility for changing control mode from RTDB.

Definition at line 39 of file VisAOSimpleMotorCtrl.h.

Member Function Documentation

SimpleMotor * VisAO::VisAOSimpleMotorCtrl::CreateMotor ( )
protectedvirtual

Handle notifications if it is. If not this behaves as a standard adopt SimpleMotorCtrl.

Definition at line 69 of file VisAOSimpleMotorCtrl.cpp.

References VisAO_PosLocalReqChanged(), VisAO_PosReqChanged(), and VisAO_PosScriptReqChanged().

int VisAO::VisAOSimpleMotorCtrl::request_control ( int  cmode,
bool  override 
)
virtual
Parameters
cmodeThe requested control mode
See also
control_modes.
Parameters
overrideIf not true, forces the change no matter what current mode is.
Return values
control_modeif successful.
-1if unsuccessful.

Definition at line 164 of file VisAOSimpleMotorCtrl.cpp.

References control_mode, and var_cmode_cur.

int VisAO::VisAOSimpleMotorCtrl::VisAO_PosReqChanged ( void *  pt,
Variable *  msgb 
)
static

After checking if control_mode == CMODE_REMOTE, just calls SimpleMotorCtrl::PosReqChanged.

Definition at line 229 of file VisAOSimpleMotorCtrl.cpp.

References control_mode, getAbortPos(), and VisAO::threadMutex.

Referenced by CreateMotor().

int VisAO::VisAOSimpleMotorCtrl::VisAO_PosLocalReqChanged ( void *  pt,
Variable *  msgb 
)
static

After checking if control_mode == CMODE_LOCAL, just calls SimpleMotorCtrl::PosReqChanged.

Definition at line 264 of file VisAOSimpleMotorCtrl.cpp.

References control_mode, getAbortPos(), and VisAO::threadMutex.

Referenced by CreateMotor().

int VisAO::VisAOSimpleMotorCtrl::VisAO_PosScriptReqChanged ( void *  pt,
Variable *  msgb 
)
static

After checking if control_mode == CMODE_SCRIPT, just calls SimpleMotorCtrl::PosReqChanged.

Definition at line 299 of file VisAOSimpleMotorCtrl.cpp.

References control_mode, getAbortPos(), and VisAO::threadMutex.

Referenced by CreateMotor().

Member Data Documentation

int VisAO::VisAOSimpleMotorCtrl::control_mode = VisAOSimpleMotorCtrl::CMODE_REMOTE
static

Is static so it can be used by static RTDB handlers.

Definition at line 84 of file VisAOSimpleMotorCtrl.h.

Referenced by request_control(), SetupVars(), VisAO_PosLocalReqChanged(), VisAO_PosReqChanged(), and VisAO_PosScriptReqChanged().

int VisAO::VisAOSimpleMotorCtrl::default_control_mode = -1
static

If not -1, then this mode is always returned to, instead of NONE.

Definition at line 89 of file VisAOSimpleMotorCtrl.h.


The documentation for this class was generated from the following files: