17 #ifndef __VisAOFocusMotorCtrl_h__
18 #define __VisAOFocusMotorCtrl_h__
34 #define MOVE_NEGHOME 4
35 #define MOVE_POSHOME 5
38 #define FIFOCH_ENABLE 0
51 #define FIFOCH_HOMESW 5
81 FocusMotorCtrl(std::string name,
const std::string& conffile)
throw (AOException);
106 pthread_mutex_t dio_mutex;
217 int step(
int nsteps);
283 int get_preset(
double &fcal, std::vector<double> & preset, std::string & presetf);
345 #endif //__VisAOFocusMotorCtrl_h__
double min_step_time
Minimum time between steps, in seconds. Can't be < 1e-6.
int check_limits()
Gets the limit switch status from dioserver, and performs homing logic checks.
int set_cur_pos(double)
Set the current position. This does not move the motor.
double home_pos
The position to set at the after homing to the home switch.
int start_pending_move()
Calls either offset_pos(next_pos) or goto_pos(next_pos) when the main loop detects a pending move...
int enable()
Call set_enable(true);.
int delete_init()
Delete the initialization file.
virtual std::string script_command(std::string com)
Overridden from VisAOApp_base::script_command, here just calls common_command.
int dioch_pwr
The dioserver software channel connected to +5V terminal.
virtual std::string remote_command(std::string com)
Overridden from VisAOApp_base::remote_command, here just calls common_command.
int offset_pos(double dpos)
Offset current position (in microns).
int dioch_limhome
The dioserver software channel connected to the middle limit switch output.
std::string get_state_str()
Get the state string.
int disable()
Call set_enable(false);.
The focus stage stepper motor controller class.
The standalone VisAO application, does not interface with the AO Supervisor.
int hw_dir
Sets the polarity of the direction pin relative to the software direction, that is so forward is forw...
double step_ratio
Microns per step. For E35H4N-12-900 with BSD-02H in 1/8 step resolution this is 0.375.
void initapp()
Initialization common to both constructors.
Declarations for the standalone VisAO application.
int set_forward()
Call set_direction(true);.
int step()
Move by 1 step in current direction.
int dioch_dir
The dioserver software channel connected to the direction pin.
int set_backward()
Call set_direction(false);.
virtual int Run()
The main loop.
virtual void dataLogger(timeval tv)
Write focus positions to the data log.
FocusMotorCtrl(std::string name, const std::string &conffile)
Standard constructor with a config file.
int set_home()
Set the current position as the home position.
bool neg_limit
True if negative limit switch is active.
bool is_moving
True if currently processing a position change.
bool stop_moving
If true, the currently processing position change is terminated.
int goto_pos(double pos)
Move to an absolute position (in microns).
int DO_ENABLE
Flag for main loop. +1 calls enable, -1 calls disable.
int pending_move
If non zero, a move is pending. Can be MOVE_OFFSET or MOVE_ABS.
bool pos_limit
True if positive limit switch is active.
int save_init()
Save the initialization data to disk.
double cur_pos
The position, relative to home, in microns.
VisAO software utilitites, declarations.
int goto_preset()
Move the focus stage to the preset position for the current VisAO setup.
int dioch_limneg
The dioserver software channel connected to the negative limit switch output.
int set_enable(bool en)
Set the enable state of the controller.
virtual std::string local_command(std::string com)
Overridden from VisAOApp_base::local_command, here just calls common_command.
int step_forward()
Move by 1 step in forward direction.
double get_cur_pos()
Get the current position in microns.
int get_preset(double &fcal, std::vector< double > &preset, std::string &presetf)
Reads the preset file for the current setup as determined from the shared memory status boards...
int cur_enabled
Power state of the controller.
int get_power_state()
Get the power state of the controller.
bool home_switch
True if home limit switch is active.
int check_preset()
Check if the focus stage is currently at the preset (focused) position (within 2 microns) ...
int cur_dir
Tracks the current setting of the direction pin TTL level.
bool pos_limit_disabled
True if back limit is disabled for dismounting.
timeval last_step_time
Time of the last step.
int dioch_step
The dioserver software channel connected to the step pin.
virtual int update_statusboard()
Update the status board.
int set_direction(bool dir)
Set the direction of the controller.
int dioch_enable
The dioserver software channel connected to the enable pin.
std::string common_command(std::string com, int cmode)
The common command processor for commands received by fifo.
The namespace of VisAO software.
std::string diofifo_path
The path of the dioserver fifos.
int dioch_limpos
The dioserver software channel connected to the positive limit switch output.
double next_pos
Position of next move. Interpreted as either an offset or absolute position depending on pending_move...
int step_backward()
Move by 1 step in backward direction.