MagAO-X standard motion stage interface. More...
#include <stdMotionStage.hpp>
Public Member Functions | |
~stdMotionStage () noexcept | |
Destructor. More... | |
int | setupConfig (mx::app::appConfigurator &config) |
Setup the configuration system. More... | |
int | loadConfig (mx::app::appConfigurator &config) |
load the configuration system results More... | |
int | appStartup () |
Startup function. More... | |
int | appLogic () |
Application logic. More... | |
int | onPowerOff () |
Actions on power off. More... | |
int | whilePowerOff () |
Actions while powered off. More... | |
int | appShutdown () |
Application the shutdown. More... | |
Telemeter Interface | |
int | recordStage (bool force=false) |
Protected Attributes | |
std::string | m_presetNotation {"preset"} |
Notation used to refer to a preset, should be singular, as in "preset" or "filter". More... | |
bool | m_fractionalPresets {true} |
Flag to set in constructor determining if fractional presets are allowed. Used for INDI/GUIs. More... | |
bool | m_defaultPositions {true} |
Flag controlling whether the default preset positions (the vector index) are set in loadConfig. More... | |
int8_t | m_moving {0} |
Whether or not the stage is moving. -2 means powered off, -1 means not homed, 0 means not moving, 1 means moving, 2 means homing. More... | |
int8_t | m_movingState {0} |
Used to track the type of command. If > 1 this is a command to move to a preset. If 0 then it is a move to an arbitrary position. More... | |
double | m_preset {0} |
The current numerical preset position [1.0 is index 0 in the preset name vector]. More... | |
double | m_preset_target {0} |
The target numerical preset position [1.0 is index 0 in the preset name vector]. More... | |
Configurable Parameters | |
bool | m_powerOnHome {false} |
If true, then the motor is homed at startup (by this software or actual power on) More... | |
int | m_homePreset {-1} |
If >=0, this preset position is moved to after homing. More... | |
std::vector< std::string > | m_presetNames |
The names of each position on the stage. More... | |
std::vector< double > | m_presetPositions |
The positions, in arbitrary units, of each preset. If 0, then the integer position number (starting from 1) is used to calculate. More... | |
Private Member Functions | |
derivedT & | derived () |
INDI | |
pcf::IndiProperty | m_indiP_preset |
The position of the stage in presets. More... | |
pcf::IndiProperty | m_indiP_presetName |
The name of the nearest preset for this position. More... | |
pcf::IndiProperty | m_indiP_home |
Command the stage to home. . More... | |
pcf::IndiProperty | m_indiP_stop |
Command the stage to halt. More... | |
int | newCallBack_m_indiP_preset (const pcf::IndiProperty &ipRecv) |
Callback to process a NEW preset position request. More... | |
int | newCallBack_m_indiP_presetName (const pcf::IndiProperty &ipRecv) |
Callback to process a NEW preset name request. More... | |
int | newCallBack_m_indiP_home (const pcf::IndiProperty &ipRecv) |
Callback to process a NEW home request switch toggle. More... | |
int | newCallBack_m_indiP_stop (const pcf::IndiProperty &ipRecv) |
Callback to process a NEW stop request switch toggle. More... | |
int | updateINDI () |
Update the INDI properties for this device controller. More... | |
static int | st_newCallBack_stdMotionStage (void *app, const pcf::IndiProperty &ipRecv) |
The static callback function to be registered for stdMotionStage properties. More... | |
MagAO-X standard motion stage interface.
Implements the standard interface to a MagAO-X motion stage. This includes the mcbl filter wheels, the zaber stages.
The required interface to be implemented in derivedT is
In addition the derived class is responsible for setting m_moving and m_preset. m_preset_target should also be set if the wheel is moved via a low-level position command.
The derived class derivedT
must be a MagAOXApp<true>, and should declare this class a friend like so:
Calls to this class's setupConfig
, loadConfig
, appStartup
, appLogic
, appShutdown
onPowerOff
, and whilePowerOff
, must be placed in the derived class's functions of the same name.
Definition at line 53 of file stdMotionStage.hpp.
|
noexcept |
Destructor.
Definition at line 263 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::appLogic |
Application logic.
Checks the stdMotionStage thread
This should be called from the derived's appLogic() as in
with appropriate error checking.
Definition at line 368 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::appShutdown |
Application the shutdown.
Shuts down the stdMotionStage thread
with appropriate error checking.
Definition at line 395 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::appStartup |
Startup function.
This should be called in derivedT::appStartup
as
with appropriate error checking.
Definition at line 312 of file stdMotionStage.hpp.
Referenced by MagAOX::app::filterWheelCtrl::appStartup(), MagAOX::app::smc100ccCtrl::appStartup(), and MagAOX::app::zaberCtrl::appStartup().
|
inlineprivate |
Definition at line 256 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::loadConfig | ( | mx::app::appConfigurator & | config | ) |
load the configuration system results
This should be called in derivedT::loadConfig
as
with appropriate error checking.
[in] | config | the derived classes configurator |
Definition at line 286 of file stdMotionStage.hpp.
Referenced by MagAOX::app::filterWheelCtrl::loadConfig(), MagAOX::app::hsfwCtrl::loadConfig(), MagAOX::app::smc100ccCtrl::loadConfig(), and MagAOX::app::zaberCtrl::loadConfigImpl().
int MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_home | ( | const pcf::IndiProperty & | ipRecv | ) |
Callback to process a NEW home request switch toggle.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 480 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_preset | ( | const pcf::IndiProperty & | ipRecv | ) |
Callback to process a NEW preset position request.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 418 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_presetName | ( | const pcf::IndiProperty & | ipRecv | ) |
Callback to process a NEW preset name request.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 439 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_stop | ( | const pcf::IndiProperty & | ipRecv | ) |
Callback to process a NEW stop request switch toggle.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 498 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::onPowerOff |
Actions on power off.
This should be called from the derived's onPowerOff() as in
with appropriate error checking.
Definition at line 375 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::recordStage | ( | bool | force = false | ) |
Definition at line 592 of file stdMotionStage.hpp.
Referenced by MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::INDI_SETCALLBACK_DEFN(), MagAOX::app::zaberCtrl::moveTo(), and MagAOX::app::filterWheelCtrl::recordStage().
int MagAOX::app::dev::stdMotionStage< derivedT >::setupConfig | ( | mx::app::appConfigurator & | config | ) |
Setup the configuration system.
This should be called in derivedT::setupConfig
as
with appropriate error checking.
[out] | config | the derived classes configurator |
Definition at line 271 of file stdMotionStage.hpp.
Referenced by MagAOX::app::filterWheelCtrl::setupConfig(), MagAOX::app::hsfwCtrl::setupConfig(), MagAOX::app::smc100ccCtrl::setupConfig(), and MagAOX::app::zaberCtrl::setupConfig().
|
static |
The static callback function to be registered for stdMotionStage properties.
Dispatches to the relevant handler
[in] | app | a pointer to this, will be static_cast-ed to derivedT. |
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 402 of file stdMotionStage.hpp.
int MagAOX::app::dev::stdMotionStage< derivedT >::updateINDI |
Update the INDI properties for this device controller.
You should call this once per main loop. It is not called automatically.
Definition at line 522 of file stdMotionStage.hpp.
Referenced by MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), and MagAOX::app::zaberCtrl::appLogic().
int MagAOX::app::dev::stdMotionStage< derivedT >::whilePowerOff |
Actions while powered off.
This should be called from the derived's whilePowerOff() as in
with appropriate error checking.
Definition at line 387 of file stdMotionStage.hpp.
|
protected |
Flag controlling whether the default preset positions (the vector index) are set in loadConfig.
Definition at line 75 of file stdMotionStage.hpp.
|
protected |
Flag to set in constructor determining if fractional presets are allowed. Used for INDI/GUIs.
Definition at line 73 of file stdMotionStage.hpp.
|
protected |
If >=0, this preset position is moved to after homing.
Definition at line 63 of file stdMotionStage.hpp.
|
protected |
Command the stage to home. .
Definition at line 191 of file stdMotionStage.hpp.
|
protected |
The position of the stage in presets.
Definition at line 185 of file stdMotionStage.hpp.
|
protected |
The name of the nearest preset for this position.
Definition at line 188 of file stdMotionStage.hpp.
|
protected |
Command the stage to halt.
Definition at line 194 of file stdMotionStage.hpp.
|
protected |
Whether or not the stage is moving. -2 means powered off, -1 means not homed, 0 means not moving, 1 means moving, 2 means homing.
Definition at line 77 of file stdMotionStage.hpp.
|
protected |
Used to track the type of command. If > 1 this is a command to move to a preset. If 0 then it is a move to an arbitrary position.
Definition at line 78 of file stdMotionStage.hpp.
|
protected |
If true, then the motor is homed at startup (by this software or actual power on)
Definition at line 61 of file stdMotionStage.hpp.
|
protected |
The current numerical preset position [1.0 is index 0 in the preset name vector].
Definition at line 80 of file stdMotionStage.hpp.
|
protected |
The target numerical preset position [1.0 is index 0 in the preset name vector].
Definition at line 81 of file stdMotionStage.hpp.
|
protected |
The names of each position on the stage.
Definition at line 65 of file stdMotionStage.hpp.
|
protected |
Notation used to refer to a preset, should be singular, as in "preset" or "filter".
Definition at line 71 of file stdMotionStage.hpp.
|
protected |
The positions, in arbitrary units, of each preset. If 0, then the integer position number (starting from 1) is used to calculate.
Definition at line 67 of file stdMotionStage.hpp.