XPS_axis Class Reference

#include <class_xps_axis.h>

List of all members.

Public Member Functions

int lit_version (char *version)
int set_timeout (ACE_Time_Value time)
int get_timeout (ACE_Time_Value &time)
int position_read (double &pos)
int get_speed (double &velocity)
int set_speed (double &velocity)
int get_acc (double &acc)
int set_acc (double &acc)
int is_initialized (bool &init)
int is_motor_on (bool &is_on)
int is_ready (bool &ready)
int is_moving (bool &is_moving)
int read_eor (int &eor)
int read_status (int &stat)
int set_motor_on ()
int set_motor_off ()
int initialization ()
int move_absolute (double pos)
int move_relative (double depl)
int jog_plus ()
int jog_minus ()
int end_jog ()
int stop ()
int halt ()
int get_soft_limit (double &plus, double &minus)
int set_soft_limit (double plus, double minus)
int get_error_as_string (int code, char *s)
int get_status_as_string (int code, char *s)
int send (char *message)
int send_and_receive (char *message, char *reponse)
int test_error (int code)
 XPS_axis (char *adresse, char *Group_name, char *Actionneur_name, ACE_Time_Value time_out)
 ~XPS_axis ()

Public Attributes

char group_name [50]
char positioner_name [50]
char ip_addr [50]
char ErrorString [100]
char origin_error [100]

Private Member Functions

int create_dialog ()
int close_dialog ()

Private Attributes

double speed
double acceleration
ACE_SOCK_Stream socket_send_XPS
ACE_SOCK_Stream socket_send_and_receive_XPS
ACE_Time_Value timeout


Detailed Description

This class provides the essential commands to pilot XPS
throw the Tango framework.

class_xps_axis uses XPS_lib as a XPS API wrapper,
The ACE framework to deal with sockets (crossplatform capabilities)
and now class_xps_axis also uses the Exception class of soleil to throw exceptions.

---------------------------- -The communication concept:- ----------------------------

Commands and results are encapsulated into TCP/IP packets. The XPS is listening on port 5001

We had two problems to solve:

1)The XPS ALWAYS respond to a command BUT when this command is completly executed or in case of error. It can be very long sometimes, and we had time out errors.

2)ASynchronous / non-blocking sockets do not respond to the problem because there's another time out wich is the TANGO time out.

Fortunatly XPS is able to manage 30 sockets at the same time. So we work around the problem with two sockets: one with a very short time out to send commands and don't care the response another with a long time out to send commands and treat the response. We're helped by the fact that all status commands respond in a short time. So when we send a command with long response delay and we need to know the state of an axis, we simply poll the status.


Constructor & Destructor Documentation

XPS_axis::XPS_axis char *  adresse,
char *  Group_name,
char *  Actionneur_name,
ACE_Time_Value  time_out
 

Constructor: Takes 4 parameters.
(1) char *adresse ---> The ip adress of the xps device
(2) char *Groupe_name ---> The name of the axes group you want to command
(3) char * Actionneur_name ---> The name of the axis you want to command
(4) ACE_Time_Value time_out ---> The communication time_out

XPS_axis::~XPS_axis  ) 
 

Classical destructor : Nothing special


Member Function Documentation

int XPS_axis::close_dialog  )  [private]
 

This one close the communication

int XPS_axis::create_dialog  )  [private]
 

This function provides all the steps to connect the client to the XPS

int XPS_axis::end_jog  ) 
 

to stop the jog

int XPS_axis::get_acc double &  acc  ) 
 

To read the PROGRAMMED acceleration

int XPS_axis::get_error_as_string int  code,
char *  s
 

To transform an XPS command error code
into a semi_human language ;-)

int XPS_axis::get_soft_limit double &  plus,
double &  minus
 

To read software plus and minus limit of displacement

int XPS_axis::get_speed double &  velocity  ) 
 

To read the PROGRAMMED speed
Warning: XPS has no capabilities to read the currant moving speed

int XPS_axis::get_status_as_string int  code,
char *  s
 

To transform a group status code
into a semi_human language ;-)

int XPS_axis::get_timeout ACE_Time_Value &  time  ) 
 

To read the communication programmed Time Out

int XPS_axis::halt  ) 
 

this is the hard way to stop a group moving or whatelse
It just kill the group without any test!
Use it only in case of emergency.

int XPS_axis::initialization  ) 
 

To initialize a group axis.
the initialization is done after 3 steps
1) We do a GroupKill because it's not authorized to re-initialize a group
so, to be sure everything is ok we try to kill it before.
2) Then we do a GroupInitialize
3) Then we do a GroupHomeSearch, while to process is complete and the motor
is ready to move only when a homing has been done

int XPS_axis::is_initialized bool &  init  ) 
 

This function is here to know the initialization
status of a group axis
return true if initialization done
or false if initialization is not done/complete
Note: the initialization is complete after a GroupInitialize and a GroupHomeSearch
The group axis will not be ready to move if homing is not done.

int XPS_axis::is_motor_on bool &  is_on  ) 
 

This function is here to read if the motor is on or off
return true if on
or false if off.

int XPS_axis::is_moving bool &  is_moving  ) 
 

This function is here to know if a group axis is moving
return true if moving
or false if not.

int XPS_axis::is_ready bool &  ready  ) 
 

This function is here to know if a group axis is ready to move
return true if ready to move
or false if not.

int XPS_axis::jog_minus  ) 
 

continuous displacement in minus

int XPS_axis::jog_plus  ) 
 

continuous displacement in plus

int XPS_axis::lit_version char *  version  ) 
 

This function provides the version of the XPS firmware.
For maintenance purpose only.

int XPS_axis::move_absolute double  pos  ) 
 

absolute displacement
pos --> value of the position after displacement

int XPS_axis::move_relative double  depl  ) 
 

relative displacement
depl --> value of the displacement (in predefined XPS unit)

int XPS_axis::position_read double &  pos  ) 
 

To read the axis position

int XPS_axis::read_eor int &  eor  ) 
 

Read the End of Run status
Code 0 --> No End of Run
Code 1 --> End of Run (PLUS)
Code 2 --> End of Run (MINUS)
Code 3 --> End of Run (PLUS and MINUS) --> Check your wires

int XPS_axis::read_status int &  stat  ) 
 

To read the status code of a group axis (cf XPS doc for codes)

int XPS_axis::send char *  message  ) 
 

To send a command without waiting for any response

int XPS_axis::send_and_receive char *  message,
char *  reponse
 

To send a command waiting for a response

int XPS_axis::set_acc double &  acc  ) 
 

To set the acceleration

int XPS_axis::set_motor_off  ) 
 

To set a motor off

int XPS_axis::set_motor_on  ) 
 

To set a motor on

int XPS_axis::set_soft_limit double  plus,
double  minus
 

To set software plus and minus limit of displacement

int XPS_axis::set_speed double &  velocity  ) 
 

To set the speed

int XPS_axis::set_timeout ACE_Time_Value  time  ) 
 

This function is here to set the communication Time Out
Warning: this time out must be < to the TANGO time out

int XPS_axis::stop  ) 
 

the soft/normal way to stop a group moving
with deceleration.

int XPS_axis::test_error int  code  ) 
 

To capture the native error code of an XPS command, transform
it in semi_human language and throw it to tango using the Exception class.


Member Data Documentation

double XPS_axis::acceleration [private]
 

char XPS_axis::ErrorString[100]
 

If an error occurs we want to have a semi_human description of the error

char XPS_axis::group_name[50]
 

The name of the group

char XPS_axis::ip_addr[50]
 

The ip address of the xps

char XPS_axis::origin_error[100]
 

If an error occurs we want to know from what function it comes

char XPS_axis::positioner_name[50]
 

The name of the axis in the group

ACE_SOCK_Stream XPS_axis::socket_send_and_receive_XPS [private]
 

This (ACE'ed) socket is used to send some commands and waiting for the response.
Very usefull if you want to read positions af an axis ;-)

ACE_SOCK_Stream XPS_axis::socket_send_XPS [private]
 

This (ACE'ed) socket is used to send some commands without waiting for any response.
The XPS responds to each command at the end of the execution of the command.
It can be very long and causes time out problems:

1) There's some solutions to handle sockets in this situation
(Asynchronus communication) but...
2) There's also a TANGO time out, so we decide to use this trick.

double XPS_axis::speed [private]
 

ACE_Time_Value XPS_axis::timeout [private]
 

Communication time out


The documentation for this class was generated from the following files:
Generated on Wed Jan 4 14:53:06 2006 for class_xps_axis by  doxygen 1.4.5