HError(-1189,"HList: Warning ALIEN src file format set"); break; case 'T': trace = GetChkedInt(0,077,s); break; default: HError(1119,"HList: Unknown switch %s",s); } } if (NumArgs() == 0 ) ListSpeech(NULL); else while (NumArgs() > 0 ) { if (NextArg() != STRINGARG) HError(1119,"HList: List file name expected"); ListSpeech(GetStrArg()); } Exit(0); return (0); /* never reached -- make compiler happy */ } /* -------------------- Display Routines ------------------- */ typedef struct{ /* gather together basic header info */ char *name; Boolean isSource; Boolean isAudio; FileFormat fmt;
int main() { int wait; // Set up port for start switch lcdInit(); // Set up motors and encoders motorInit(); encodersInit(); servoInit(); // Set up IRs gp2d12Init(PIN_HEAD_IR); digitalSetDirection(PIN_IR,AVRRA_INPUT); digitalSetData(PIN_IR,AVRRA_LOW); // Set up OP599A - analog already initialized digitalSetDirection(PIN_PHOTO,AVRRA_INPUT); digitalSetData(PIN_PHOTO,AVRRA_LOW); // Set up fan & test digitalSetData(PIN_FAN, AVRRA_LOW); digitalSetDirection(PIN_FAN, AVRRA_OUTPUT); digitalSetData(PIN_FAN, AVRRA_HIGH); delayms(25); digitalSetData(PIN_FAN, AVRRA_LOW); lcdPrint("Wait... "); wait = digitalGetData(PIN_START); while(wait) { // standard delay .. delayms(10); wait = digitalGetData(PIN_START); } // Start our map mapInit(); lcdClear(); PrintHeading(lheading,nStart); sei(); // Run Behaviors while(1) { // update odometer while(rCount > COUNTS_CM(1) ) { // odometer is in CM odometer = odometer - 1; rCount = rCount - COUNTS_CM(1); } // now run behaviors if(arbitrate()>0) { // let motors wind down delayms(500); clearCounters; plan(); clearCounters; } } }
HTime period; int sampSize; int numComps; long nSamples; }HeadInfo; /* PrBar: print a horizantal bar of length n including title */ void PrBar(char *title) { int i,len,n; if (rawOut) return; len = strlen(title); n = (barwidth - len)/2; for (i=1; i<n; i++) putchar(barc); printf(" %s ",title); n = barwidth - n - len; for (i=1; i<n; i++) putchar(barc); putchar('\n'); } /* SetBarWidth: set bar width according to nItems and item type */ void SetBarWidth(int itemWidth)
barwidth = itemWidth*(nItems+1); } /* PrintHeading: print the info in given HeadInfo record */ void PrintHeading(HeadInfo h) { char buf[MAXSTRLEN]; if (h.isSource){ if (h.isAudio) strcpy(buf,"Source: Direct Audio"); else sprintf(buf,"Source: %s", h.name); }else strcpy(buf,"Target"); PrBar(buf); printf(" Sample Bytes: %-7d", h.sampSize); if (barwidth < 60 ) printf("\n"); printf(" Sample Kind: %s\n", ParmKind2Str(h.kind,buf)); printf(" Num Comps: %-7d", h.numComps); if (barwidth < 60 ) printf("\n"); printf(" Sample Period: %.1f us\n", h.period/10.0); if (!h.isAudio) { printf(" Num Samples: %-7ld", h.nSamples); if (barwidth < 60 ) printf("\n"); printf(" File Format: %s\n", Format2Str(h.fmt)); } } /* PrintWaveLine: print line of waveform samples */ void PrintWaveLine(short *data, int nItems, long idx) { int i; if (!rawOut) printf("%5ld: ",idx); for (i=0; i<nItems; i++) printf("%7d",*data++); printf("\n"); } /* PrintRawVec: print vector components */ void PrintRawVec(Vector v) { int i; for (i=1; i<=VectorSize(v); i++) printf("%e ",v[i]); printf("\n");