'Ullr_8-3.bas 'Ullr_7-3.bas 'Ullr_6-3.bas 'Baldur_6-3.bas #picaxe 40x2 #slot 3 '#no_table #no_data #define keybip 'for ReadSerCmnd DISCONNECT SETFREQ m16 '#3 Memory used = 4085 bytes out of 4096 ?help, @Setup #rem '================================================== IF cmnd ="h" THEN GOSUB PrintHelp IF cmnd ="@" THEN GOSUB SETUP 'from "b@" '================================================== #endrem '================================================== Pins: '========================== SYMBOL servoLR =A.1 SYMBOL servoLP =A.0 SYMBOL servoRR =D.3 SYMBOL servoRP =D.2 SYMBOL whiskerLLED =A.6 SYMBOL whiskerRLED =A.7 SYMBOL whiskerL =A.5 'READADC needs port.pin not a symbol SYMBOL whiskerR =D.0 'READADC needs port.pin not a symbol SYMBOL EyeLLED =C.2 SYMBOL EyeRLED =C.1 SYMBOL feelerLLED =D.7 SYMBOL Lfeeler =pinD.6 'READADC needs port.pin not a symbol SYMBOL Rfeeler =pinD.5 'READADC needs port.pin not a symbol SYMBOL tipB =pinD.6 SYMBOL tipF =pinD.5 SYMBOL pin_tipB =D.6 SYMBOL pin_tipF =D.5 SYMBOL feelerRLED =D.4 SYMBOL pingpin =C.0 SYMBOL voiceLED =C.5 SYMBOL voice =C.5 SYMBOL senseLtoe =pinA.2 SYMBOL senseRtoe =pinD.1 SYMBOL inIR =A.3 SYMBOL inIRpin =pinA.3 'SYMBOL O_LCD =A.4 'bus B.7 - B.0 '================================================== VarsCons: '================================================== SYMBOL Esc =27 'Escape key SYMBOL quote2 =34 'double quote mark 'built in variables 'bptr = RAM pointer 'ptr - scratchpad pointer 'hserptr - pointer to scratchpad location of last byte received by hardware UART 'X2 parts - bit0-31 b0-55 w0-27 +56 - 255 Peek/Poke 'W0 SYMBOL sense0 =b0 SYMBOL temp0 =b0 SYMBOL f8_behaves =b1 'used in programs 0123 w=write r=read !=wr SYMBOL f_b_react =bit8 'wrr- 1=reacts on SYMBOL f_b_Qground =bit9 'w!r- 1= auto test ground sensors, "bg" SYMBOL f_b_autoUp =bit10 'wrr- tested in Qfell, default=1 "bu" SYMBOL f_b_Uon =bit11 'w!R- Ultrasonic sense ON SYMBOL f_b_F =bit12 '-!-- Forward - set by Fd/Bk etc SYMBOL f_Bmodified =bit13 'w!-- behaviour settings modified 'SYMBOL f_tF =bit14 '-!-- last turn on spot SYMBOL f_Crawl =bit15 '!r-- 0=>be Tall, 1=>Crawl 'W1 SYMBOL f8_Cmnder0 =b2 SYMBOL f_warm =bit16 '!--- SYMBOL f_play =bit17 '!--- SYMBOL f_record =bit18 '!--- SYMBOL f_recordC =bit19 '!--- SYMBOL f_waitcmnd =bit20 '!--- just wait for an IRkey or Serin SYMBOL f_IRcmnd =bit21 '!r-- 1=>IRcmnd 0=>Serial/Play cmnd SYMBOL f_page0 =bit22 'w-!- 1=Acts/Slots 01-07, 0(default) =1-8 SYMBOL f_React =bit23 ' SYMBOL f8_doServos =b3 'ww-- SYMBOL f_RRdo =bit24 '-!-! do servo SYMBOL f_RPdo =bit25 '-!-! do servo SYMBOL f_LRdo =bit26 '-!-! do servo SYMBOL f_LPdo =bit27 '-!-! do servo SYMBOL f_RRpulse =bit28 'r!-r pulse servos SYMBOL f_RPpulse =bit29 'r!-r pulse servos SYMBOL f_LRpulse =bit30 'r!-r pulse servos SYMBOL f_LPpulse =bit31 'r!-r pulse servos 'W2 SYMBOL W2pulse =w2 SYMBOL W2pulselo =b4 SYMBOL W2pulsehi =b5 SYMBOL W2temp =w2 'Interpage jumps for hserptr SYMBOL W2templo =b4 SYMBOL W2temphi =b5 SYMBOL W2temp0 =b4 SYMBOL W2temp1 =b5 'W3 SYMBOL cmnd =b6 SYMBOL RootCmnd =b7 SYMBOL servonum =b7 'SETUP 'W4 SYMBOL RPC =b8 'Right Hip Pace Centre for current posture SYMBOL LPC =b9 'Left Hip Pace Centre for current posture 'W5 SYMBOL RRC =b10 'Right Hip Roll Centre for current posture SYMBOL LRC =b11 'Left Hip Roll Centre for current posture 'W6 SYMBOL RPat =b12 'Servo Right Hip Pace At SYMBOL RPto =b13 'Servo Right Hip Pace To 'W7 SYMBOL LPat =b14 'Servo Left Hip Pace At SYMBOL LPto =b15 'Servo Left Hip Pace To 'W8 SYMBOL RRat =b16 'Servo Right Hip Roll At SYMBOL RRto =b17 'Servo Right Hip Roll To 'W9 SYMBOL LRat =b18 'Servo Left Hip Roll At SYMBOL LRto =b19 'Servo Left Hip Roll To 'W10 SYMBOL Sspeed =b20 '1-9 SYMBOL Sframe =b21 'Servo frame pause in ms 'W11 SYMBOL FL =b22 'Foot Lift UpDown movement SYMBOL FP =b23 'Foot Pace ForwardBack movement 'W12 SYMBOL FT =b24 'Foot Turn SYMBOL FLcmnd =b25 'Foot Lift UpDown movement 0-9 'W13 SYMBOL FPcmnd =b26 'Foot Pace ForwardBack movement 0-9 SYMBOL FTcmnd =b27 'Foot Turn movement 0-9 'W14 SYMBOL Scmnd =b28 ''Speed 1-9 SYMBOL IRcmnd =b29 'W15 SYMBOL Actptr =b30 SYMBOL ActEnd =b31 'W16 SYMBOL slot =b32 SYMBOL hframes =b33 'halt frames 'W17 SYMBOL kickcmnd =b34 SYMBOL Speedmax =b35 '1-9 'W18 SYMBOL FinCmnd =b36 'Foot Up In = 9 -FUI *FL /9 SYMBOL ReactAt =b37 'React Table pointer 'W19 SYMBOL yawn =b38 SYMBOL standOnLR =b39 '%LR 1=down moving test toes if if <>%11 'W20 'SYMBOL topple =b40 'Thor SYMBOL usdist =b41 'prog2 'W21 SYMBOL Bo =b42 'lean back offset for backwards 'SYMBOL FLTmin =b42 'min Lift in Turns, Thor SYMBOL TOO =b43 'Toes Offset Out (Front 'Freya, Thor) 'W22 'SYMBOL RHcmnd =b44 'controls Hip Centres for RideHeight 0-9 in 1-NewBehave: 'Thor 'SYMBOL RHcmndold =b45 'last Ride height cmnd 'Thor 'W23 'W24 'W25 'W26 'SYMBOL stackcmnd =b53 'W27 SYMBOL W27temp =w27 'prog1 SYMBOL W27temp0 =b54 'prog1 SYMBOL W27temp1 =b55 'prog1 'SYMBOL temp54 =b54 ' SYMBOL temp55 =b55 'prog1 '--------- 'Variables - Storage - peek and poke '------------------- '200 56 to 255 ($38 to $FF) SYMBOL RAM_temp0 =56 'first non variable RAM location 'SYMBOL RAM_P1_f8_flags =57 'Prog1 flags 'turned Left bit 0 '1=last turned Left, 0=Right ''SYMBOL RAM_holedetectR =58 ' ''SYMBOL RAM_holedetectL =59 ' SYMBOL RAM_obstaclesR =60 'map SYMBOL RAM_obstaclesL =61 'map SYMBOL RAM_lightR =62 'whisker ambient light level Right SYMBOL RAM_lightL =63 'whisker ambient light level Left SYMBOL RAM_UStoonear =64 SYMBOL RAM_USawareAt =65 SYMBOL RAM_USunits_cm_ =66 SYMBOL RAM_USlast =67 SYMBOL RAM_WhiskerR =68 SYMBOL RAM_WhiskerL =69 SYMBOL RAM_WhiskerRlit =70 SYMBOL RAM_WhiskerLlit =71 SYMBOL RAM_FeelerR =72 SYMBOL RAM_FeelerL =73 SYMBOL RAM_FeelerRlit =74 SYMBOL RAM_FeelerLlit =75 SYMBOL RAM_Wthresh =76 SYMBOL RAM_Fthresh =77 SYMBOL RAM_Sspeed =78 'SYMBOL RAM_randvarLo =68 'SYMBOL RAM_randvarHi =69 'SYMBOL RAM_randseedlo =70 'SYMBOL RAM_randseedhi =71 SYMBOL EEPROM_LPC =255 'logical value SYMBOL EEPROM_LRC =254 'logical value SYMBOL EEPROM_RPC =253 'logical value SYMBOL EEPROM_RRC =252 'logical value SYMBOL EEPROM_TOO =251 'Toes Offset Out SYMBOL EEPROM_FLcmnd =250 'Foot Lift movement 1-9 SYMBOL EEPROM_FPcmnd =249 'Pace ForwardBack movement 1-9 SYMBOL EEPROM_FTcmnd =248 'Foot Turn movement 1-9 SYMBOL EEPROM_Speeds =247 'HiNib=speedmax(9), LoNib=speed(1) SYMBOL EEPROM_FinCmnd =246 'SYMBOL EEPROM_Bo =245 'Back lean back SYMBOL EEPROM_kickcmnd =244 SYMBOL EEPROM_f8_behaves =243 SYMBOL EEPROM_Wthresh =242 SYMBOL EEPROM_Fthresh =241 SYMBOL EEPROM_USawarenear =240 'start of last 16 byte slot SYMBOL EEPROM_ActsEnd =239 'end of slot 06 '================================================================= 'SERVOS - ACTUAL values from PotSetRanges - values are in 10us units 'Cirrus-CS601-BB-STD 5.5Kgcm@4.8v, 0.2sec, +ve clockwise, 'jerk on poweron if not already being pulsed. '================================================================= SYMBOL SLPback = 47 '106 SYMBOL SLPb90 = 61 ' 92 SYMBOL SLPmid =153 ' 0 SYMBOL SLPf90 =246 ' 93 SYMBOL SLPfwd =250 ' 97 SYMBOL SLRout = 56 '140 SYMBOL SLRo90 =102 ' 95 SYMBOL SLRoeasy =186 ' 10 SYMBOL SLRoattn =191 ' 5 SYMBOL SLRstand =196 ' 0 SYMBOL SLRin =237 ' 41 SYMBOL SRPback =250 ' 96 SYMBOL SRPb90 =250 ' 96 SYMBOL SRPmid =154 ' 0 SYMBOL SRPf90 = 61 ' 93 SYMBOL SRPfwd = 53 '101 SYMBOL SRRout =234 '127 'seems to be stopped by something SYMBOL SRRo90 =198 ' 91 SYMBOL SRRoeasy =117 ' 10 SYMBOL SRRoattn =112 ' 5 SYMBOL SRRstand =107 ' 0 SYMBOL SRRin = 68 ' 39 'Left foot forward is +ve 'Left leg out is -ve 'Right foot forward is -ve 'Right leg out is +ve '================================================== 'LOGICAL 'foot forward is +ve 'leg out is +ve SYMBOL LPmin =SLPback SYMBOL LPb90 =SLPb90 SYMBOL LPmid =SLPmid SYMBOL LPf90 =SLPf90 SYMBOL LPmax =SLPfwd SYMBOL LRmax =256 -SLRout SYMBOL LRo90 =256 -SLRo90 SYMBOL LRoeasy =256 -SLRoeasy SYMBOL LRoattn =256 -SLRoattn SYMBOL LRstand =256 -SLRstand SYMBOL LRmin =256 -SLRin SYMBOL RPmin =256 -SRPback SYMBOL RPb90 =256 -SRPb90 SYMBOL RPmid =256 -SRPmid SYMBOL RPf90 =256 -SRPf90 SYMBOL RPmax =256 -SRPfwd SYMBOL RRmax =SRRout SYMBOL RRo90 =SRRo90 SYMBOL RRoeasy =SRRoeasy SYMBOL RRoattn =SRRoattn SYMBOL RRstand =SRRstand SYMBOL RRmin =SRRin 'for servo numbering in CaseAdjust: SYMBOL LP =3 SYMBOL LR =2 SYMBOL RP =1 SYMBOL RR =0 '-------------------------------------------------------------- SYMBOL DSframe =10 'default SFrame, LOOPs at ~40Hz/25ms SYMBOL Fclear =20 'minimum for toes to miss when walking SYMBOL TSO =2 'Toe Stand Offset - so toes clear each other '================================================================= ' SENSORS '================================================================= 'HgTilt '============================== PingSensors: '----------- ' At sea level sound travels through air at 1130 feet per second. ' This equates to 1 inch in 73.746 uS, or 1 cm in 29.034 uS. ' ' Since the Ping sensor measures the time required for the sound wave ' to travel from the sensor and back. The result is divided by two to ' remove the return portion of the echo pulse, then multiplied by 10 ' to convert 10uS resolution to uS. ' The final raw result is converted to cm.or inches ' uS * 10/2/73.746in => * 0.01356 => * 4443/65536 => ** 4443 ' uS * 10/2/29.034cm => * 0.03444 => * 11286/65536 => ** 11286 'SYMBOL uS10toinch =4443 ' 10 / 58.068 (with **) 'SYMBOL uS10tocm =11286 ' 10 / 147.492 (with **) SYMBOL uS10tocm4mHz =11286 ' 10 / 147.492 (with **) SYMBOL cmtoinch =25802 ' /2.54 -> *25802 /65536 -> **25802 'PULSIN resolution @16MHz=2.5uS SYMBOL USscalecm =uS10tocm4mHz /4 'pulsin units 2.5uS @16MHz SYMBOL pingtrig =6 '15uS @16Mhz 'SRF05 'If no echo SRF05 ultrasonic sensor times out at 32ms 'HC-SR04 'If no echo HC-SR04 ultrasonic sensor never times out. 'The HC-SR04 starts the return pulse too quickly for a PicAxe20m2 @4Mhz 'to detect the start of the pulse. It needs to run at least @8MHz. 'Also if the sensor never gets a return echo from an obstacle the 'return pulse never ends and the PULSIN timer has to overflow before 'it returns a value. At 8MHz the timer resolution is 5us. The timer 'is 16 bits which means each reading takes '65,536 * 5us =327680 'which is about 1/3 of a second. This is a long time to wait between 'steps and makes walking very slow. 'Increasing the clock speed to 16MHz means the timer resolution is '2.5us and it times out in 65536 *2.5us = 163990us or about 0.16 'of a second which is much better. 'So SETFREQ m16 should be used (max for 40x2) '================================================================= BambinoCommands: 'using TVR010_PicAxe_IR_controller '================================================================= ' '[KEY_POWER] stops a learned Act and enters Command mode. ' ends modify mode, ends learning ' it can't stop a subroutine Act ' 'Direction Keys '-------------- '[KEY_UP] ie [Fd] Step Forward '[KEY_DOWN] ie [Bk] Step Backward '[KEY_RIGHT] ie [Rt] Step Right '[KEY_LEFT] ie [Lt] Step Left ' 'Function Keys '------------- '[KEY_BAR] ie [f|] enters learn mode to record key presses ' has to be followed by a number key 1-8 ' = the Act to be remembered ' up to 8 Acts can be learned ' learned Acts can call subroutine Acts 'Acts can chain to other Acts, eg Fd,Bk,2 - chain to Act2 'A learned Act which chains itself repeats forever, 'eg [f|][1][Fd][1][POWER] Act1 will do Fd forever '[KEY_TENT] ie [f^] selects subroutine Acts = SAct, ' has to be followed by a number key 1-8 ' plays SActs, SActs play until the end. ' [KEY_1] is RockAdo '[KEY_VCROSS] ie [f+] modify USawareAt, UStoonear ' [+] set USAwareAt in EEPROM DUSawareAt ' [-] set UStoonear in EEPROM DUStoonear ' [Key_POWER] to quit '[KEY_XCROSS] ie [fX] Dump EEPROM Acts DATA to PC, including Config Data ' 'Act Keys '-------- '[1] to [8] Play an Act '[f^][1] to [f^][8] Play a subroutine Act 'When Recording an Act, ' [1]-[8] record a jump to a new Act ' if [1],[2],[3],[4],[5],[6],[7].[8],[0] are used to jump to ' another Act there is no point in recording more moves because they ' will never be replayed since control is transfered to the new Act, ' just press [KEY_POWER] to end the recording; ' [f^] then [1]-[8] to do and include a Subroutine Act (SAct); ' when the memory slot is full Bambino will beep and recording will end. 'Act8 Autoruns on PowerOn ' On poweron to WANDER do [f|][8][0][Power] ' enter command mode do [f|][8][Power] ' WANDER B_slow do [f|][8][9][1][0][Power] ' run Act1 do [f|][8][1][Power] ' do SAct1 then Act1 do [f|][8][f^][1][1][Power] ' etc 'Act0 is WANDER and cannot be changed ' 'Behaviour Key '------------- '[9] Behaviour mode eg [9][1] set speed slow ' [1] set speed slow ' [2] set speed medium ' [3] set speed fast ' [4] set US behaviour to timid ' [5] set US behaviour to normal ' [6] set US behaviour to bold ' [7] disable Whiskers test ' [8] disable Ultrasonic test ' [9] set US behaviour to User values set by handset ' [KEY_UP] B_faster: - increase speed ' [KEY_0] B_normal: - normal speed ' [KEY_DOWN] B_slower: - decrease speed ' 'Sensor Keys '----------- '[-] enable and test Whisker sensors and re-act, R_Whiskers: '[+] enable and test Ping sensor and re-act, R_Ping: ' 'Activity Key '------------ '[0] WANDER ' ' 'Quirks '------ ' If you are recording Act1 and press [f|][2] then you will start 'to record Act2 and Act1 will be left without placing an end marker. 'If Act1 is then played the new moves will be played then whatever 'moves remained there from before. 'If you enter record mode but press [POWER] before pressing a valid 'Act key [1] - [8] then until you press [POWER] a second time and 'Bambino's eyes glow dim any commands will be recorded in Act #6. 'There is no room left to correct this! '[KEY_POWER]=21 @32bytes per slot =>$2A0 =>$A0 =160 =32 *5 =slot #6 '================================================================= TVR010_PicAxe_IR_controller: '--------------------------- 'Before use, the transmitter must be programmed with the ?Sony? transmit code. '1. Insert 2 AAA size batteries, preferably alkaline. '2. Press ?S? and ?B? at the same time. S is in the centre of the arrows. ' The top left red LED should light. '3. Press ?0?. The LED should flash. '4. Press ?1?. The LED should flash. '5. Press ?3?. The LED should go out. '6. Press the red power button (top right). '------------------------------------------- 'IRin cmnds PicAxe controller 'DO NOT PRESS OTHER KEYS 'ie [A] [B] [C] [D] [E] [F] [G] 'They change the Mode and [B] has to be pressed to change back. '[square] [triangle] [()] [L] [X] [backwards F] have no effect SYMBOL KEY_POWER = 21 'Sleep SYMBOL KEY_UP = 16 '[Fd] Step Forward [9][Fd]=set vitality Behaviour to faster SYMBOL KEY_DOWN = 17 '[Bk] Step Backward [9][Bk]=set vitality Behaviour to slower SYMBOL KEY_RIGHT = 18 '[Rt] Step Right SYMBOL KEY_LEFT = 19 '[Lt] Step Left SYMBOL KEY_BAR = 96 '[f|] learn an Act, next [key] selects an Act SYMBOL KEY_TENT = 54 '[f^] next [key] selects a Subroutine-Act SYMBOL KEY_VERT_CROSS = 37 'use synonym for easier coding SYMBOL KEY_VCROSS = 37 '[f+] Modify Mode {when routine included} ' [+] set USAwareAt in DUSawareAt ' [-] set UStoonear in DUStoonear ' {[Fd] alter PaceCentre in DpaceC} ' {[Bk] alter PaceCentre in DpaceC} ' {[Rt] alter RollCentre in DrollC} ' {[Lt] alter RollCentre in DrollC} ' { [-][+] to adjust } ' [Key_POWER] to quit SYMBOL KEY_DIAG_CROSS = 20 'use synonym for easier coding SYMBOL KEY_XCROSS = 20 '[fX] transfer EEPROM to PC for including in programs ' -- Subroutine-Act and Commands -- SYMBOL KEY_1 = 0 '[1] [f^][1]=>RockADo [9][1]=set speed slow SYMBOL KEY_2 = 1 '[2] [9][2]=set speed medium SYMBOL KEY_3 = 2 '[3] [9][3]=set speed fast SYMBOL KEY_4 = 3 '[4] [9][4]=set US behaviour to timid SYMBOL KEY_5 = 4 '[5]' [9][5]=set US behaviour to normal SYMBOL KEY_6 = 5 '[6]' [9][6]=set US behaviour to bold SYMBOL KEY_7 = 6 '[7]' [9][7]=disable Whiskers test SYMBOL KEY_8 = 7 '[8]' [9][8]=disable Ultrasonic test SYMBOL KEY_9 = 8 '[9] set Behaviour modes [9][9]=set US behaviour to User SYMBOL KEY_MINUS = 98 '[-] enable & test Whisker sensors and re-act, R_Whiskers: SYMBOL KEY_0 = 9 '[0] WANDER [9][0]=set vitality Behaviour to normal SYMBOL KEY_PLUS = 11 '[+] enable & test Ping sensor and re-act, R_Ping: '================================================================= ' INITIALISATION '========================== Init: hserptr =W2temp 'get back pointer IF cmnd<>"h" THEN :SERTXD("{3",RootCmnd,cmnd,",") ENDIF '================================================================= ' COMMANDER '================================================================= IF cmnd ="h" THEN GOSUB PrintHelp2 IF cmnd ="@" THEN GOSUB SETUP 'from "b@" Run0: W2pulse =hserptr 'Preserve pointer RUN 0 '================================================================= SETUP: 'Can't do this by IRremote so don't test IR '========================== 'SYMBOL RK =0 'SYMBOL RH =1 'SYMBOL LK =2 'SYMBOL LH =3 standOnLR =%00 'indeterminate - don't correct falling servonum =RR GOSUB _ShowPos DO GOSUB GetCmnd 'and update servos while waiting SELECT cmnd CASE "0" TO "3" servonum =cmnd -"0" GOSUB _ShowPos CASE "/" SELECT servonum CASE RR servonum =LR CASE LR servonum =LP CASE LP servonum =RP CASE RP servonum =RR ENDSELECT GOSUB _ShowPos GOSUB Move CASE "-" f8_doServos =$F0 SELECT servonum CASE RR RRto =RRto -1 MIN RRmin CASE RP RPto =RPto -1 MIN RPmin CASE LR LRto =LRto -1 MIN LRmin CASE LP LPto =LPto -1 MIN LPmin ENDSELECT GOSUB Move CASE "+" f8_doServos =$F0 SELECT servonum CASE RR RRto =RRto +1 MAX RRmax CASE RP RPto =RPto +1 MAX RPmax CASE LR LRto =LRto +1 MAX LRmax CASE LP LPto =LPto +1 MAX Lpmax ENDSELECT GOSUB Move CASE "*" GOSUB _ShowPos CASE "C" SELECT servonum CASE RR WRITE EEPROM_RRC,RRat :RRC =RRat CASE RP WRITE EEPROM_RPC,RPat :RPC =RPat CASE LR WRITE EEPROM_LRC,LRat :LRC =LRat CASE LP WRITE EEPROM_LPC,LPat :LPC =LPat ENDSELECT ENDSELECT LOOP UNTIL cmnd ="Q" OR cmnd=Esc OR cmnd="." RETURN _ShowPos: SERTXD(CR) SELECT servonum CASE LR SERTXD(" *",CR) CASE LP SERTXD(" *",CR) CASE RP SERTXD(" *",CR) CASE RR SERTXD(" *",CR) ENDSELECT' Snum SERTXD("LR",#LRat," LP",#LPat," RP",#RPat," RR",#RRat," logical",CR) SERTXD(" [",#LRat,"] [",#LPat) temp0 =256 -RPat SERTXD("] [",#temp0,"] [" ) temp0 =256 -RRat SERTXD(#temp0,"] servo",CR) RETURN '================================================================= GetCmnd: '========================== Qserial: IF hserinflag=1 THEN ReadSerCmnd 'RefreshServos: GOSUB TellServos GOTO GetCmnd ReadSerCmnd: '@@@IF f_allSerial=1 THEN cmnd =@ptrinc 'f_readAllSerial (re)set by load(0/all) "l0/a" IF ptr =hserptr THEN hserinflag =0 ENDIF '@@@ELSE '@@@ ptr =hserptr -1 'one command at a time '@@@ cmnd =@ptr '@@@ hserinflag =0 '@@@ENDIF #ifdef keybip SOUND voice,(80,7) #endif RETURN '================================================================= MOVE: '========================== 'SERTXD("move" ) f_RRdo =1 'doing all sevos f_RPdo =1 'doing all sevos f_LRdo =1 'doing all sevos f_LPdo =1 'doing all sevos LPto =LPto MIN LPmin MAX LPmax LRto =LRto MIN LRmin MAX LRmax RPto =RPto MIN RPmin MAX RPmax RRto =RRto MIN RRmin MAX RRmax 'bounce =0 'IF f_IAct=0 THEN : f_MoveAborted =0 : ENDIF '---------------------------------------------------- MoveCalcs: 'sertxd("movecalcs") 'sertxd(#f_LAdo, #f_LPdo, #f_RPdo, #f_RRdo,cr) 'sertxd("AtTo",#LPat," ",#LPto," ",#RPat," ",#RPto," ",#Sspeed) '------------- _RR: 'Right Hip Roll SELECT RRat CASE =RRto f_RRdo =0 CASE >RRto RRat =RRat MIN Sspeed -Sspeed MIN RRto CASE RPto RPat =RPat MIN Sspeed -Sspeed MIN RPto CASE LRto LRat =LRat MIN Sspeed -Sspeed MIN LRto CASE LPto LPat =LPat MIN Sspeed -Sspeed MIN LPto CASE 5 THEN AbortMove 'on faster speeds bounce never gets to 5 ' ENDIF 'f_bg_Qtoes W2pulselo = f_LRdo +f_LPdo +f_RPdo +f_RRdo 'f_XXdo =1 set by MOVE: IF W2pulselo<>0 THEN MoveCalcs ' hframes =hframes MIN 1 -1 ' IF hframes<>0 THEN MoveCalcs ' IF f_MoveAborted=1 THEN Run0 RETURN 'AbortMove: ' toe 0=off ground -> falling? so abortMove and do SLR ' sertxd("abort") ' Sspeed =9 :f_Bmodified =1 : f_MoveAborted =1 : f_LKpulse =0: f_RKpulse =0 ' GOTO PH_SLR '================================================================= PrintHelp2: SERTXD(CR,"w0 wait any key or IR") SERTXD(CR," {1-8 wait 1/2 secs") SERTXD(CR,"v{1,b bip") SERTXD(CR," {2,e whee") SERTXD(CR," {3,o whoa") SERTXD(CR," {4,v beep100") SERTXD(CR," {5,s sshhh") SERTXD(CR," [t tsh") SERTXD(CR,"eyes - action for 0.7sec") SERTXD(CR,"eE eyes Doing") SERTXD(CR," e eyes dim") SERTXD(CR," {L,R Doing") SERTXD(CR," {l,r off") SERTXD(CR," {0-3 bit state LR bright/off") SERTXD(CR,"a Actions") SERTXD(CR," {1,b bip {2,e whee, {3,o whoa {4,v beep") SERTXD(CR," {5,S StampRL [6,W WaveL {7,K KickOut") SERTXD(CR," {8,s sit {9,u standUp {0,A be Alive {+,E experiment") SERTXD(CR," L stepL R stepR") SERTXD(CR," < kickL > kickR") SERTXD(CR,"ps sit no pulse") SERTXD(CR," e up easy") SERTXD(CR," u up lift") SERTXD(CR," f lean Forwards") SERTXD(CR," m mid") SERTXD(CR," b lean Backwards") SERTXD(CR," F lean Forwards full") SERTXD(CR," B lean Backwards full") SERTXD(CR,"ta Turn Away from leading foot") SERTXD(CR," t Turn To leading foot") SERTXD(CR," m Turn memory, turn same way as last time") SERTXD(CR," o Turn Otherway to last time") SERTXD(CR," r skid Turn R") SERTXD(CR," l skid Turn L") SERTXD(CR,"c{f,b,r,l Crawl F,B,R,L") SERTXD(CR,"u{f,b Up from front,back") SERTXD(CR," {u,a auto standUp") ' SERTXD(CR,"k,\\ ") SERTXD(CR,"y[1-9] increments yawn each execution,") SERTXD(CR," if yawn=paramter then skip next cmnd") SERTXD(CR,"+ react ON, test WF sensors") SERTXD(CR,"- react ON, test G sensors") SERTXD(CR,"test sensors and react") SERTXD(CR,"$+ WF") SERTXD(CR," U Ultrasonic") SERTXD(CR," W Whiskers") SERTXD(CR," F Feelers") SERTXD(CR," {G,- Ground sensors") SERTXD(CR," T Tip sensor") SERTXD(CR,CR,"bS Save current behaves") SERTXD(CR," 0 load behaves") SERTXD(CR," I Initialise EEPROM") SERTXD(CR," v{l,n,h,x vitality low normal high extreme") SERTXD(CR," l<0-9 lift") SERTXD(CR," p<0-9 pace") SERTXD(CR," t<0-9 turn") SERTXD(CR," o<0-9 toes Offset Out") SERTXD(CR," i<1-9 stance foot In") 'SERTXD(CR," b,0-9 back offset") SERTXD(CR," k<0-9 kick") SERTXD(CR," T beTall") SERTXD(CR," C Crawling") SERTXD(CR," u{0,1 autoUpOff,On") SERTXD(CR," $a autosense ON, [9][+]=OFF") SERTXD(CR," $1 sensors reactions ON [9][-]=OFF") SERTXD(CR," $0 sensors autosense and reactions OFF [9][+][9][-]") SERTXD(CR," U{0,1 U/S reacts OFF,ON") SERTXD(CR," U+{1-9 Ultrasonic AwareAt units 50mm/2in") SERTXD(CR," U-{1-9 Ultrasonic TooNear units 50mm/2in") SERTXD(CR," WS{0-9 Whisker (Scale) threshold decade") SERTXD(CR," {0-9 Whisker threshold digit") SERTXD(CR," FS<0-9 Feeler (Scale) threshold decade") SERTXD(CR," <0-9 Feeler threshold digit") SERTXD(CR," @ Adjust joints - / next, * print, - + adjust, C centre, Q") SERTXD(CR,CR,"?{h,?,{1-8,p,b,d,#") SERTXD(CR," print- Help,Acts,Act,Pose,BeHaves, dump- Acts,#Acts") SERTXD(CR,"?{T.U.W.F.G - print- Tip,Sonar,Whiskers,Feelers,Ground") SERTXD(CR,"?{!.M print- Reacts,Mind",CR) RETURN '=================================================================