- Various little fixes to the TAS software
- Added a sync command for synchronizing a simulation server with the master server.
This commit is contained in:
38
tasdrive.c
38
tasdrive.c
@ -65,13 +65,14 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
{
|
||||
pTASdata self = NULL;
|
||||
int iTAS = 0;
|
||||
float tasTargets[20];
|
||||
unsigned char tasTargetMask[20], tasMask[10];
|
||||
float tasTargets[20], oldPos, oldEnergy[MAXEVAR];
|
||||
unsigned char tasTargetMask[20], tasMask[MAXEVAR];
|
||||
char *pPtr, pToken[20], pLine[256];
|
||||
int varPointer, i, motorPointer, status, rStatus, lastToken;
|
||||
char pBueffel[256];
|
||||
unsigned char motorMask[MAXMOT];
|
||||
float newPositions[MAXMOT];
|
||||
pMotor pMot;
|
||||
|
||||
|
||||
|
||||
@ -99,6 +100,7 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
motorMask[10+i] = 0;
|
||||
tasTargets[i] = .0;
|
||||
tasTargets[i+10] = .0;
|
||||
oldEnergy[i] = .0;
|
||||
}
|
||||
for(i = 0; i < MAXMOT; i++)
|
||||
{
|
||||
@ -144,6 +146,7 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
else if(varPointer >= 0 )
|
||||
{
|
||||
tasMask[varPointer] = 1;
|
||||
oldEnergy[varPointer] = self->tasPar[EMIN+varPointer]->fVal;
|
||||
self->tasPar[EMIN + varPointer]->fVal = atof(pToken);
|
||||
}
|
||||
else
|
||||
@ -186,8 +189,17 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
{
|
||||
if(motorMask[i] > 0)
|
||||
{
|
||||
sprintf(pBueffel,"Driving %s to %f",
|
||||
tasMotorOrder[i],newPositions[i]);
|
||||
pMot = FindMotor(pSics, tasMotorOrder[i]);
|
||||
if(pMot)
|
||||
{
|
||||
MotorGetSoftPosition(pMot, pCon, &oldPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldPos = -9999.;
|
||||
}
|
||||
sprintf(pBueffel,"Driving %s from %f to %f",
|
||||
tasMotorOrder[i],oldPos,newPositions[i]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
status = StartMotor(pServ->pExecutor,pSics,pCon,
|
||||
tasMotorOrder[i],newPositions[i]);
|
||||
@ -215,8 +227,9 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
{
|
||||
if(tasMask[i])
|
||||
{
|
||||
sprintf(pBueffel,"Driving %s to %f", tasVariableOrder[EI+i],
|
||||
self->tasPar[EI+i]->fVal);
|
||||
sprintf(pBueffel,"Driving %s from %f to %f", tasVariableOrder[EI+i],
|
||||
oldEnergy[i],
|
||||
self->tasPar[EI+i]->fVal);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
@ -227,8 +240,17 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
{
|
||||
if(tasTargetMask[i])
|
||||
{
|
||||
sprintf(pBueffel,"Driving %s to %f",tasMotorOrder[i],
|
||||
tasTargets[i]);
|
||||
pMot = FindMotor(pSics, tasMotorOrder[i]);
|
||||
if(pMot)
|
||||
{
|
||||
MotorGetSoftPosition(pMot, pCon, &oldPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldPos = -9999.;
|
||||
}
|
||||
sprintf(pBueffel,"Driving %s from %f to %f",tasMotorOrder[i],
|
||||
oldPos, tasTargets[i]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user