by DirtyRoboto » Sat Dec 30, 2006 4:38 pm
by DirtyRoboto
Sat Dec 30, 2006 4:38 pm
Here is some code that I am playing with (so it is still quite basic) that will test to see if the RN1 has fallen then to trigger the appropriate response of getting up.
This is done without additional sensors, just the basic RN1.
Instructions...
After uploading then press button '1' on your remote. this will start the checks. Next, place your robot face down and see if he triggers the standup pose.
Remember to do this with plenty of space.
Please note: This code is only for falling forward and was taken from a larger instruction set of which other fall checks are being tested.
This is just an example to get your creative juices flowing.
Here is the link to my upload.
http://robosavvy.com/Builders/DirtyRobo ... 0Check.bas
And here is the code for visual inspection or copy and paste.
Enjoy.
Marcus.
' === DirtyRoboto December 30 2006 ===============
' ===
DirtyRoboto@btinternet.com ===============
'== Servo check for forward standup ============
'== Remote key number 1 triggers this routine ====
DIM A AS BYTE
DIM A16 AS BYTE
DIM srv6 AS BYTE
DIM srv12 AS BYTE
DIM count AS INTEGER
count = 1
PTP SETON
PTP ALLON
'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,1,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0
'== motor start position read ===================
GETMOTORSET G6A,1,1,1,1,1,0
GETMOTORSET G6B,1,1,1,0,0,0
GETMOTORSET G6C,1,1,1,0,0,0
GETMOTORSET G6D,1,1,1,1,1,0
SPEED 5
'== motor power on =============================
MOTOR G24
GOSUB standard_pose
'================================================
MAIN:
A = REMOCON(1)
IF A <> 1 THEN GOTO main
GOSUB standard_pose
GOTO MAIN
'================================================
standard_pose:
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT
counter:
count = count + 1
IF count = 300 THEN GOTO fall_fwd_chk
GOTO counter
'================================================
forward_standup:
SPEED 10
MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT
MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT
'standard_pose
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
count = 1
GOTO main
'================================================
fall_fwd_chk:
count = 1
'standard_pose
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT
MOVE G6B,120, , , , ,
MOVE G6C,120, , , , ,
DELAY 300
WAIT
srv6 = MOTORIN(6)
srv12 = MOTORIN(12)
DELAY 300
WAIT
IF srv6 < 120 AND srv12 < 120 THEN GOTO forward_standup
GOTO standard_pose
'=================================================
Here is some code that I am playing with (so it is still quite basic) that will test to see if the RN1 has fallen then to trigger the appropriate response of getting up.
This is done without additional sensors, just the basic RN1.
Instructions...
After uploading then press button '1' on your remote. this will start the checks. Next, place your robot face down and see if he triggers the standup pose.
Remember to do this with plenty of space.
Please note: This code is only for falling forward and was taken from a larger instruction set of which other fall checks are being tested.
This is just an example to get your creative juices flowing.
Here is the link to my upload.
http://robosavvy.com/Builders/DirtyRobo ... 0Check.bas
And here is the code for visual inspection or copy and paste.
Enjoy.
Marcus.
' === DirtyRoboto December 30 2006 ===============
' ===
DirtyRoboto@btinternet.com ===============
'== Servo check for forward standup ============
'== Remote key number 1 triggers this routine ====
DIM A AS BYTE
DIM A16 AS BYTE
DIM srv6 AS BYTE
DIM srv12 AS BYTE
DIM count AS INTEGER
count = 1
PTP SETON
PTP ALLON
'== motor diretion setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,1,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0
'== motor start position read ===================
GETMOTORSET G6A,1,1,1,1,1,0
GETMOTORSET G6B,1,1,1,0,0,0
GETMOTORSET G6C,1,1,1,0,0,0
GETMOTORSET G6D,1,1,1,1,1,0
SPEED 5
'== motor power on =============================
MOTOR G24
GOSUB standard_pose
'================================================
MAIN:
A = REMOCON(1)
IF A <> 1 THEN GOTO main
GOSUB standard_pose
GOTO MAIN
'================================================
standard_pose:
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT
counter:
count = count + 1
IF count = 300 THEN GOTO fall_fwd_chk
GOTO counter
'================================================
forward_standup:
SPEED 10
MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT
MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT
'standard_pose
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
count = 1
GOTO main
'================================================
fall_fwd_chk:
count = 1
'standard_pose
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT
MOVE G6B,120, , , , ,
MOVE G6C,120, , , , ,
DELAY 300
WAIT
srv6 = MOTORIN(6)
srv12 = MOTORIN(12)
DELAY 300
WAIT
IF srv6 < 120 AND srv12 < 120 THEN GOTO forward_standup
GOTO standard_pose
'=================================================