by rippa55 » Thu Sep 21, 2006 3:01 pm
by rippa55
Thu Sep 21, 2006 3:01 pm
have done as you sugested, no diference
i am running 2 gyros, so put the sensor into ad2, here is a copy of the start of code, see if you can see anything missing, thanks
' templet program
'
' RR : internal parameter variable / ROBOREMOCON / Action command
' A : temporary variable / REMOCON
' A16,A26 : temporary variable
'
'== auto_main ===================================
GOTO AUTO
FILL 255,10000
DIM RR AS BYTE
DIM A AS BYTE
DIM A16 AS BYTE
DIM A26 AS BYTE
CONST ID = 0 ' 1:0, 2:32, 3:64, 4:96,
'== Action command check (50 - 82)
IF RR > 50 AND RR < 83 THEN GOTO action_proc
RR = 0
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 "C"
MUSIC "C"
MUSIC "E"
MUSIC "G"
DELAY 150
MUSIC "E"
DELAY 100
MUSIC "G"
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
'================================================
gyro_setup:
GYROSET G6A,2,1,1,1,2,0
GYROSET G6D,2,1,1,1,2,0
GYRODIR G6A,1,1,1,1,1,0
GYRODIR G6D,1,1,1,1,1,0
GYROSENSE G6A,50,250,150,30,60,0
GYROSENSE G6D,50,250,150,30,60,0
MAIN:
'GOSUB robot_voltage
'GOSUB robot_tilt
'-----------------------------
IF RR = 0 THEN GOTO MAIN1
ON RR GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
GOTO main_exit
'-----------------------------
MAIN1:
A = REMOCON(1)
A = A - ID
ON A GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
GOTO MAIN
'-------------------------------------------------
action_proc:
A = RR - 50
ON A GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
RETURN
'-----------------------------
main_exit:
IF RR > 50 THEN RETURN
RR = 0
GOTO MAIN
'================================================
k1:
GOSUB bow_pose
GOSUB standard_pose
GOTO main_exit
k2:
GOSUB martial_arts_pose
DELAY 500
GOSUB standard_pose
GOTO main_exit
k3:
GOSUB martial_arts_pose2
DELAY 1000
GOSUB standard_pose
GOTO main_exit
k4:
GOSUB FOOT_UP
DELAY 1000
GOSUB FOOT2_UP
DELAY 1000
GOSUB standard_pose
GOTO main_exit
k5:
GOSUB SING
GOSUB standard_pose
GOTO main_exit
k6:
GOSUB body_move
GOSUB standard_pose
GOTO main_exit
k7:
GOSUB wing_move
GOSUB standard_pose
GOTO main_exit
k8:
GOSUB right_shoot
GOSUB standard_pose
DELAY 500
GOSUB left_shoot
GOSUB standard_pose
DELAY 500
GOTO main_exit
k9:
GOSUB routine
GOTO main_exit
k10:
GOSUB fast_walk
GOSUB standard_pose
GOTO main_exit
k11: ' ^ 1
GOSUB forward_walk
GOSUB standard_pose
GOTO main_exit
k12: ' _ 1
GOSUB backward_walk
GOSUB standard_pose
GOTO main_exit
k13: ' > 1
SPEED 8
GOSUB right_shift
SPEED 6
GOSUB standard_pose
GOTO main_exit
k14: ' < 1
SPEED 8
GOSUB left_shift
SPEED 6
GOSUB standard_pose
GOTO main_exit
k15: ' A
GOSUB left_attack
GOSUB standard_pose
GOTO main_exit
k16:
GOSUB sit_down_pose16
GOTO main_exit
k17: ' C
GOSUB left_forward
GOSUB standard_pose
GOTO main_exit
k18: ' E
GOSUB andy
GOSUB standard_pose
GOTO main_exit
k19: ' P2
GOSUB backward_standup
GOSUB standard_pose
GOTO main_exit
k20: ' B
GOSUB right_attack
GOSUB standard_pose
GOTO main_exit
k21: ' ^ 2
GOSUB forward_tumbling
GOSUB standard_pose
GOTO main_exit
k22: ' *
GOSUB left_turn
GOSUB standard_pose
GOTO main_exit
k23: ' F
GOSUB pickup
GOTO MAIN
k24: ' #
GOSUB right_turn
GOSUB standard_pose
GOTO main_exit
k25: ' P1
GOSUB forward_standup
GOSUB standard_pose
GOTO main_exit
k26: ' [] 1
GOSUB sit_down_pose26
GOTO main_exit
k27: ' D
GOSUB right_forward
GOSUB standard_pose
GOTO main_exit
k28: ' < 2
GOSUB left_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k29: ' [] 2
GOSUB martial_arts_pose
GOSUB martial_arts_pose2
GOSUB left_attack
GOSUB martial_arts_pose3
GOSUB martial_arts_pose4
GOSUB martial_arts_pose5
GOSUB SING
GOTO main_exit
k30: ' > 2
GOSUB righ_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k31: ' _ 2
GOSUB back_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k32: ' G
GOSUB pushup
SPEED 10
GOSUB standard_pose
GOTO main_exit
'================================================
robot_voltage: ' [ 10 x Value / 256 = Voltage]
DIM v AS BYTE
A = AD(6)
IF A < 148 THEN ' 5.8v
FOR v = 0 TO 2
OUT 52,1
DELAY 200
OUT 52,0
DELAY 200
NEXT v
RETURN
'================================================
robot_tilt:
A = AD(2)
IF A > 250 THEN RETURN
IF A < 30 THEN GOTO tilt_low
IF A > 200 THEN GOTO tilt_high
RETURN
tilt_low:
A = AD(2)
'IF A < 30 THEN GOTO forward_standup
IF A < 30 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(2)
'IF A > 200 THEN GOTO backward_standup
IF A > 200 THEN GOTO forward_standup
RETURN
have done as you sugested, no diference
i am running 2 gyros, so put the sensor into ad2, here is a copy of the start of code, see if you can see anything missing, thanks
' templet program
'
' RR : internal parameter variable / ROBOREMOCON / Action command
' A : temporary variable / REMOCON
' A16,A26 : temporary variable
'
'== auto_main ===================================
GOTO AUTO
FILL 255,10000
DIM RR AS BYTE
DIM A AS BYTE
DIM A16 AS BYTE
DIM A26 AS BYTE
CONST ID = 0 ' 1:0, 2:32, 3:64, 4:96,
'== Action command check (50 - 82)
IF RR > 50 AND RR < 83 THEN GOTO action_proc
RR = 0
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 "C"
MUSIC "C"
MUSIC "E"
MUSIC "G"
DELAY 150
MUSIC "E"
DELAY 100
MUSIC "G"
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
'================================================
gyro_setup:
GYROSET G6A,2,1,1,1,2,0
GYROSET G6D,2,1,1,1,2,0
GYRODIR G6A,1,1,1,1,1,0
GYRODIR G6D,1,1,1,1,1,0
GYROSENSE G6A,50,250,150,30,60,0
GYROSENSE G6D,50,250,150,30,60,0
MAIN:
'GOSUB robot_voltage
'GOSUB robot_tilt
'-----------------------------
IF RR = 0 THEN GOTO MAIN1
ON RR GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
GOTO main_exit
'-----------------------------
MAIN1:
A = REMOCON(1)
A = A - ID
ON A GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
GOTO MAIN
'-------------------------------------------------
action_proc:
A = RR - 50
ON A GOTO MAIN,K1,K2,K3,K4,K5,K6,K7,K8,K9,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K30,K31,K32
RETURN
'-----------------------------
main_exit:
IF RR > 50 THEN RETURN
RR = 0
GOTO MAIN
'================================================
k1:
GOSUB bow_pose
GOSUB standard_pose
GOTO main_exit
k2:
GOSUB martial_arts_pose
DELAY 500
GOSUB standard_pose
GOTO main_exit
k3:
GOSUB martial_arts_pose2
DELAY 1000
GOSUB standard_pose
GOTO main_exit
k4:
GOSUB FOOT_UP
DELAY 1000
GOSUB FOOT2_UP
DELAY 1000
GOSUB standard_pose
GOTO main_exit
k5:
GOSUB SING
GOSUB standard_pose
GOTO main_exit
k6:
GOSUB body_move
GOSUB standard_pose
GOTO main_exit
k7:
GOSUB wing_move
GOSUB standard_pose
GOTO main_exit
k8:
GOSUB right_shoot
GOSUB standard_pose
DELAY 500
GOSUB left_shoot
GOSUB standard_pose
DELAY 500
GOTO main_exit
k9:
GOSUB routine
GOTO main_exit
k10:
GOSUB fast_walk
GOSUB standard_pose
GOTO main_exit
k11: ' ^ 1
GOSUB forward_walk
GOSUB standard_pose
GOTO main_exit
k12: ' _ 1
GOSUB backward_walk
GOSUB standard_pose
GOTO main_exit
k13: ' > 1
SPEED 8
GOSUB right_shift
SPEED 6
GOSUB standard_pose
GOTO main_exit
k14: ' < 1
SPEED 8
GOSUB left_shift
SPEED 6
GOSUB standard_pose
GOTO main_exit
k15: ' A
GOSUB left_attack
GOSUB standard_pose
GOTO main_exit
k16:
GOSUB sit_down_pose16
GOTO main_exit
k17: ' C
GOSUB left_forward
GOSUB standard_pose
GOTO main_exit
k18: ' E
GOSUB andy
GOSUB standard_pose
GOTO main_exit
k19: ' P2
GOSUB backward_standup
GOSUB standard_pose
GOTO main_exit
k20: ' B
GOSUB right_attack
GOSUB standard_pose
GOTO main_exit
k21: ' ^ 2
GOSUB forward_tumbling
GOSUB standard_pose
GOTO main_exit
k22: ' *
GOSUB left_turn
GOSUB standard_pose
GOTO main_exit
k23: ' F
GOSUB pickup
GOTO MAIN
k24: ' #
GOSUB right_turn
GOSUB standard_pose
GOTO main_exit
k25: ' P1
GOSUB forward_standup
GOSUB standard_pose
GOTO main_exit
k26: ' [] 1
GOSUB sit_down_pose26
GOTO main_exit
k27: ' D
GOSUB right_forward
GOSUB standard_pose
GOTO main_exit
k28: ' < 2
GOSUB left_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k29: ' [] 2
GOSUB martial_arts_pose
GOSUB martial_arts_pose2
GOSUB left_attack
GOSUB martial_arts_pose3
GOSUB martial_arts_pose4
GOSUB martial_arts_pose5
GOSUB SING
GOTO main_exit
k30: ' > 2
GOSUB righ_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k31: ' _ 2
GOSUB back_tumbling
SPEED 10
GOSUB standard_pose
GOTO main_exit
k32: ' G
GOSUB pushup
SPEED 10
GOSUB standard_pose
GOTO main_exit
'================================================
robot_voltage: ' [ 10 x Value / 256 = Voltage]
DIM v AS BYTE
A = AD(6)
IF A < 148 THEN ' 5.8v
FOR v = 0 TO 2
OUT 52,1
DELAY 200
OUT 52,0
DELAY 200
NEXT v
RETURN
'================================================
robot_tilt:
A = AD(2)
IF A > 250 THEN RETURN
IF A < 30 THEN GOTO tilt_low
IF A > 200 THEN GOTO tilt_high
RETURN
tilt_low:
A = AD(2)
'IF A < 30 THEN GOTO forward_standup
IF A < 30 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(2)
'IF A > 200 THEN GOTO backward_standup
IF A > 200 THEN GOTO forward_standup
RETURN