Skip to content
Snippets Groups Projects
Commit 0d1ed08a authored by qa-soleil's avatar qa-soleil :sun_with_face:
Browse files

This commit was manufactured by cvs2svn to create tag 'operational_1_0_0'.

parent ac51ec54
No related branches found
No related tags found
No related merge requests found
#include <AxisSimulatorThread.h>
#include <math.h>
#include <TangoExceptionsHelper.h>
/*********************************************************************
* AxisSimulatorThread::AxisSimulatorThread
**********************************************************************/
AxisSimulatorThread::AxisSimulatorThread(Tango::DeviceImpl* _dev) :
Tango::Thread(),
Tango::LogAdapter(_dev)
{
// for the device to wait run_undetached is started
////this->oc = c;
// not used
this->req = REQ_STOP;
this->dev_ = _dev;
DEBUG_STREAM <<"AxisSimulatorThread::AxisSimulatorThread <-<-<-"<<endl;
this->relative_move = 0.0;
this->actual_move = MOVE_STOP;
this->health_state = HEALTH_OK;
this->polling_period_nsec = 1000000000;
this->polling_period_sec = 0;
this->limit_low_active = false;
this->limit_high_active = false;
this->positionned = false;
DEBUG_STREAM <<"AxisSimulatorThread::AxisSimulatorThread ->->->"<<endl;
}
/*********************************************************************
* AxisSimulatorThread::~AxisSimulatorThread
**********************************************************************/
AxisSimulatorThread::~AxisSimulatorThread(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::~AxisSimulatorThread <-<-<-"<<endl;
}
/*********************************************************************
* AxisSimulatorThread::stop
**********************************************************************/
void AxisSimulatorThread::stop(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::stop <-<-<-"<<endl;
this->req = REQ_STOP;
// void** arg = 0;
// this->join(arg);
}
/*********************************************************************
* AxisSimulatorThread::exit
**********************************************************************/
void AxisSimulatorThread::exit(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::exit <-<-<-"<<endl;
this->req = REQ_EXIT;
// void** arg = 0;
// this->join(arg);
}
/*********************************************************************
* AxisSimulatorThread::fwd
**********************************************************************/
void AxisSimulatorThread::fwd(void)
{
DEBUG_STREAM << "AxisSimulatorThread::fwd <-<-<-" <<endl;
INFO_STREAM <<"speed : " << this->speed << endl;
INFO_STREAM <<"step size : " << this->step << endl;
if(!this->limit_high_active)
this->req = REQ_FORWARD;
this->positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::bkwd
**********************************************************************/
void AxisSimulatorThread::bkwd(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::bkwd <-<-<-" <<endl;
INFO_STREAM <<"speed : " << this->speed << endl;
INFO_STREAM <<"step size : " << this->step << endl;
if(!this->limit_low_active)
this->req = REQ_BACKWARD;
positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::simufault
**********************************************************************/
void AxisSimulatorThread::simufault(int)
{
DEBUG_STREAM << "AxisSimulatorThread::simufault <-<-<-"<<endl;
this->req = REQ_FAULT;
}
/*********************************************************************
* AxisSimulatorThread::gotopos
**********************************************************************/
void AxisSimulatorThread::gotopos(double d)
{
DEBUG_STREAM << "AxisSimulatorThread::gotopos <-<-<-"<<endl;
INFO_STREAM <<"speed : " << this->speed << endl;
INFO_STREAM <<"step size : " << this->step << endl;
this->relative_move = d - this->pos;
this->setpoint = d;
if(this->relative_move >=0)
this->req = REQ_GOTOPOS_FWD;
else
this->req = REQ_GOTOPOS_BKWD;
this->positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::set_speed
**********************************************************************/
void AxisSimulatorThread::set_speed(double speed)
{
DEBUG_STREAM << "AxisSimulatorThread::set_speed <-<-<-"<<endl;
this->speed = speed;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::calc_polling_period
used to simulate the motor speed
**********************************************************************/
void AxisSimulatorThread::calc_polling_period(void)
{
if(this->speed < static_cast<double>(0.001))
this->speed = static_cast<double>(0.001);
double tmp = static_cast<double>((1000000000.0)/this->speed);
this->polling_period_nsec = (unsigned long)tmp;
INFO_STREAM<<"polling period (ms) : " << (double)((double)this->polling_period_nsec/1000000.0)<< endl;
}
/*********************************************************************
* SequenceThread::run_undetached
**********************************************************************/
void* AxisSimulatorThread::run_undetached(void* arg)
{
DEBUG_STREAM << "AxisSimulatorThread::run_undetached <-<-<-"<<endl;
// signals to the device server that thread is started
this->actual_move = MOVE_STOP;
if(this->accuracy <=0)
this->accuracy = 1.0;
if(this->speed <= static_cast<double>(0.0))
this->speed = static_cast<double>(1.0);
DEBUG_STREAM<<"************************* BEGIN THREAD LOOP ***************************"<<endl;
do
{
// some variables to initialise
// polling period to simulate speed
// -------------------- SOFTWARE LIMITS SIMULATION --------------------
// look the software limits if configured
// ( via min and max _value properties of attribute Position ):
if((this->software_limit_low_valid) && (this->pos <= this->software_limit_low))
{
DEBUG_STREAM << "LIMIT SWITCH BACKWARD ACTIVE" << endl;
this->limit_low_active = true;
}
else
{
this->limit_low_active = false;
}
if((this->software_limit_high_valid) && (this->pos >= this->software_limit_high))
{
DEBUG_STREAM << "LIMIT SWITCH FORWARD ACTIVE" << endl;
this->limit_high_active = true;
}
else
{
this->limit_high_active = false;
}
// -------------------- STATE MACHINE --------------------
// STOP ACTIVITY
if (((this->actual_move == MOVE_FORWARD) && (this->req == REQ_STOP)) ||
((this->actual_move == MOVE_BACKWARD) && (this->req == REQ_STOP)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_FORWARD)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_GOTOPOS_FWD) && !this->positionned) ||
((this-> actual_move == POS_OK) && (this->req == REQ_BACKWARD)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) ||
((this-> actual_move == POS_OK) && (this->req == REQ_STOP)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_FORWARD)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_GOTOPOS_FWD) && !this->positionned) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_BACKWARD)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_STOP)) )
{
this->actual_move = MOVE_STOP;
DEBUG_STREAM << "actual_move = MOVE_STOP" << endl;
}
// FORWARD ACTIVITY
if( ((this->actual_move == MOVE_STOP) && (this->req == REQ_FORWARD)) ||
((this->actual_move == MOVE_STOP) && (this->req == REQ_GOTOPOS_FWD) && !this->positionned) ||
((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_FORWARD)) ||
((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_GOTOPOS_FWD) && !this->positionned) )
{
this->actual_move = MOVE_FORWARD;
DEBUG_STREAM << "actual_move = MOVE_FORWARD" << endl;
}
// BACKWARD ACTIVITY
if( ((this->actual_move == MOVE_STOP) && (this->req == REQ_BACKWARD)) ||
((this->actual_move == MOVE_STOP) && (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) ||
((this->actual_move == STOPPED_LSFWD) && (this->req == REQ_BACKWARD)) ||
((this->actual_move == STOPPED_LSFWD) && (this->req == REQ_GOTOPOS_BKWD) && !this->positionned) )
{
this->actual_move = MOVE_BACKWARD;
DEBUG_STREAM << "actual_move = MOVE_BACKWARD" << endl;
}
// ON LIMIT SWITCH FORWARD ACTIVITY
if( (this->actual_move == MOVE_FORWARD) && this->limit_high_active )
{
this->actual_move = STOPPED_LSFWD;
DEBUG_STREAM << "actual_move = STOPPED_LSFWD" << endl;
}
// ON LIMIT SWITCH BACKWARD ACTIVITY
if( (this->actual_move == MOVE_BACKWARD) && this->limit_low_active )
{
this->actual_move = STOPPED_LSBKWD;
DEBUG_STREAM << "actual_move = STOPPED_LSBKWD" << endl;
}
// POS_OK activity : position OK or NOT OK
if( ((this->actual_move == MOVE_FORWARD)||(this->actual_move == MOVE_BACKWARD)) && this->positionned )
{
double delta = fabs((this->pos - this->setpoint));
DEBUG_STREAM << "pos : " << pos << " setpoint : " << this->setpoint << " delta : " << delta << " accuracy : " << this->accuracy << endl;
if( delta <= this->accuracy )
{
this->actual_move = POS_OK;
DEBUG_STREAM << "actual_move = POS_OK" << endl;
}
else
{
this->actual_move = POS_NOK;
DEBUG_STREAM << "actual_move = POS_NOT_OK !!!!" << endl;
}
}
// -------------------- SIMULATE MOVE --------------------
if( (this->actual_move == MOVE_FORWARD) && !this->limit_high_active ) // si forward on incremente
{
this->pos += step;
DEBUG_STREAM<<"position : "<<this->pos<<endl;
// std::cout << "+" ;
}
if( (this->actual_move == MOVE_BACKWARD) && !this->limit_low_active )// si backward on decremente
{
this->pos -= step;
DEBUG_STREAM<<"position : "<<this->pos<<endl;
// std::cout << "-" ;
}
// -------------------- SIMULATE POSITION OK --------------------
if(!this->positionned && (this->req == REQ_GOTOPOS_BKWD) )
{
if(this->pos <= this->setpoint)
{
this->positionned = true;
}
}
if(!this->positionned && (this->req == REQ_GOTOPOS_FWD))
{
if(this->pos >= this->setpoint)
{
this->positionned = true;
}
}
// -------------------- POLLING PERIOD slow down if no move --------------------
if( (this->actual_move != MOVE_FORWARD) && (this->actual_move != MOVE_BACKWARD) )
{
// stopped : polling period of O,1 s
this->polling_period_nsec = 1000000000;
}
// endormir le thread pour le temps
this->sleep(this->polling_period_sec, this->polling_period_nsec);
}while(this->req != REQ_EXIT);
DEBUG_STREAM<<"************************* END THREAD LOOP ***************************"<<endl;
return 0;
}
#ifndef _AXIS_SIMULATOR_THREAD_
#define _AXIS_SIMULATOR_THREAD_
#include <tango.h>
#include "TangoThread.h"
enum MOVING_STATE {MOVE_STOP,MOVE_FORWARD,MOVE_BACKWARD,STOPPED_LSFWD,STOPPED_LSBKWD,POS_OK,POS_NOK};
enum REQUEST {REQ_EXIT=-1,REQ_STOP,REQ_FORWARD,REQ_BACKWARD,REQ_GOTOPOS_FWD,REQ_GOTOPOS_BKWD,REQ_FAULT};
enum HEALTH_STATE {HEALTH_FAULT, HEALTH_ALARM, HEALTH_OK};
class AxisSimulatorThread : public Tango::Thread, public Tango::LogAdapter
{
public:
AxisSimulatorThread(Tango::DeviceImpl* dev // pointer on the device to simulate
);
virtual ~AxisSimulatorThread(void);
double pos;
double accel;
double decel;
double speed;
double accuracy;
// software limit low an validity
double software_limit_low;
bool software_limit_low_valid;
// software limit high an validity
double software_limit_high;
bool software_limit_high_valid;
// the step size
double step;
// command forward, increments on attribute pos
void fwd(void);
// command backward decrements on attribute pos
void bkwd(void);
// command stop stops increments on pos
void stop(void);
// command exit ends forever loop
void exit(void);
// command gotoposition in(de)crements from pos to argin
void gotopos(double);
// command fix the speed value
void set_speed(double);
MOVING_STATE moving_state(void) { return this->actual_move; };
int get_health_state(void) { return this->health_state; };
// to simulate a fault
void simufault(int);
private:
// omni_condition reapckage ( see TangoThread.h ) for the device to waits the thread startup is done
Tango::Condition *oc;
Tango::DeviceImpl* dev_ ;
MOVING_STATE actual_move;
HEALTH_STATE health_state;
REQUEST req;
// to calculate the period of the thread to simulate speed
void calc_polling_period(void);
// software limit switchs
bool limit_low_active;
bool limit_high_active;
// position OK flag for gotopos
bool positionned;
double relative_move;
double setpoint;
//virtual void run(void* arg){};
virtual void* run_undetached (void* arg);
// Tango::Semaphore* sem;
unsigned long polling_period_nsec;
unsigned long polling_period_sec;
/* double* sequence_;
double* times_;
unsigned long iterations_;
double delta_;
double timeout_;
double polling_period_;
unsigned long seq_size_;
bool tmo_occured;
AttributesHelper* attr_proxy;
bool check_read_value;
bool error_occured;*/
};
#endif //_AXIS_SIMULATOR_THREAD_
#include <InitializeReferencePositionThread.h>
#include <math.h>
#include <TangoExceptionsHelper.h>
/*********************************************************************
* AxisSimulatorThread::AxisSimulatorThread
**********************************************************************/
InitializeReferencePositionThread::InitializeReferencePositionThread(
SimulatedMotor * mot, INIT_TYPE it) :
Tango::Thread(),
Tango::LogAdapter(_dev)
{
DEBUG_STREAM <<"InitializeReferencePositionThread::InitializeReferencePositionThread <-<-<-"<<endl;
// initialize variables
// save locally the pointer on the device
this->mot = m;
// this is for the strategy
this->init_type = it;
this->req = INIT_START;
DEBUG_STREAM <<"InitializeReferencePositionThread::InitializeReferencePositionThread ->->->"<<endl;
}
/*********************************************************************
* AxisSimulatorThread::~AxisSimulatorThread
**********************************************************************/
InitializeReferencePositionThread::~InitializeReferencePositionThread(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::~AxisSimulatorThread <-<-<-"<<endl;
}
/*********************************************************************
* AxisSimulatorThread::stop
**********************************************************************/
void InitializeReferencePositionThread::stop(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::stop <-<-<-"<<endl;
this->req = INIT_STOP;
// void** arg = 0;
// this->join(arg);
}
/*********************************************************************
* AxisSimulatorThread::exit
**********************************************************************/
void InitializeReferencePositionThread::exit(void)
{
DEBUG_STREAM <<"AxisSimulatorThread::exit <-<-<-"<<endl;
this->req = INIT_EXIT;
// void** arg = 0;
// this->join(arg);
}
/*********************************************************************
* AxisSimulatorThread::fwd
**********************************************************************/
void InitializeReferencePositionThread::fwd(void)
{
DEBUG_STREAM << "AxisSimulatorThread::fwd <-<-<-"<<endl;
DEBUG_STREAM << " speed : " << this->speed << " step size : " << this->step << endl;
if(!limit_high_active)
this->req = REQ_FORWARD;
positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::bkwd
**********************************************************************/
void InitializeReferencePositionThread::bkwd(void)
{
DEBUG_STREAM << "AxisSimulatorThread::bkwd <-<-<-"<<endl;
if(!limit_low_active)
this->req = REQ_BACKWARD;
positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::simufault
**********************************************************************/
void InitializeReferencePositionThread::simufault(int)
{
DEBUG_STREAM << "AxisSimulatorThread::simufault <-<-<-"<<endl;
this->req = REQ_FAULT;
}
/*********************************************************************
* AxisSimulatorThread::gotopos
**********************************************************************/
void InitializeReferencePositionThread::gotopos(double d)
{
DEBUG_STREAM << "AxisSimulatorThread::gotopos <-<-<-"<<endl;
this->relative_move = d - this->pos;
this->setpoint = d;
if(relative_move >=0)
this->req = REQ_GOTOPOS_FWD;
else
this->req = REQ_GOTOPOS_BKWD;
positionned = false;
this->calc_polling_period();
}
/*********************************************************************
* AxisSimulatorThread::calc_polling_period
used to simulate the motor speed
**********************************************************************/
void InitializeReferencePositionThread::calc_polling_period(void)
{
if(this->speed < static_cast<double>(0.001))
this->speed = static_cast<double>(0.001);
double tmp = static_cast<double>(1000000.0)/this->speed;
this->polling_period_nsec = long(tmp);
DEBUG_STREAM << " AxisSimulatorThread::calc_polling_period this->polling_period_nsec = " << long(tmp) <<endl;
}
/*********************************************************************
* SequenceThread::run_undetached
**********************************************************************/
void* InitializeReferencePositionThread::run_undetached(void* arg)
{
DEBUG_STREAM << "AxisSimulatorThread::run_undetached <-<-<-"<<endl;
// signals to the device server that thread is started
// wait() and timedwait() do not work
// try broadcast instead
if (oc)
{
DEBUG_STREAM << "AxisSimulatorThread broadcast"<<endl;
oc->broadcast();
DEBUG_STREAM << "AxisSimulatorThread broadcasted"<<endl;
}
else
DEBUG_STREAM << "AxisSimulatorThread error : omni_condition not initialised"<<endl;
this->actual_move = MOVE_STOP;
if(this->accuracy <=0)
this->accuracy = 1.0;
if(this->speed <= static_cast<double>(0.0))
this->speed = static_cast<double>(1.0);
do
{
// some variables to initialise
// cout << "." ;
// polling period to simulate speed
// -------------------- SOFTWARE LIMITS SIMULATION --------------------
// look the software limits if configured
// ( via min and max _value properties of attribute Position ):
if((this->software_limit_low_valid) && (this->pos <= software_limit_low))
{
DEBUG_STREAM << " LIMIT SWITCH BACKWARD ACTIVE" << endl;
this->limit_low_active = true;
}
else
{
this->limit_low_active = false;
}
if((this->software_limit_high_valid) && (this->pos >= software_limit_high))
{
DEBUG_STREAM << " LIMIT SWITCH FORWARD ACTIVE" << endl;
this->limit_high_active = true;
}
else
{
this->limit_high_active = false;
}
// -------------------- STATE MACHINE --------------------
// STOP ACTIVITY
if ( ((this->actual_move == MOVE_FORWARD) && (this->req == REQ_STOP)) ||
((this->actual_move == MOVE_BACKWARD) && (this->req == REQ_STOP)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_FORWARD)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_GOTOPOS_FWD) && !positionned) ||
((this-> actual_move == POS_OK) && (this->req == REQ_BACKWARD)) ||
((this-> actual_move == POS_OK) && (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
((this-> actual_move == POS_OK) && (this->req == REQ_STOP)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_FORWARD)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_GOTOPOS_FWD) && !positionned) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_BACKWARD)) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
((this-> actual_move == POS_NOK) && (this->req == REQ_STOP)) )
{
this->actual_move = MOVE_STOP;
DEBUG_STREAM << "this->actual_move = MOVE_STOP;" << endl;
}
// FORWARD ACTIVITY
if( ((this->actual_move == MOVE_STOP) && (this->req == REQ_FORWARD)) ||
((this->actual_move == MOVE_STOP) && (this->req == REQ_GOTOPOS_FWD) && !positionned) ||
((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_FORWARD)) ||
((this->actual_move == STOPPED_LSBKWD) && (this->req == REQ_GOTOPOS_FWD) && !positionned) )
{
actual_move = MOVE_FORWARD;
DEBUG_STREAM << "actual_move = MOVE_FORWARD;" << endl;
}
// BACKWARD ACTIVITY
if( ((this->actual_move == MOVE_STOP) && (this->req == REQ_BACKWARD)) ||
((this->actual_move == MOVE_STOP) && (this->req == REQ_GOTOPOS_BKWD) && !positionned) ||
((this->actual_move == STOPPED_LSFWD) && (this->req == REQ_BACKWARD)) ||
((this->actual_move == STOPPED_LSFWD) && (this->req == REQ_GOTOPOS_BKWD) && !positionned) )
{
actual_move = MOVE_BACKWARD;
DEBUG_STREAM << "actual_move = MOVE_BACKWARD;" << endl;
}
// ON LIMIT SWITCH FORWARD ACTIVITY
if( (this->actual_move == MOVE_FORWARD) && limit_high_active )
{
actual_move = STOPPED_LSFWD;
DEBUG_STREAM << " actual_move = STOPPED_LSFWD; " << endl;
}
// ON LIMIT SWITCH BACKWARD ACTIVITY
if( (this->actual_move == MOVE_BACKWARD) && limit_low_active )
{
actual_move = STOPPED_LSBKWD;
DEBUG_STREAM << "actual_move = STOPPED_LSBKWD;" << endl;
}
// POS_OK activity : position OK or NOT OK
if( ((this->actual_move == MOVE_FORWARD)||(this->actual_move == MOVE_BACKWARD)) && positionned )
{
double delta = fabs((this->pos - this->setpoint));
DEBUG_STREAM << " pos : " << pos << " setpoint : " << setpoint << " delta : " << delta << " accuracy : " << accuracy << endl;
if( delta <= this->accuracy )
{
actual_move = POS_OK;
DEBUG_STREAM << "actual_move = POS_OK " << endl;
// std::cout << "actual_move = POS_OK " << endl;
}
else
{
actual_move = POS_NOK;
DEBUG_STREAM << "actual_move = POS_NOT_OK !!!!" << endl;
// std::cout << "actual_move = POS_NOT_OK !!!!" << endl;
}
}
// -------------------- SIMULATE MOVE --------------------
if( (this->actual_move == MOVE_FORWARD) && !limit_high_active ) // si forward on incremente
{
this->pos += step;
// std::cout << "+" ;
}
if( (this->actual_move == MOVE_BACKWARD) && !limit_low_active )// si backward on decremente
{
this->pos -= step;
// std::cout << "-" ;
}
// -------------------- SIMULATE POSITION OK --------------------
if(!positionned && (this->req == REQ_GOTOPOS_BKWD) )
{
if(this->pos <= this->setpoint)
{
// this->pos = this->setpoint;
// std::cout << "positionned backward at : " << this->pos << endl;
positionned = true;
}
}
if(!positionned && (this->req == REQ_GOTOPOS_FWD))
{
if(this->pos >= this->setpoint)
{
// this->pos = this->setpoint;
// std::cout << "positionned forward at : " << this->pos << endl;
positionned = true;
}
}
// -------------------- POLLING PERIOD slow down if no move --------------------
if( (this->actual_move != MOVE_FORWARD) && (this->actual_move != MOVE_BACKWARD) )
{
// stopped : polling period of O,1 s
polling_period_nsec = 100000000;
}
// endormir le thread pour le temps
this->sleep(polling_period_sec, polling_period_nsec);
}while(this->req != REQ_EXIT);
cout<<"end sequence"<<endl;
return 0;
}
#ifndef _INITIALISE_REFERENCE_POSITION_THREAD_
#define _INITIALISE_REFERENCE_POSITION_THREAD_
#include <tango.h>
#include "tangothread.h"
enum INIT_TYPE {LS_FORWARD, LS_BACKWARD, LS_HOME, USER_DEFINED, NOT_POSSIBLE};
enum RET_VALUE (INIT_SUCCESS, INIT_ERROR, INIT_STOPPED);
enum REQ (INIT_EXIT=-1, INIT_STOP, INIT_START, INIT_PAUSE);
class InitializeReferencePositionThread : public Tango::Thread, public Tango::LogAdapter
{
public:
InitializeReferencePositionThread(SimulatedMotor *m, INIT_TYPE it); // pointer on the device to simulate
virtual ~InitializeReferencePositionThread(void);
// start finding reference position
void start(void);
// stops finding reference position
void stop(void);
private:
// pointer on the motor device to be initialized
simulatedMotor * mot ;
INIT_TYPE init_type;
REQ req;
void init_USER_DEFINED(Tango::DevDouvle position);
// METHOD : positionning on LS backward
void init_LS_BAKWARD(void);
void init_LS_FORWARD(void);
void init_LS_HOME(void);
//virtual void run(void* arg){};
virtual void* run_undetached (void* arg);
// Tango::Semaphore* sem;
unsigned long polling_period_nsec;
unsigned long polling_period_sec;
};
#endif //_INITIALISE_REFERENCE_POSITION_THREAD_
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment