Joe Ambler ========== '---------------- user commands ---------- 'Action cmnds Z CON 0 'end of list, null move F CON 1 'Forward B CON 2 'Back R CON 3 'Right turn L CON 4 'Left turn H CON 5 'Halt, stand to attention V CON 6 'Voice, beep 1KHz for 0.1sec Br CON 7 'Back with right foot, for toe bump Bl CON 8 'Back with left foot, for toe bump fT CON 9 'footTurn, turn away from leading Foot mT CON 10 'memoryTurn, turn same way as last time, use f_TurnedR oT CON 11 'otherTurn, turn other way and toggle f_TurnedR Vt CON 12 'Voice Tune Vb CON 13 'Voice Beep 'Behavioural cmnds Su CON 20 'increase speed(+1) MAX potspeed Sd CON 21 'reduce speed(/2) MIN minpacespeed tbOn CON 22 'SensorToeBump on tbOff CON 23 'SensorToeBump off bk CON 24 'set fb_Fdir to 0 so StepandTurn is stepback 'frustUp CON 25 'frustration, inc Nibble frust Wlight CON 25 'walk towards light Wdark CON 26 'walk towards dark Ewoff CON 27 'Eye Walk off ttyOn CON 28 'debug text On ttyOff CON 29 'debug text Off Ew CON 30 'Eye walk, test and set paceTurn h0 CON 31 'reduce hurts to zero, otherwise frustration behaviour gets subsumed after next move usOn CON 32 usOff CON 33 'Parameter cmnds 'could use '(ASC 39) for tty comments ,"'comment'" instead of tty,"comment¬" w CON 40 'Wait 1/10 secs in next byte a CON 41 'jump to Act in next byte s CON 42 'set speeds to next byte, $rp '$55 is max for servos to follow pulse 'from Pot(^15) works best with pacerollspeedratio =1 m CON 43 'set Roll and Step to next byte $rollby,stepby 'S03 max speed is 45.5us/frame @20ms/frame, max potspeed is 15 'rollby <$0-$F> delta roll from rollmin 'actualrollby =rollby +rollmin ie rollby=0 => rollC +-rollmin 'if rollby 7 '=>+-(7+15)*10us=*-220us '@ speed 5(10us)=50us '=>440/50*20ms=176ms/STEP & 9 frames 'stepby <$0-$F> '(in 30us units, 15=>450us so pace is 2*450=900us) 'pacepulse =+-(3*stepby)+paceC 'ie 150+-45 => 105 - 195 (10us) => 1050 - 1950us 'if stepby 10 ($A) '=>+-300us '@ speed 5(10us)=50us '=>600/50*20ms=240ms/step & 12 frames 'so at speed=5 rollby=7 stepby=10 one step takes 240+176=416ms 'rolltime/steptime =176/240 =0.73 d CON 44 'set default Act to next byte usa CON 45 'set USaware range(<=) to next low.nib resolution 2"=>5cm, max 15=>30" IfusOn CON 46 IfusL CON 47 'US if Less ; if USRange; if USRange8" A0 DATA w,1,Z 'just wait '---------------- frustration behavioural Acts ------- 'inhibit sensors until Toe moved back a bit, otherwise just loops to here Af1 DATA tty,"Af1R¬",h0,tbOff,V,V,V,B,tbOn,mT,mT,Z 'if (hurtsR+hurtsL)>hurting Af2 DATA tty,"Af2L¬",h0,tbOff,V,V,V,V,V,B,tbOn,B,mT,mT,mT,Z 'if (hurtsR+hurtsL)>hurtalot '---------------- bump behavioural Acts ------------- 'if toeX bumped then hurtsX += ahurt 'inhibit sensors until Toe moved back a bit, otherwise just loops to here AbR DATA tty,"AbR¬",tbOff,V,Sd,Br,B,tbOn,L,Z 'if hurtsR>hurtalittle AbL DATA tty,"AbL¬",tbOff,V,V,Sd,Bl,B,tbOn,R,Z 'if hurtsL>hurtalittle '---------------- US behavioural Acts ------------- USTfScan DATA tty,"`USTfScan¬" DATA V,fT,IfusLm,USoTscan,IfusL,4,USmT,Z 'TurnScan, using Tf means centre doesn't move (much) USoTscan DATA tty,"`USoTscan¬" DATA V,V,oT,bk,mT,mT,IfusL,4,USmT,Z 'OtherTurnScan bk so so stepturn doesn't move closer USmT DATA tty,"`USmT¬" DATA V,V,V,bk,mT,mT,IfusL,4,USmT,Z 'MemoryTurn bk so so stepturn doesn't move closer 'USslow DATA Sd,Z USback DATA B,fT 'and test again '---------------- US behavioural Rules ------------- 'Behaviour variable thresholds and BehaviouralAction 'US: ActionRange,Act USavoid DATA V,tty,"USavoid¬" ' DATA frustUp 'UScaution DATA tty,"caut¬",usIFL,3,USslow UStooclose DATA tty,"close¬",IfusL,2,USback 'Joe 3 USinway DATA tty,"way¬",IfusL,4,USTfScan DATA Z '---------------- Tactile behavioural rules --- HurtRules DATA tty,"Hrules¬" frus2 DATA IfHLR,hurtingalot,Af2 'L+R >hurtingalot frus1 DATA IfHLR,hurting,Af1 'L+R >hurting hurtR DATA IfHR,hurtalittle,AbR 'R >ahurt hurtL DATA IfHL,hurtalittle,AbL,Z 'L >ahurt '---------------------------------------------- Bend DATA Z 'end marker to avoid doing the program! '----------------------------------------------