davidbuckley.net |
home >  Pop >  | 16 October 2022 |
'---------------- main user routine names ---------- ' F Forward ' B Backward ' Br back with right foot ' Bl back with left foot ' R RightTurn ' L LeftTurn ' H Halt, stand to attention ' V Voice, beep 1KHz for 0.1sec ' U do Ultrasonic test react using UawareAt, UtooNear from AUawareAt, AUtooNear ' T if no parameter do Tf ' Tf Foot Turn - if Left forward turn right, if Right forward turn left ' Tm memory Turn - same way as last time ' To Other Turn - opposite way to last time ' G ask Cmndr if Step - read Sharp-IR - sets fB_SgOn=1 ' g - sets fB_SgOn=0 '' g foot sensors - no room so use fB_StOn '' g0 foot sensors off => fB_SgOn =0 - no room '' g1 foot sensors on => fB_SgOn =1 - no room ' A ask Cmndr for default Act ' Q Quit and wait for cmnds ' w Wait 1/10 secs in next cmnd, if next cmnd is not number then wait 0 secs ' m set rollby and stepby; actualrollby =15+rollby, actualstepby =stepby*3; resolution roll 10us, stepby 30us ' <bytevalue> => $XX => rollbyNibble stepbyNibble ' $hh => rollbyNibble stepbyNibble ' a<Act> jump to Act in next byte ' r<Act> do Act in next byte as reaction ' ' comment start, ignore all until next ' ' s<num> set speed, maxed to potspeed 1-15, turn off program auto speed adj ' sc => turn on potspeed (1-15) ' su => increase speed, maxed to potspeed 1-15 ' sd => decrease speed MIN 1 ' sp => set pace-speed, 0 - 15 10us resolution 0 ignored ' sr => set roll-speed, 0 - 15 10us resolution 0 ignored ' s$ => set RollSpeedNibble and PaceSpeedNibble in next byte, $hh, 10us resolution ' f foot sensors ' f0 foot sensors off => fB_StOn =0 ' f1 foot sensors on => fB_StOn =1 ' d<Act> set defaultAct in next byte '' um<Do> if Urange<Umemory '' u+<num> set UawareAt '' u-<num> set UtooNear '' ur<num><Do> if Urange<num> 'AabCEeGghIiJjKklMNnOoPpQqStUuvWXxYyZz available as primary cmnd '!¬`|\/<>@~#:;,[]{}()*&^£ available ''/jump to Act in next byte ''\act as reaction Act in next byte '' "blm",LeftFootMaskbyte '' "brm",RightFootMaskbyte '' "ble",LeftFootExpectedbyte '' "bre",RightFootExpectedbyte ' '---------------- system names ----------- 'PoseData 'pRollR DATA rollC +roll,0 'pRollL DATA rollC -roll ,0 'pRollC DATA rollC,0 'ppaceC DATA paceC,0 '================ Mind ===================================================== zz CON 16 'selected on [KEY_POWER] ' Act 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ' A B C D E F ' DoIndex DATA A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,Azz 'A0 init Act done after poweron or reset, defaultAct got from Cmndr A0 DATA "'A0'" DATA "m$3D"'"m$7A" 'rollby=7, stepby=10 DATA "s$66" 'rollspeed=6, pacespeed=6 DATA "Vw5Hw5V" 'wait 1 sec - easier to see initial position, then get Act DATA "f1A." 'BumpSensorsOn, get default Act '---------------- Acts -- if ended with '.' are Activities ----------------- ' if not ended with '.' continue with next Act 'end lists with "." otherwise starts doing next Act! 'Acts can have any legal variable name. 'Any repeat parameter for FBRLV etc will be ignored - code removed after 6-1-1 ** A1 DATA "FFRRH w2 LLBBBH." 'roughly F & B about same spot A2 DATA "'A2'suFUa2" A3 DATA "'A3'Ga2" 'HWFFH W1 BB." A4 DATA "Vw V w5." 'w missing param so does w0 A5 DATA "H" ',"W1FW1F." A6 DATA " " 'scRRRRRLLLLL." A7 DATA "LLRR." A8 DATA "FRV." A9 DATA "RRRLLL." A10 DATA " " 'FFFFFFFBBBBBBB." A11 DATA "sdFsua3" A12 DATA "." 's$36,FFFm$7A FFFs$22,m$44,BBBBBB." A13 DATA "." 'suFFFBBB." A14 DATA "BGf0GF 2R2 5 7junk g 'test'V." 'test repeat param' 2 5 7=257=2 **ignored 'Az DATA A15 DATA "d13g." Azz DATA "f0." 'selected on [KEY_POWER] 'A15 DATA "suF." '---------------- frustration reactions ------- 'have to turn off the Toe sensors until moved away from obstacle otherwise loops rf1R DATA "f0VVVBf1RR." 'if (hurtsR+hurtsL) >= hurtedRL1 rf2L DATA "f0VVVVVBf1LLLL." 'if (hurtsR+hurtsL) >= hurtedRL2 '---------------- bump reactions -------------- 'if toeX bumped then hurtsX +=hurted rbR DATA "f0VsdBrBf1L." 'if hurtsR >= hurted rbL DATA "f0VVsdBlBf1R." 'if hurtsL >= hurted '---------------- US reactions ---------------- rUawareAt DATA "VTf." rUtooNear DATA "VVBTmTm." '---------------------------------------------- Bend DATA "." 'end marker to avoid doing the program!