73 lines
2.8 KiB
C
73 lines
2.8 KiB
C
/*--------------------------------------------------------------------------
|
|
SICS needs to run motors. This is where this happens.
|
|
|
|
Mark Koennecke, November 1996
|
|
|
|
copyright: see implementation file
|
|
|
|
----------------------------------------------------------------------------*/
|
|
#ifndef SICSMOTOR
|
|
#define SICSMOTOR
|
|
#include "Scommon.h"
|
|
#include "obpar.h"
|
|
#include "modriv.h"
|
|
#include "obdes.h"
|
|
#include "interface.h"
|
|
|
|
#define MOTOBPARLENGTH 12
|
|
typedef struct __Motor {
|
|
pObjectDescriptor pDescriptor;
|
|
ObPar *ParArray;
|
|
pIDrivable pDrivInt;
|
|
pICallBack pCall;
|
|
char *drivername;
|
|
char *name;
|
|
MotorDriver *pDriver;
|
|
float fTarget;
|
|
float fPosition;
|
|
long endScriptID;
|
|
int posCount; /* counter for calling the
|
|
motor callback */
|
|
int retryCount; /* for retries in status */
|
|
int posFaultCount;
|
|
int stopped;
|
|
} Motor;
|
|
typedef Motor *pMotor;
|
|
/*------------------------------------------------------------------------
|
|
a tiny structure used in CallBack work
|
|
--------------------------------------------------------------------------*/
|
|
typedef struct {
|
|
float fVal;
|
|
char *pName;
|
|
} MotCallback;
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
/* parameter management */
|
|
int MotorGetPar(pMotor self, char *name, float *fVal);
|
|
int MotorSetPar(pMotor self, SConnection *pCon, char *name, float fVal);
|
|
|
|
/* driving */
|
|
long MotorRun(void *self, SConnection *pCon, float fNew);
|
|
int MotorCheckBoundary(pMotor self, float fVal, float *fHard,
|
|
char *error, int iErrLen);
|
|
int MotorCheckPosition(void *self, SConnection *pCon);
|
|
|
|
/* Where are we ? */
|
|
int MotorGetSoftPosition(pMotor self,SConnection *pCon, float *fVal);
|
|
int MotorGetHardPosition(pMotor self,SConnection *pCon, float *fVal);
|
|
float MotorHardToSoftPosition(pMotor self, float fHard);
|
|
|
|
/* creation */
|
|
int MotorCreate(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|
int argc, char *argv[]);
|
|
pMotor MotorInit(char *drivername,char *name, MotorDriver *pDriv);
|
|
void MotorKill(void *self);
|
|
|
|
/* interface to interpreter */
|
|
int MotorAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|
int argc, char *argv[]);
|
|
pMotor FindMotor(SicsInterp *pSics, char *name);
|
|
|
|
#endif
|
|
|