'Baldur_8-3.bas #picaxe 40x2 #slot 3 '#no_table #no_data #define keybip 'for ReadSerCmnd DISCONNECT SETFREQ m16 '#3 Memory used = 4045 bytes out of 4096 ?help, @Setup #rem '================================================== IF cmnd ="h" THEN GOSUB PrintHelp IF cmnd ="@" THEN GOSUB SETUP 'from "b@" '================================================== #endrem '================================================== Pins: '========================== SYMBOL servoLK =A.1 SYMBOL servoLH =A.0 SYMBOL servoRK =D.3 SYMBOL servoRH =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_autosense =bit9 'w!r- 1= auto test sensors, "b$a" 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_MoveAborted =bit15 '-!-- '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_RKdo =bit24 '-!-! do servo SYMBOL f_RHdo =bit25 '-!-! do servo SYMBOL f_LKdo =bit26 '-!-! do servo SYMBOL f_LHdo =bit27 '-!-! do servo SYMBOL f_RKpulse =bit28 'r!-r pulse servos SYMBOL f_RHpulse =bit29 'r!-r pulse servos SYMBOL f_LKpulse =bit30 'r!-r pulse servos SYMBOL f_LHpulse =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 RHC =b8 'Right Hip Centre for current posture SYMBOL LHC =b9 'Left Hip Centre for current posture 'W5 SYMBOL RKC =b10 'Right Knee Centre for current posture SYMBOL LKC =b11 'Left Knee Centre for current posture 'W6 SYMBOL RHat =b12 'Servo Right Hip At SYMBOL RHto =b13 'Servo Right Hip To 'W7 SYMBOL LHat =b14 'Servo Left Hip At SYMBOL LHto =b15 'Servo Left Hip To 'W8 SYMBOL RKat =b16 'Servo Right Knee At SYMBOL RKto =b17 'Servo Right Knee To 'W9 SYMBOL LKat =b18 'Servo Left Knee At SYMBOL LKto =b19 'Servo Left Knee 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 FUScmnd =b36 'Foot Up In = 9 -FUI *FL /9 SYMBOL TOD =b37 'Toes Offset Down 'W19 SYMBOL yawn =b38 SYMBOL standOnLR =b39 '%LR 1=down moving test toes if if <>%11 'W20 ''SYMBOL topple =b40 'Thor,Freya SYMBOL usdist =b41 'prog2 'W21 SYMBOL Bo =b42 'lean back offset for backwards SYMBOL ReactAt =b43 'React Table pointer 'SYMBOL TOF =b43 'Toes Offset Front 'Freya, Thor 'W22 SYMBOL W22random =w22 'b44,b45 SYMBOL W22random0 =b44 'W23 SYMBOL DoAt =b46 'Pointer in Do SYMBOL InDo =b47 'flag for In a Do 'W24 SYMBOL mindAt =b48 ' SYMBOL mindSub =b49 ' 'W25 'SYMBOL RHcmnd =b50 'controls Hip Centres for RideHeight 0-9 in 1-NewBehave: 'Thor 'SYMBOL RHcmndold =b51 'last Ride height cmnd 'Thor 'W26 '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_LHC =255 'logical value SYMBOL EEPROM_LKC =254 'logical value SYMBOL EEPROM_RHC =253 'logical value SYMBOL EEPROM_RKC =252 'logical value SYMBOL EEPROM_TOD =251 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_FUScmnd =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 @ - values are in 10us units 'Knee Corona CS538BP 5Kg.cm 0.14sec, +ve clockwise 'Hip Corona DS538MG 7Kg.cm 0.14sec, -ve clockwise ' Left Hip servo doesn't relax on no pulse but holds last good pulse position ' Left Hip servo relaxes if pulse <50 or >250 so pulse 25 to relax '================================================================= SYMBOL SLHmin =245 'Hip Min in - leg hits body? ServoStop? SYMBOL SLHmid =217 'Hip Stand feet flat SYMBOL SLHout =140 'Hip horizontal SYMBOL SLHlie =120 'Hip lie SYMBOL SLHmax =80 'Hip Max out - knee hits battery box SYMBOL SLKmax =185 'Knee Max Fd - leg hits foot 37 SYMBOL SLKMid =148 'Knee Mid vert 0 SYMBOL SLKmin =104 'Knee Min Bk - leg hits foot 44 SYMBOL SRHmax =224 'Hip Max out - knee hits battery box SYMBOL SRHlie =193 'Hip lie SYMBOL SRHout =180 'Hip horizontal SYMBOL SRHmid =91 'Hip Stand feet flat SYMBOL SRHmin =57 'Hip Min in - leg hits body SYMBOL SRKmin =187 'Knee Min Bk - leg hits foot 38 SYMBOL SRKmid =149 'Knee Mid vert 0 SYMBOL SRKmax =110 'Knee Max Fd - leg hits foot 39 'Left leg out is -ve 'Left foot forward is +ve 'Right leg out is +ve 'Right foot forward is -ve '================================================== 'LOGICAL 'leg out is +ve 'foot forward is +ve SYMBOL LHmax =256 -SLHmax SYMBOL LHlie =256 -SLHlie SYMBOL LHout =256 -SLHout SYMBOL LHmid =256 -SLHmid SYMBOL LHmin =256 -SLHmin SYMBOL LKmax =SLKmax SYMBOL LKmid =SLKmid SYMBOL LKmin =SLKmin SYMBOL RHmax =SRHmax SYMBOL RHlie =SRHlie SYMBOL RHout =SRHout SYMBOL RHmid =SRHmid SYMBOL RHmin =SRHmin SYMBOL RKmax =256 -SRKmax SYMBOL RKmid =256 -SRKmid SYMBOL RKmin =256 -SRKmin 'for servo numbering in CaseAdjust: SYMBOL RK =0 SYMBOL RH =1 SYMBOL LK =2 SYMBOL LH =3 '-------------------------------------------------------------- SYMBOL DSframe =15 'default SFrame, LOOPs at ~40Hz/25ms SYMBOL Fclear =20 'minimum for toes to miss when walking SYMBOL f_RfF =1 '1=>Right Foot Forward SYMBOL TSO =5 '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 SERTXD("{3",RootCmnd,cmnd,",") '================================================================= ' 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 =RK GOSUB _ShowPos DO GOSUB GetCmnd ;0123/-+*CQ.[Esc] 'and update servos while waiting SELECT cmnd CASE "0" TO "3" servonum =cmnd -"0" GOSUB _ShowPos CASE "/" SELECT servonum CASE RK servonum =LK CASE LK servonum =LH CASE LH servonum =RH CASE RH servonum =RK ENDSELECT GOSUB _ShowPos GOSUB Move CASE "-" f8_doServos =$F0 SELECT servonum CASE RK RKto =RKto -1 MIN RKmin CASE RH RHto =RHto -1 MIN RHmin CASE LK LKto =LKto -1 MIN LKmin CASE LH LHto =LHto -1 MIN LHmin ENDSELECT GOSUB Move CASE "+" f8_doServos =$F0 SELECT servonum CASE RK RKto =RKto +1 MAX RKmax CASE RH RHto =RHto +1 MAX RHmax CASE LK LKto =LKto +1 MAX LKmax CASE LH LHto =LHto +1 MAX LHmax ENDSELECT GOSUB Move CASE "*" GOSUB _ShowPos CASE "C" SELECT servonum CASE RK WRITE EEPROM_RKC,RKat :RKC =RKat CASE RH WRITE EEPROM_RHC,RHat :RHC =RHat CASE LK WRITE EEPROM_LKC,LKat :LKC =LKat CASE LH WRITE EEPROM_LHC,LHat :LHC =LHat ENDSELECT ENDSELECT LOOP UNTIL cmnd ="Q" OR cmnd=Esc OR cmnd="." RETURN _ShowPos: SERTXD(CR) SELECT servonum CASE LK SERTXD(" *",CR) CASE LH SERTXD(" *",CR) CASE RH SERTXD(" *",CR) CASE RK SERTXD(" *",CR) ENDSELECT' Snum SERTXD("LK",#LKat," LH",#LHat," RH",#RHat," RK",#RKat," logical",CR) SERTXD(" [",#LKat,"] [",#LHat) temp0 =256 -RHat SERTXD("] [",#temp0,"] [" ) temp0 =256 -RKat 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_RKdo =1 'doing all sevos f_RHdo =1 'doing all sevos f_LKdo =1 'doing all sevos f_LHdo =1 'doing all sevos LHto =LHto MIN LHmin MAX LHmax LKto =LKto MIN LKmin MAX LKmax RHto =RHto MIN RHmin MAX RHmax RKto =RKto MIN RKmin MAX RKmax 'bounce =0 'IF f_IAct=0 THEN : f_MoveAborted =0 : ENDIF '---------------------------------------------------- MoveCalcs: 'sertxd("movecalcs") 'sertxd(#f_LAdo, #f_LHdo, #f_RHdo, #f_RAdo,cr) 'sertxd("AtTo",#LHat," ",#LHto," ",#RHat," ",#RHto," ",#Sspeed) '------------- _RK: 'Right Knee SELECT RKat CASE =RKto f_RKdo =0 CASE >RKto RKat =RKat MIN Sspeed -Sspeed MIN RKto CASE RHto RHat =RHat MIN Sspeed -Sspeed MIN RHto CASE LKto LKat =LKat MIN Sspeed -Sspeed MIN LKto CASE LHto LHat =LHat MIN Sspeed -Sspeed MIN LHto CASE 5 THEN AbortMove 'on faster speeds bounce never gets to 5 ' ENDIF 'f_bg_Qtoes W2pulselo = f_LKdo +f_LHdo +f_RHdo +f_RKdo '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,"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 Doing") SERTXD(CR," e 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 Kick") SERTXD(CR," {8,l,s lie/sit {9,u standUp") SERTXD(CR," {0,A be Alive {+,E experiment") SERTXD(CR,"pm pose Mid") SERTXD(CR," F lean Forwards full") SERTXD(CR," B lean Backwards full") SERTXD(CR," f lean Forwards") SERTXD(CR," b lean Backwards") SERTXD(CR,"t{r,l turn R L on spot") 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,"c{f,b,r,l Crawl F,B,R,L") SERTXD(CR,"u{f,b Up from front,back") SERTXD(CR," {h,B getup back from head") SERTXD(CR," F getup front from head") SERTXD(CR," (u,a auto standUp") ' SERTXD(CR,"k,\\ ") SERTXD(CR,"y<1-9> increments yawn each execution,") SERTXD(CR," if yawn=parameter 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," L Lethargic") SERTXD(CR," N Normal") SERTXD(CR," V Vigorous") 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," d{0-9 toeDown offset") SERTXD(CR," s{0-9 foot up side scales FUD") SERTXD(CR," b{0-9 back offset") SERTXD(CR," k{0-9 kick") 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 '=================================================================