by Pev » Mon May 07, 2007 8:58 am
by Pev
Mon May 07, 2007 8:58 am
Hi,
The issue you have is that the IR remote is not a buffered input device, thus while RN-1 is walking it is not checking or storing the IR remote input and only reads it at the end or at the 'right time' as you put it.
Bluetooth obviously overcomes this as it is a buffered input device (well the BlueSmirf is) and thus holds the command sent until it is read by the code. I guess you could check the remote repeatedly during the walking cycle and see how that works. It would be something like :
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,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
'---------------------------------------
'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,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
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
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
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,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A = REMOCON(1)
IF A = 11 THEN
GOTO fwd_walk_main
IF A <> 11 THEN
RETURN
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Don't forget to dimension RV at the top of your template :
DIM RV AS BYTE
This may work as it will increase the number of reads during the routine but may effect performance as it processes the reads. You could potentially improve performance by changing:
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
to
A=REMOCON(1)
The reason I have performed the longer routine above is that is protects the value of A if the 11 key isn't pressed (i.e walk forward) but this is probably overkill but is where I would start.
Hope this helps
Pev
Hi,
The issue you have is that the IR remote is not a buffered input device, thus while RN-1 is walking it is not checking or storing the IR remote input and only reads it at the end or at the 'right time' as you put it.
Bluetooth obviously overcomes this as it is a buffered input device (well the BlueSmirf is) and thus holds the command sent until it is read by the code. I guess you could check the remote repeatedly during the walking cycle and see how that works. It would be something like :
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,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
'---------------------------------------
'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,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
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
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
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,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
A = REMOCON(1)
IF A = 11 THEN
GOTO fwd_walk_main
IF A <> 11 THEN
RETURN
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Don't forget to dimension RV at the top of your template :
DIM RV AS BYTE
This may work as it will increase the number of reads during the routine but may effect performance as it processes the reads. You could potentially improve performance by changing:
'Check Remote
RV = 0
RV = REMOCON(1)
IF RV =11 then
A=11
END IF
to
A=REMOCON(1)
The reason I have performed the longer routine above is that is protects the value of A if the 11 key isn't pressed (i.e walk forward) but this is probably overkill but is where I would start.
Hope this helps
Pev