by Morbeious » Thu Apr 06, 2006 4:06 am
by Morbeious
Thu Apr 06, 2006 4:06 am
Eh, I modified your code below the changes are in red, also removed a few things, when I downloaded the code to my RN-1 it worked well. Try moving both of your sticks on your controller foward, wait a few sec it RN-1 should walk foward. If not check you AD nodes this code works on 3 and 4.
Note: This code isn't complete for all moves or even walking very well, it still needs lots of tweeking to get it just right, which i will be working on over the next few days. Its good for testing TX and RX.
== Robot walk ================================
GOTO AUTO
FILL 255,10000
DIM RCX AS BYTE
DIM RCY AS BYTE
CONST ID = 0 ' 1:0, 2:32, 3:64, 4:96,
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 ===================
TEMPO 230
MUSIC "CDE"
GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0
'== motor power on =============================
SPEED 5
MOTOR G24
GOSUB standard_pose
'================================================
'================================================
MAIN:
RCX = RCIN(3)
RCY = RCIN(4)
'RC Walk
IF RCX >= 125 THEN ' RIGHT TURN
GOSUB right_turn
GOSUB standard_pose
ENDIF
IF RCX <= 75 AND RCX > 10 THEN 'LEFT TURN
GOSUB left_turn
GOSUB standard_pose
ENDIF
IF RCY >= 125 THEN ' BACKWARD
GOSUB backward_walk
GOSUB standard_pose
ENDIF
IF RCY <= 75 AND RCY > 10 THEN ' FORWARD
GOSUB forward_walk
GOSUB standard_pose
ENDIF
RETURN
'================================================
forward_walk:
SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,
fwd_walk_main:
SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,
SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,
SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,
'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,
RCX = RCIN(3)
RCY = RCIN(1)
IF RCX >= 75 AND RCX <= 125 THEN
IF RCY <= 75 THEN
GOTO fwd_walk_main
ENDIF
SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,
RETURN
'================================================
'================================================
left_turn:
SPEED 6
MOVE G6D, 85, 71, 152, 91, 112, 60
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT
SPEED 9
MOVE G6A, 113, 75, 145, 97, 93, 60
MOVE G6D, 90, 50, 157, 115, 112, 60
MOVE G6B, 105, 40, 70, , , ,
MOVE G6C, 90, 40, 70, , , ,
WAIT
MOVE G6A, 108, 78, 145, 98, 93, 60
MOVE G6D, 95, 43, 169, 110, 110, 60
MOVE G6B, 105, 40, 70, , , ,
MOVE G6C, 80, 40, 70, , , ,
WAIT
RETURN
'================================================
'================================================
right_turn:
SPEED 6
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D, 112, 76, 145, 93, 92, 60
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT
SPEED 9
MOVE G6D, 113, 75, 145, 97, 93, 60
MOVE G6A, 90, 50, 157, 115, 112, 60
MOVE G6C, 105, 40, 70, , , ,
MOVE G6B, 90, 40, 70, , , ,
WAIT
MOVE G6D, 108, 78, 145, 98, 93, 60
MOVE G6A, 95, 43, 169, 110, 110, 60
MOVE G6C, 105, 40, 70, , , ,
MOVE G6B, 80, 40, 70, , , ,
WAIT
RETURN
'================================================
'================================================
backward_walk:
SPEED 5
GOSUB backward_walk1
SPEED 13
GOSUB backward_walk2
SPEED 7
GOSUB backward_walk3
GOSUB backward_walk4
GOSUB backward_walk5
SPEED 13
GOSUB backward_walk6
SPEED 7
GOSUB backward_walk7
GOSUB backward_walk8
GOSUB backward_walk9
SPEED 13
GOSUB backward_walk2
SPEED 5
GOSUB backward_walk1
RETURN
'================================================
backward_walk1:
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk2:
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk9:
MOVE G6A, 90, 56, 143, 122, 114, 60
MOVE G6D,113, 80, 145, 90, 90, 60
MOVE G6B, 80, 40, 80, , , ,
MOVE G6C,105, 40, 80, , , ,
WAIT
RETURN
backward_walk8:
MOVE G6A,100, 62, 146, 108, 100, 100
MOVE G6D,100, 88, 140, 86, 100, 100
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk7:
MOVE G6A,113, 76, 142, 105, 90, 60
MOVE G6D,90, 96, 136, 85, 114, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk6:
MOVE G6D,90, 107, 105, 105, 114, 60
MOVE G6A,113, 78, 145, 93, 90, 60
MOVE G6C,90, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
backward_walk5:
MOVE G6D,90, 56, 143, 122, 114, 60
MOVE G6A,113, 80, 145, 90, 90, 60
MOVE G6C,80, 40, 80, , , ,
MOVE G6B,105, 40, 80, , , ,
WAIT
RETURN
backward_walk4:
MOVE G6D,100, 62, 146, 108, 100, 100
MOVE G6A,100, 88, 140, 86, 100, 100
MOVE G6C,90, 40, 80, , ,,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
backward_walk3:
MOVE G6D,113, 76, 142, 105, 90, 60
MOVE G6A, 90, 96, 136, 85, 114, 60
MOVE G6C,100, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
'================================================
'================================================
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
RETURN
'================================================
Eh, I modified your code below the changes are in red, also removed a few things, when I downloaded the code to my RN-1 it worked well. Try moving both of your sticks on your controller foward, wait a few sec it RN-1 should walk foward. If not check you AD nodes this code works on 3 and 4.
Note: This code isn't complete for all moves or even walking very well, it still needs lots of tweeking to get it just right, which i will be working on over the next few days. Its good for testing TX and RX.
== Robot walk ================================
GOTO AUTO
FILL 255,10000
DIM RCX AS BYTE
DIM RCY AS BYTE
CONST ID = 0 ' 1:0, 2:32, 3:64, 4:96,
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 ===================
TEMPO 230
MUSIC "CDE"
GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0
'== motor power on =============================
SPEED 5
MOTOR G24
GOSUB standard_pose
'================================================
'================================================
MAIN:
RCX = RCIN(3)
RCY = RCIN(4)
'RC Walk
IF RCX >= 125 THEN ' RIGHT TURN
GOSUB right_turn
GOSUB standard_pose
ENDIF
IF RCX <= 75 AND RCX > 10 THEN 'LEFT TURN
GOSUB left_turn
GOSUB standard_pose
ENDIF
IF RCY >= 125 THEN ' BACKWARD
GOSUB backward_walk
GOSUB standard_pose
ENDIF
IF RCY <= 75 AND RCY > 10 THEN ' FORWARD
GOSUB forward_walk
GOSUB standard_pose
ENDIF
RETURN
'================================================
forward_walk:
SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,
fwd_walk_main:
SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,
SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,
SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,
'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,
RCX = RCIN(3)
RCY = RCIN(1)
IF RCX >= 75 AND RCX <= 125 THEN
IF RCY <= 75 THEN
GOTO fwd_walk_main
ENDIF
SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,
RETURN
'================================================
'================================================
left_turn:
SPEED 6
MOVE G6D, 85, 71, 152, 91, 112, 60
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT
SPEED 9
MOVE G6A, 113, 75, 145, 97, 93, 60
MOVE G6D, 90, 50, 157, 115, 112, 60
MOVE G6B, 105, 40, 70, , , ,
MOVE G6C, 90, 40, 70, , , ,
WAIT
MOVE G6A, 108, 78, 145, 98, 93, 60
MOVE G6D, 95, 43, 169, 110, 110, 60
MOVE G6B, 105, 40, 70, , , ,
MOVE G6C, 80, 40, 70, , , ,
WAIT
RETURN
'================================================
'================================================
right_turn:
SPEED 6
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D, 112, 76, 145, 93, 92, 60
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT
SPEED 9
MOVE G6D, 113, 75, 145, 97, 93, 60
MOVE G6A, 90, 50, 157, 115, 112, 60
MOVE G6C, 105, 40, 70, , , ,
MOVE G6B, 90, 40, 70, , , ,
WAIT
MOVE G6D, 108, 78, 145, 98, 93, 60
MOVE G6A, 95, 43, 169, 110, 110, 60
MOVE G6C, 105, 40, 70, , , ,
MOVE G6B, 80, 40, 70, , , ,
WAIT
RETURN
'================================================
'================================================
backward_walk:
SPEED 5
GOSUB backward_walk1
SPEED 13
GOSUB backward_walk2
SPEED 7
GOSUB backward_walk3
GOSUB backward_walk4
GOSUB backward_walk5
SPEED 13
GOSUB backward_walk6
SPEED 7
GOSUB backward_walk7
GOSUB backward_walk8
GOSUB backward_walk9
SPEED 13
GOSUB backward_walk2
SPEED 5
GOSUB backward_walk1
RETURN
'================================================
backward_walk1:
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk2:
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk9:
MOVE G6A, 90, 56, 143, 122, 114, 60
MOVE G6D,113, 80, 145, 90, 90, 60
MOVE G6B, 80, 40, 80, , , ,
MOVE G6C,105, 40, 80, , , ,
WAIT
RETURN
backward_walk8:
MOVE G6A,100, 62, 146, 108, 100, 100
MOVE G6D,100, 88, 140, 86, 100, 100
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk7:
MOVE G6A,113, 76, 142, 105, 90, 60
MOVE G6D,90, 96, 136, 85, 114, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN
backward_walk6:
MOVE G6D,90, 107, 105, 105, 114, 60
MOVE G6A,113, 78, 145, 93, 90, 60
MOVE G6C,90, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
backward_walk5:
MOVE G6D,90, 56, 143, 122, 114, 60
MOVE G6A,113, 80, 145, 90, 90, 60
MOVE G6C,80, 40, 80, , , ,
MOVE G6B,105, 40, 80, , , ,
WAIT
RETURN
backward_walk4:
MOVE G6D,100, 62, 146, 108, 100, 100
MOVE G6A,100, 88, 140, 86, 100, 100
MOVE G6C,90, 40, 80, , ,,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
backward_walk3:
MOVE G6D,113, 76, 142, 105, 90, 60
MOVE G6A, 90, 96, 136, 85, 114, 60
MOVE G6C,100, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT
RETURN
'================================================
'================================================
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
RETURN
'================================================
Robots Own/Operated: HeathKit Jr, OmniBot 2000, Lego MindStorms, RSV2, RoboNova-1