Ambler Commands
Sam commands
'---------------- 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!
Efi commands
'---------------- 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 - not used
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 <param> <Do>; if USRange<USActionRange jump to Act in next byte
IfusLm CON 48 'US if Less mem <Do>; if USRange<USlast jump to Act in next byte
tty CON 49 'debug text starting in next byte and ending with ¬
'Hurt rule cmnds
IfHLR CON 50 'test ToesRL eg IfHLR,hurtingalot,Af2
IfHR CON 51 'test Toe R
IfHL CON 52 'test Toe L
'---------------- Acts -- if ended with 'z' are Activities -----------------
' if not ended with 'z' continue with next Act
'end lists with Z otherwise starts doing next Act!
'Acts can have any legal variable name.
defaultAct DATA A1 'default Act name done after 'Z', overwritten at init:
Ainit DATA Vt,Vb,V,m,$58,ttyOn,H,Z 'initialisation Act done after PowerOn or Reset if no PicAxe
'ABack DATA B,Z
A15 DATA V,Z 'just so we know the switch is on -1 not 0 !!!
'A14 shows asymetric nature of servos, set speed to 1 and walking very even
' set spped above and Rroll is faster than Lroll and completes roll whereas Left doesn't
A14 DATA 'F,w,10,F,w,10,F,V,w,10,B,w,10,B,w,10,B,w,10,Z
A13 DATA 'H,w,2,F,F,H,w,1,B,B,Z
A12 DATA 'F,F,R,R,H,w,2,L,L,B,B,B,H,Z 'roughly F & B about same spot
A11 DATA 'F,F,R,L,L,Z
'A10 DATA s,$66,F,Su,a,A3,Z
A10 DATA 'F,F,F,F,F,F,F,B,B,B,B,B,B,B,Z
A9 DATA 'L,L,R,R,a,A4,Z
'A8 DATA R,R,R,R,R,L,L,L,L,L,Z
A8 DATA
A7 DATA Wdark,a,A5 'US dark walk, jump to A5
A6 DATA Wlight 'US light walk, drop to A5
A5 DATA Vb,tty,"A4¬",usOn,a,A2 'US walk, jump to A2
A4 DATA Wdark,a,A2 'dark walk, jump to A2
A3 DATA Wlight 'light walk, drop to A2
A2 DATA tbOn 'SensorT Walk, toe bump on
A1 DATA m,$58 'set Roll and Step
Walk DATA Ew,F,Su,IfusOn,USwalk,a,Walk ''a' preserves behaviours
USwalk DATA IfusL,4,USavoid,a,Walk
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!
'----------------------------------------------
Joe 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 <param> <Do>; if USRange<USActionRange jump to Act in next byte
IfusLm CON 48 'US if Less mem <Do>; if USRange<USlast jump to Act in next byte
tty CON 49 'debug text starting in next byte and ending with ¬
'Hurt rule cmnds
IfHLR CON 50 'test ToesRL eg IfHLR,hurtingalot,Af2
IfHR CON 51 'test Toe R
IfHL CON 52 'test Toe L
'---------------- Acts -- if ended with 'z' are Activities -----------------
' if not ended with 'z' continue with next Act
'end lists with Z otherwise starts doing next Act!
'Acts can have any legal variable name.
defaultAct DATA A1 'default Act name done after 'Z', overwritten at init:
Ainit DATA Vt,Vb,V,m,$58,ttyOn,H,Z 'initialisation Act done after PowerOn or Reset if no PicAxe
'ABack DATA B,Z
A15 DATA V,Z 'Mom - just so we know the switch is on -1 not 0 !!!
'A14 shows asymetric nature of servos, set speed to 1 and walking very even
' set spped above and Rroll is faster than Lroll and completes roll whereas Left doesn't
A14 DATA 'F,w,10,F,w,10,F,V,w,10,B,w,10,B,w,10,B,w,10,Z
A13 DATA 'H,w,2,F,F,H,w,1,B,B,Z
A12 DATA 'F,F,R,R,H,w,2,L,L,B,B,B,H,Z 'roughly F & B about same spot
A11 DATA 'F,F,R,L,L,Z
'A10 DATA s,$66,F,Su,a,A3,Z
A10 DATA 'F,F,F,F,F,F,F,B,B,B,B,B,B,B,Z
A9 DATA 'L,L,R,R,a,A4,Z
'A8 DATA R,R,R,R,R,L,L,L,L,L,Z
A8 DATA
A7 DATA Wdark,a,A5 'US dark walk, jump to A5
A6 DATA Wlight 'US light walk, drop to A5
A5 DATA tty,"A5¬",Vb,usOn,a,A2 'US walk, jump to A2
A4 DATA Wdark,a,A2 'dark walk, jump to A2
A3 DATA Wlight 'light walk, drop to A2
A2 DATA tty,"A2¬",tbOn 'SensorT Walk, toe bump on
A1 DATA m,$58 'set Roll and Step
Walk DATA Ew,F,Su,IfusOn,USwalk,a,Walk ''a' preserves behaviours
USwalk DATA IfusL,4,USavoid,a,Walk '2" resolution =>8"
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!
'----------------------------------------------
Kas commands
'---------------- user commands ----------
'Action cmnds
Z CON $00 'end of list, null move
F CON $01 'Forward
B CON $02 'Back
R CON $03 'Right turn
L CON $04 'Left turn
H CON $05 'Halt, stand to attention
V CON $06 'Voice, beep 1KHz for 0.1sec
Br CON $07 'Back with right foot, for toe bump
Bl CON $08 'Back with left foot, for toe bump
fT CON $09 'footTurn, turn away from leading Foot
mT CON $0A 'memoryTurn, turn same way as last time, use f_TurnedR
oT CON $0B 'otherTurn, turn other way and toggle f_TurnedR
Vt CON $0C 'Voice Tune
Vb CON $0D 'Voice Beep
'Behavioural cmnds
Su CON $10 'increase speed(+1) MAX potspeed
Sd CON $11 'reduce speed(/2) MIN minpacespeed
StbOn CON $12 'SensorToeBump on
StbOff CON $13 'SensorToeBump off
Wlight CON $14 'walk towards light
Wdark CON $15 'walk towards light
Ewoff CON $16 'Eye Walk off
ttyOn CON $17 'debug text On
ttyOff CON $18 'debug text Off
Ew CON $19 'Eye walk, test and set paceTurn
h0 CON $1A 'reduce hurts to zero, otherwise frustration behaviour gets subsumed after next move
UStimid CON $1B 'us range 4,6
USnormal CON $1C 'us range 2,4
USbold CON $1D 'us range 1,3
'Parameter cmnds - note no US sensor on Tom
w CON $20 'Wait 1/10 secs in next byte
a CON $21 'jump to <page>,<Act> in next two bytes
s CON $22 'set speeds to next byte, $rp '$55 is max for servos to follow pulse
'from Pot(^15) works best with pacerollspeedratio =1
mrp CON $23 'set Roll and Pace for a 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 $24 'set default Act to next byte
usa CON $25 'set USaware to next low.nib resolution 2"=>5cm, max 15=>30"
usn CON $26 'set USnear to next low.nib resolution 2"
T CON $27 'Talk #msg in next byte numbers 0,1,2,3,4,5,6,7,8,9 (10,11,12,13,14,15) and
St CON "t" 'Test - my name_is condor wildeagle sam efi tom joe
Sname CON "n" 'Name - hello I am kasper
''Sact CON "a"
''Sforward CON "f"
''Sback CON "b"
''Sright CON "r"
''Sleft CON "l"
''Sobstacle CON "o"
BASIC_Stamp CON "s" 'Hello I am the BASIC Stamp
SubAct CON $28 'do Sub-act in next byte, must be in the same page
tty CON $29 'debug text starting in next byte and ending with ¬
Xacts CON $2A 'dump acts then behaves to terminal, only from IR
'parameter test cmnds
usIFa CON $2B 'US if =< Aware <do>; if USrange =< usAwareAt then do Act in next byte
usIFn CON $2C 'US if =< Near <do>; if USrange =< usTooNear then do Act in next byte
usIFm CON $2D 'US if < mem <Do>; if USRange < USlast do Act in next byte
usIFL CON $2E 'US if Less <param> <Do>; if USRange<USActionRange jump to Act in next byte, in same page
c CON $2F 'command Act number 0 - 15 in next byte
slot CON $30 '<active Data slot> in next byte
'Hurt rule cmnds
IFhLR CON $40 'Do ToesRL hurt
IFhR CON $41 'Do Toe R hurts
IFhL CON $42 'Do Toe L hurts
'---------------- Acts -- if ended with 'z' are Activities -----------------
'if not ended with 'z' continue with next Act
'Acts can have any legal variable name.
Ainit DATA Vt,Vb,V,m,$A6,ttyOn,H,T,Sname,V,V,Z 'initialisation Act done after PowerOn or Reset
A15 DATA V,Z 'just so we know the switch is on -1 not 0 !!!
'A14 shows asymetric nature of servos, set speed to 1 and walking very even
' set spped above and Rroll is faster than Lroll and completes roll whereas Left doesn't
A14 DATA F,w,10,F,w,10,F,V,w,10,B,w,10,B,w,10,B,w,10,Z
A13 DATA
A12 DATA
A11 DATA
A10 DATA
A9 DATA
A8 DATA tty,CR,"'8'¬",T,8,z
'A8 DATA tty,"test¬",SubAct,8,tty,"done¬",a,A8
'A8 DATA tty,CR,"'8' doing a sub",CR,"¬",z
'A7 DATA tty,CR,"'7'¬",SubAct,A8,tty,"--back from sub",CR,"¬",a,0,A7
A7 DATA tty,CR,"'7'¬",T,7,slot,4,c,1,z ,tty,CR,"back from 4¬",a,0,A7
'A7 DATA tty,CR,"'7'¬",usIFL,10,A8,a,0,A7
A6 DATA Wdark,a,0,A4 'US dark walk, jump to A4
A5 DATA Wlight 'US light walk, drop to A4
A4 DATA Vb,tty,"'A4'¬",T,4,StbOn,mrp,$58 'US walk, setup
USwalk DATA Ew,F,Su,usIFa,USavoid,a,0,USwalk
A3 DATA Wdark,a,0,A1 'dark walk, jump to A1
A2 DATA Wlight 'light walk, drop to A1
A1 DATA StbOn '(70)SensorT Walk, toe bump on
A0 DATA mrp,$58 'set Roll and Pace for a Step
'Walk DATA Ew,F,Su,a,Walk '(73)'a' preserves behaviours
Walk DATA F,Su,a,0,Walk ''a' preserves behaviours
'----------------------------------------------
DATA @256
DATA "B"
'first Act DATA must be @>0 since Z=> pD=0 means nothing to do
'---------------- 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
'---------------- frustration behavioural Acts -------
'inhibit sensors until Toe moved back a bit, otherwise just loops to here
Af1 DATA tty,"Af1R¬",h0,StbOff,V,V,V,B,StbOn,mT,mT,Z 'if (hurtsR+hurtsL)>hurting
Af2 DATA tty,"Af2L¬",h0,StbOff,V,V,V,V,V,B,StbOn,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¬",StbOff,V,Sd,Br,StbOn,L,L,L,L,Z 'if hurtsR>hurtalittle
AbL DATA tty,"AbL¬",StbOff,V,V,Sd,Bl,StbOn,R,R,R,R,Z 'if hurtsL>hurtalittle
'---------------- US behavioural Acts -------------
USTfScan DATA tty,"`USTfScan¬"
DATA V,fT,usIFLm,USoTscan,usIFL,4,USmT,Z 'TurnScan, using Tf means centre doesn't move (much)
USoTscan DATA tty,"`USoTscan¬"
'DATA V,V,oT,bk,mT,mT,usIFL,4,USmT,Z 'OtherTurnScan bk only used for skid turns
DATA V,V,oT,mT,mT,usIFL,4,USmT,Z 'OtherTurnScan
USmT DATA tty,"`USmT¬"
'DATA V,V,V,bk,mT,mT,usIFL,4,USmT,Z bk only used for skid turns
DATA V,V,V,mT,mT,usIFL,4,USmT,Z
'USslow DATA Sd,Z
USback DATA B,fT,mT,mT,mT,mT,mT 'fall through 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¬",usIFn,USback
USinway DATA tty," inway¬",usIFa,USTfScan
DATA Z
'----------------------------------------------
Bend DATA Z 'end marker to avoid doing the program!
'----------------------------------------------
Tom commands - same as Kas but without ultrasonic sensor and commands
'---------------- user commands ----------
'Action cmnds
Z CON $00 'end of list, null move
F CON $01 'Forward
B CON $02 'Back
R CON $03 'Right turn
L CON $04 'Left turn
H CON $05 'Halt, stand to attention
V CON $06 'Voice, beep 1KHz for 0.1sec
Br CON $07 'Back with right foot, for toe bump
Bl CON $08 'Back with left foot, for toe bump
fT CON $09 'footTurn, turn away from leading Foot
mT CON $0A 'memoryTurn, turn same way as last time, use f_TurnedR
oT CON $0B 'otherTurn, turn other way and toggle f_TurnedR
Vt CON $0C 'Voice Tune
Vb CON $0D 'Voice Beep
'Behavioural cmnds
Su CON $10 'increase speed(+1) MAX potspeed
Sd CON $11 'reduce speed(/2) MIN minpacespeed
StbOn CON $12 'SensorToeBump on
StbOff CON $13 'SensorToeBump off
Wlight CON $14 'walk towards light
Wdark CON $15 'walk towards light
Ewoff CON $16 'Eye Walk off
ttyOn CON $17 'debug text On
ttyOff CON $18 'debug text Off
Ew CON $19 'Eye walk, test and set paceTurn
h0 CON $1A 'reduce hurts to zero, otherwise frustration behaviour gets subsumed after next move
UStimid CON $1B 'us range 4,6
USnormal CON $1C 'us range 2,4
USbold CON $1D 'us range 1,3
'Parameter cmnds - note no US sensor on Tom
w CON $20 'Wait 1/10 secs in next byte
a CON $21 'jump to <page>,<Act> in next two bytes
s CON $22 'set speeds to next byte, $rp '$55 is max for servos to follow pulse
'from Pot(^15) works best with pacerollspeedratio =1
mrp CON $23 'set Roll and Pace for a 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 $24 'set default Act to next byte
usa CON $25 'set USaware to next low.nib resolution 2"=>5cm, max 15=>30"
usn CON $26 'set USnear to next low.nib resolution 2"
T CON $27 'Talk #msg in next byte numbers 0,1,2,3,4,5,6,7,8,9 (10,11,12,13,14,15) and
St CON "t" 'Test - my name_is condor wildeagle sam efi tom joe
Sname CON "n" 'Name - hello I am kasper
''Sact CON "a"
''Sforward CON "f"
''Sback CON "b"
''Sright CON "r"
''Sleft CON "l"
''Sobstacle CON "o"
BASIC_Stamp CON "s" 'Hello I am the BASIC Stamp
SubAct CON $28 'do Sub-act in next byte, must be in the same page
tty CON $29 'debug text starting in next byte and ending with ¬
Xacts CON $2A 'dump acts then behaves to terminal, only from IR
'parameter test cmnds
usIFa CON $2B 'US if =< Aware <do>; if USrange =< usAwareAt then do Act in next byte
usIFn CON $2C 'US if =< Near <do>; if USrange =< usTooNear then do Act in next byte
usIFm CON $2D 'US if < mem <Do>; if USRange < USlast do Act in next byte
usIFL CON $2E 'US if Less <param> <Do>; if USRange<USActionRange jump to Act in next byte, in same page
c CON $2F 'command Act number 0 - 15 in next byte
slot CON $30 '<active Data slot> in next byte
'Hurt rule cmnds
IFhLR CON $40 'Do ToesRL hurt
IFhR CON $41 'Do Toe R hurts
IFhL CON $42 'Do Toe L hurts
'---------------- Acts -- if ended with 'Z' are Activities -----------------
'if not ended with 'z' continue with next Act
'Acts can have any legal variable name.
Ainit DATA Vt,Vb,V,mrp,$77,ttyOn,H,T,Sname,w,5,V,V,Z 'initialisation Act done after PowerOn or Reset
A15 DATA V,Z 'just so we know the switch is on -1 not 0 !!!
A14 DATA
A13 DATA
A12 DATA
A11 DATA
A10 DATA
A9 DATA
'A8 DATA tty,CR,"'8'¬",slot,4,c,7,V,V,V,V,V,V
'A8 DATA tty,"test¬",SubAct,8,tty,"done¬",a,A8
A8 DATA tty,CR,"'8' doing a sub",CR,"¬",z
A7 DATA T,7,T,"n",w,20,tty,"going bac¬",slot,3,c,7
'A7 DATA tty,CR,"'7'¬",SubAct,A8,tty,"--back from sub",CR,"¬",a,0,A7
'A7 DATA tty,CR,"'7'¬",usIFL,10,A8,a,0,A7
A6 DATA tty,"A6¬",T,6,z
A5 DATA '"A5",tty,CR,"5¬",T,5,slot,3,c,7
A4 DATA '"A4",tty,CR,"4¬",T,4,slot,3,c,7
A3 DATA '"A3",tty,CR,"3¬",T,3,T,"n",slot,3,c,7
A2 DATA '"A2",tty,CR,"2¬",T,2,T,"n",slot,3,c,7
'A1 DATA tty,CR,"1¬",T,1,T,"n",tty,"talked¬",slot,3,3,c,7
A1 DATA tty,"A1¬",T,1,subact,A6,T,Sname,tty,"talked¬",slot,3,c,7
A0 DATA tty,"A0¬",T,0,T,"n",slot,3,c,7
DATA @256
DATA "B"
'first Act DATA must be @>0 since Z=> pD=0 means nothing to do
'---------------- 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
'---------------- frustration behavioural Acts -------
'inhibit sensors until Toe moved back a bit, otherwise just loops to here
Af1 DATA tty,"Af1R¬",h0,StbOff,V,V,V,B,StbOn,mT,mT,Z 'if (hurtsR+hurtsL)>hurting
Af2 DATA tty,"Af2L¬",h0,StbOff,V,V,V,V,V,B,StbOn,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¬",StbOff,V,Sd,Br,StbOn,L,L,Z 'if hurtsR>hurtalittle
AbL DATA tty,"AbL¬",StbOff,V,V,Sd,Bl,StbOn,R,R,Z 'if hurtsL>hurtalittle
'---------------- US behavioural Acts -------------
'USTfScan DATA tty,"`USTfScan¬"
' DATA V,fT,usIFLm,USoTscan,usIFL,4,USmT,Z 'TurnScan, using Tf means centre doesn't move (much)
'USoTscan DATA tty,"`USoTscan¬"
' 'DATA V,V,oT,bk,mT,mT,usIFL,4,USmT,Z 'OtherTurnScan bk only used for skid turns
' DATA V,V,oT,mT,mT,usIFL,4,USmT,Z 'OtherTurnScan
'USmT DATA tty,"`USmT¬"
' 'DATA V,V,V,bk,mT,mT,usIFL,4,USmT,Z bk only used for skid turns
' DATA V,V,V,mT,mT,usIFL,4,USmT,Z
'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¬",usIFn,USback
USinway DATA tty," inway¬",usIFa,USTfScan
DATA Z
'----------------------------------------------
Bend DATA Z 'end marker to avoid doing the program!
'----------------------------------------------