PSI sics-cvs-psi-2006

This commit is contained in:
2006-05-08 02:00:00 +00:00
committed by Douglas Clowes
parent ae77364de2
commit 6e926b813f
388 changed files with 445529 additions and 14109 deletions

View File

@@ -41,8 +41,31 @@
#include <assert.h>
#include "fortify.h"
#include "sics.h"
#include "motor.h"
/*=========================================================================
Empty driveable interface functions
==========================================================================*/
static int EmptyHalt(void *self){
return OKOK;
}
/*-----------------------------------------------------------------------*/
static int EmptyLimits(void *self, float fVal, char *error, int errLen){
return 1;
}
/*-----------------------------------------------------------------------*/
static long EmptyValue(void *self, SConnection *pCon, float fVal){
SCWrite(pCon,"WARNING: empty SetValue",eWarning);
return OKOK;
}
/*-----------------------------------------------------------------------*/
static int EmptyStatus(void *self, SConnection *pCon){
return HWIdle;
}
/*------------------------------------------------------------------------*/
static float EmptyGet(void *self, SConnection *pCon){
SCWrite(pCon,"WARNING: empty GetValue",eWarning);
return 555.55;
}
/*-------------------------------------------------------------------------*/
pIDrivable CreateDrivableInterface(void)
{
@@ -55,6 +78,12 @@
}
memset(pRes,0,sizeof(IDrivable));
pRes->ID = DRIVEID;
pRes->Halt = EmptyHalt;
pRes->CheckLimits = EmptyLimits;
pRes->SetValue = EmptyValue;
pRes->CheckStatus = EmptyStatus;
pRes->GetValue = EmptyGet;
pRes->drivableStatus=HWIdle;
return pRes;
}
/*-------------------------------------------------------------------------*/
@@ -108,6 +137,31 @@
{
return (pIDrivable)FindInterface(pObject,DRIVEID);
}
/*-------------------------------------------------------------------------*/
int GetDrivablePosition(void *pObject, SConnection *pCon, float *fPos)
{
pIDrivable pDriv = NULL;
pMotor pMot = NULL;
float value;
pDriv = GetDrivableInterface(pObject);
if(pDriv == NULL)
{
return 0;
}
if(iHasType(pObject,"Motor"))
{
pMot = (pMotor)pObject;
return MotorGetSoftPosition(pMot,pCon,fPos);
}
value = pDriv->GetValue(pObject,pCon);
if(value < 9999.99)
{
return 0;
}
*fPos = value;
return 1;
}
/*--------------------------------------------------------------------------*/
pICountable GetCountableInterface(void *pObject)
{