36 std::string visao_root = getenv(
"VISAO_ROOT");
46 _logger->log(Logger::LOG_LEV_ERROR,
"Could not create status board.");
51 strncpy(bsb->appname, MyFullName().c_str(), 25);
62 int WollastonStatus::WollastonStatus::set_cur_pos(
int cp)
67 if(cp > 0) cur_pos = 1;
68 if(cp == 0) cur_pos = 0;
69 if(cp < 0) cur_pos = -1;
83 ERROR_REPORT(
"Error installing main thread catcher.");
89 signal(SIGIO, SIG_IGN);
92 LOG_INFO(
"fifo_list connected.");
96 ERROR_REPORT(
"Error connecting the fifo list.");
105 LOG_INFO(
"starting up . . .");
116 else usleep((
int)((
pause_time-dt)*1e6 * .99));
129 if(fw3sb->state != STATE_OPERATING && fw3sb->state != STATE_HOMING && fw3sb->type != last_type)
134 if(fw3sb->state != STATE_OPERATING && fw3sb->state != STATE_HOMING && fw3sb->type == FTYPE_SDI &&
cur_pos != 1 && !ignored)
139 if(fw3sb->state != STATE_OPERATING && fw3sb->state != STATE_HOMING && fw3sb->type != FTYPE_SDI &&
cur_pos != -1 && !ignored)
141 prompt = PROMPT_DOWN;
144 last_type = fw3sb->type;
147 if(
cur_pos == 0 && !ignored) prompt = PROMPT_INT;
159 _logger->log(Logger::LOG_LEV_TRACE,
"Received remote command: %s.", com.c_str());
161 _logger->log(Logger::LOG_LEV_TRACE,
"Response to remote command: %s.", resp.c_str());
168 _logger->log(Logger::LOG_LEV_TRACE,
"Received local command: %s.", com.c_str());
170 _logger->log(Logger::LOG_LEV_TRACE,
"Response to local command: %s.", resp.c_str());
219 return (std::string(
"UNKOWN COMMAND: ") + com +
"\n");
227 snprintf(statestr, 50,
"%c %2i %i\n", str[0],
cur_pos, prompt);
int get_cur_pos()
Get the current positon of the motor.
virtual std::string remote_command(std::string com)
Overridden from VisAOApp_base::remote_command, here just calls common_command.
fifo_list * global_fifo_list
The global fifo_list, for signal handling.
double get_curr_time(void)
Gets the current CLOCK_REALTIME time, returns it in seconds to double precision.
Declarations for the VisAO wollaston lift status maintainer.
virtual int update_statusboard()
Update the status board.
The standalone VisAO application, does not interface with the AO Supervisor.
void * statusboard_shmemptr
The pointer to the shared memory block for the statusboard.
virtual int update_statusboard()
Update the status board.
int set_cur_pos(int cp)
Set the value of cur_pos of the motor.
virtual int setup_baseApp(bool usethreads=false)
Install fifo channels.
int check_fifo_list_RTpending()
Check for pending reads for the fifo list while using the RT signals.
int setup_fifo_list(int nfifos)
Allocate the fifo_list.
WollastonStatus(std::string name, const std::string &conffile)
Standard constructor with a config file.
key_t statusboard_shmemkey
The key used to lookup the shared memory.
int TimeToDie
Global set by SIGTERM.
std::string control_mode_response()
Convenience function to return the control type response string, e.g. "A\n".
void * attach_shm(size_t *sz, key_t mkey, int shmemid)
Attach to a shared memory buffer and get its size.
fifo_list fl
The list of named-pipe fifos used for inter-process comms.
virtual std::string local_command(std::string com)
Overridden from VisAOApp_base::local_command, here just calls common_command.
int cur_pos
The current position of the lift, -1 is down, 0 is intermediate, 1 is up.
std::string get_state_str()
Get the state string.
double pause_time
Time to pause during application main loop.
virtual int request_control(int cmode)
Calls request_control(cmode, 0).
virtual int Run()
The main loop.
int create_statusboard(size_t sz)
Creates and attaches to the statusboard shared memory.
std::string common_command(std::string com, int cmode)
The common command processor for commands received by fifo.
int connect_fifo_list()
Connect the fifo_list with exclusive locking.
static int control_mode
The current control mode.
int setup_RTsigio()
Setup SIGIO signal handling using realtime signals.
virtual int install_sig_mainthread_catcher()
Install the SIG_MAINTHREAD signal catcher.
The namespace of VisAO software.
void initApp()
Initialization common to both constructors.