Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Code for continual motion?

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
11 postsPage 1 of 1
11 postsPage 1 of 1

Code for continual motion?

Post by serithseraki » Mon Oct 17, 2011 10:43 pm

Post by serithseraki
Mon Oct 17, 2011 10:43 pm

Looking at the Robonova Wiki I saw a link for continual walking that apparently has become a dead link. Anyway, would someone have a sample code they are willing to share for this ability? I have currently been playing with the 2.4GHz controller and am trying to create a motion that has the robot walk forward continually when the joystick value is less than seventy and then stop when the joystick is at a greater value. Which it does walk continually but does not stop. Another idea I had was setting one button as a return command and having select motions be associated to it so certain motions would loop until said button was pressed. But I have no idea how to create such a code if it would even work at all.
Looking at the Robonova Wiki I saw a link for continual walking that apparently has become a dead link. Anyway, would someone have a sample code they are willing to share for this ability? I have currently been playing with the 2.4GHz controller and am trying to create a motion that has the robot walk forward continually when the joystick value is less than seventy and then stop when the joystick is at a greater value. Which it does walk continually but does not stop. Another idea I had was setting one button as a return command and having select motions be associated to it so certain motions would loop until said button was pressed. But I have no idea how to create such a code if it would even work at all.
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Post by i-Bot » Tue Oct 18, 2011 12:33 pm

Post by i-Bot
Tue Oct 18, 2011 12:33 pm

When you develop your program you need to remember that the MOVE takes a finite time to execute. After starting a MOVE you can execute other program steps to read the controller. However it you do a WAIT, then the program will pause until the MOVE is complete. A MOVE command also has a WAIT integrated into the start of itself. So executing MOVE a second time will wait until the first move is complete and pause the program.

Try to use tones as feedback of the state of buttons and program.
When you develop your program you need to remember that the MOVE takes a finite time to execute. After starting a MOVE you can execute other program steps to read the controller. However it you do a WAIT, then the program will pause until the MOVE is complete. A MOVE command also has a WAIT integrated into the start of itself. So executing MOVE a second time will wait until the first move is complete and pause the program.

Try to use tones as feedback of the state of buttons and program.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by serithseraki » Tue Oct 18, 2011 5:39 pm

Post by serithseraki
Tue Oct 18, 2011 5:39 pm

So I need a wait command to initiate a break in the code? I thought that wasn't needed for the move24 command. Also, for reading the placement of the joystick, should I use a Retry command? Regardless, here is my current code so you can see my failed attempt, and note my Robonova has a different leg configuration.

DIM buffer AS BYTE
DIM char AS BYTE
DIM a AS BYTE
DIM b AS BYTE
DIM c AS BYTE
DIM d AS BYTE
DIM e AS BYTE
DIM f AS BYTE
DIM i AS BYTE
DIM X AS BYTE
DIM A16 AS BYTE

ERX 19200, b, bemt1 'Empty the RX buffer
bemt1:
ERX 19200, b, bemt2
bemt2:
ERX 19200, a, bemt3
bemt3:
ERX 19200, a, bemt4
bemt4:
ERX 19200, f, bemt5
bemt5:
ERX 19200, f,bemt6
bemt6:
ERX 19200, i, bemt7
bemt7:
ERX 19200, i,bemt8
bemt8:
ERX 19200, d, bemt9
bemt9:
ERX 19200, d, bemt10
bemt10:


'== 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:
OUT 52,0
FPWM 2,1,0

char="a" 'Byte 0
ETX 19200,char 'Send character

loop1:
ERX 19200,a,loop1 'Receive character


char="b" 'Byte 1
ETX 19200,char 'Send character

loop2:
ERX 19200,b,loop2 'Receive character

char="e" 'Byte 4
ETX 19200,char
loop3:
ERX 19200,e,loop3

char="f" 'Byte 5
ETX 19200,char

loop4:
ERX 19200,f,loop4

char="c" 'Byte 2
ETX 19200,char

loop5:
ERX 19200,c,loop5

char="d" 'Byte 3
ETX 19200,char

loop6:
ERX 19200,d,loop6

GOTO movement

movement: 'Use single Bit

buffer = a.0
IF buffer = 0 THEN GOTO move14 'Select
buffer = a.1
IF buffer = 0 THEN GOTO move3 'L3
buffer = a.2
IF buffer = 0 THEN GOTO move2 'R3
buffer = a.3
IF buffer = 0 THEN GOTO move13 'Start
buffer = a.4
IF buffer = 0 THEN GOTO move15 'Up
buffer = a.5
IF buffer = 0 THEN GOTO move4 'Right
buffer = a.6
IF buffer = 0 THEN GOTO move16 'Down
buffer = a.7
IF buffer = 0 THEN GOTO move3 'Left

buffer = b.0
IF buffer = 0 THEN GOTO move12 'L2
buffer = b.1
IF buffer = 0 THEN GOTO move10 'R2
buffer = b.2
IF buffer = 0 THEN GOTO move11 'L1
buffer = b.3
IF buffer = 0 THEN GOTO move9 'R1
buffer = b.4
IF buffer = 0 THEN GOTO move6 'Triangle
buffer = b.5
IF buffer = 0 THEN GOTO move5 'Square
buffer = b.6
IF buffer = 0 THEN GOTO move8 'Cross
buffer = b.7
IF buffer = 0 THEN GOTO move7 'Circle

buffer = e
IF buffer < 70 THEN GOTO move12 'Left Joystick Left
IF buffer > 180 THEN GOTO move10'Left Joystick Right

buffer = f
IF buffer <70 THEN GOTO move1 'Left Joystick Up
IF buffer > 180 THEN GOTO move2'Left Joystick Down

buffer = c
IF buffer < 70 THEN GOTO move7'Right Joystick Left
IF buffer > 180 THEN GOTO move5'Right Joystick Right

buffer = d
IF buffer <70> 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN
'===============================================
standard_pose:
MOVE G6A,98, 76, 145, 93, 102
MOVE G6D,98, 76, 145, 93, 102
MOVE G6B,100, 30, 80
MOVE G6C,100, 30, 80
WAIT
RETURN
So I need a wait command to initiate a break in the code? I thought that wasn't needed for the move24 command. Also, for reading the placement of the joystick, should I use a Retry command? Regardless, here is my current code so you can see my failed attempt, and note my Robonova has a different leg configuration.

DIM buffer AS BYTE
DIM char AS BYTE
DIM a AS BYTE
DIM b AS BYTE
DIM c AS BYTE
DIM d AS BYTE
DIM e AS BYTE
DIM f AS BYTE
DIM i AS BYTE
DIM X AS BYTE
DIM A16 AS BYTE

ERX 19200, b, bemt1 'Empty the RX buffer
bemt1:
ERX 19200, b, bemt2
bemt2:
ERX 19200, a, bemt3
bemt3:
ERX 19200, a, bemt4
bemt4:
ERX 19200, f, bemt5
bemt5:
ERX 19200, f,bemt6
bemt6:
ERX 19200, i, bemt7
bemt7:
ERX 19200, i,bemt8
bemt8:
ERX 19200, d, bemt9
bemt9:
ERX 19200, d, bemt10
bemt10:


'== 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:
OUT 52,0
FPWM 2,1,0

char="a" 'Byte 0
ETX 19200,char 'Send character

loop1:
ERX 19200,a,loop1 'Receive character


char="b" 'Byte 1
ETX 19200,char 'Send character

loop2:
ERX 19200,b,loop2 'Receive character

char="e" 'Byte 4
ETX 19200,char
loop3:
ERX 19200,e,loop3

char="f" 'Byte 5
ETX 19200,char

loop4:
ERX 19200,f,loop4

char="c" 'Byte 2
ETX 19200,char

loop5:
ERX 19200,c,loop5

char="d" 'Byte 3
ETX 19200,char

loop6:
ERX 19200,d,loop6

GOTO movement

movement: 'Use single Bit

buffer = a.0
IF buffer = 0 THEN GOTO move14 'Select
buffer = a.1
IF buffer = 0 THEN GOTO move3 'L3
buffer = a.2
IF buffer = 0 THEN GOTO move2 'R3
buffer = a.3
IF buffer = 0 THEN GOTO move13 'Start
buffer = a.4
IF buffer = 0 THEN GOTO move15 'Up
buffer = a.5
IF buffer = 0 THEN GOTO move4 'Right
buffer = a.6
IF buffer = 0 THEN GOTO move16 'Down
buffer = a.7
IF buffer = 0 THEN GOTO move3 'Left

buffer = b.0
IF buffer = 0 THEN GOTO move12 'L2
buffer = b.1
IF buffer = 0 THEN GOTO move10 'R2
buffer = b.2
IF buffer = 0 THEN GOTO move11 'L1
buffer = b.3
IF buffer = 0 THEN GOTO move9 'R1
buffer = b.4
IF buffer = 0 THEN GOTO move6 'Triangle
buffer = b.5
IF buffer = 0 THEN GOTO move5 'Square
buffer = b.6
IF buffer = 0 THEN GOTO move8 'Cross
buffer = b.7
IF buffer = 0 THEN GOTO move7 'Circle

buffer = e
IF buffer < 70 THEN GOTO move12 'Left Joystick Left
IF buffer > 180 THEN GOTO move10'Left Joystick Right

buffer = f
IF buffer <70 THEN GOTO move1 'Left Joystick Up
IF buffer > 180 THEN GOTO move2'Left Joystick Down

buffer = c
IF buffer < 70 THEN GOTO move7'Right Joystick Left
IF buffer > 180 THEN GOTO move5'Right Joystick Right

buffer = d
IF buffer <70> 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN
'===============================================
standard_pose:
MOVE G6A,98, 76, 145, 93, 102
MOVE G6D,98, 76, 145, 93, 102
MOVE G6B,100, 30, 80
MOVE G6C,100, 30, 80
WAIT
RETURN
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Post by i-Bot » Wed Oct 19, 2011 12:45 pm

Post by i-Bot
Wed Oct 19, 2011 12:45 pm

It is difficult to understand with such a large program and you only showing part of it.

Why don't you cut the program down to simplify your own debugging and to enable others to help ?

MOVE24 will WAIT if it is called again while still moving. MOVE24 without a WAIT following will test the buttons during a previous MOVE24. If you put a WAIT after the MOVE24, the buttons will be tested after the MOVE24 is complete.
It is difficult to understand with such a large program and you only showing part of it.

Why don't you cut the program down to simplify your own debugging and to enable others to help ?

MOVE24 will WAIT if it is called again while still moving. MOVE24 without a WAIT following will test the buttons during a previous MOVE24. If you put a WAIT after the MOVE24, the buttons will be tested after the MOVE24 is complete.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by serithseraki » Wed Oct 19, 2011 4:17 pm

Post by serithseraki
Wed Oct 19, 2011 4:17 pm

Well the only important portion of the code that should allow the motion to loop or go to the next motion is this that is meant to be inserted after the right_and_left_step motion "not sure why my actual post was condensed so I could not show this".

IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step

Although this code seems to make it walk continually without ever stopping. But if I insert a wait command after the walk motion will the controller read the joystick position automatically or do I need to use a retry to allow it to read the current position?
Well the only important portion of the code that should allow the motion to loop or go to the next motion is this that is meant to be inserted after the right_and_left_step motion "not sure why my actual post was condensed so I could not show this".

IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step

Although this code seems to make it walk continually without ever stopping. But if I insert a wait command after the walk motion will the controller read the joystick position automatically or do I need to use a retry to allow it to read the current position?
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Post by i-Bot » Wed Oct 19, 2011 5:35 pm

Post by i-Bot
Wed Oct 19, 2011 5:35 pm

I did not understand the context of the code:
Code: Select all
buffer = d
IF buffer <70> 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN


There is an error on the second line, also I do not see if there is a goto main somewhere or if you fall through the stand straight, which has a return, without a call.

Is right_and_left_step, your walking routine, which is continually called ?
I did not understand the context of the code:
Code: Select all
buffer = d
IF buffer <70> 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN


There is an error on the second line, also I do not see if there is a goto main somewhere or if you fall through the stand straight, which has a return, without a call.

Is right_and_left_step, your walking routine, which is continually called ?
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by serithseraki » Wed Oct 19, 2011 7:44 pm

Post by serithseraki
Wed Oct 19, 2011 7:44 pm

Sorry for the confusion, and the length of the code. I originally tried to post the full startup portion with the walking motions to make it understandable but I suppose the post was too long and was shorted when posting it. Furthermore, I have no idea how IF buffer <70> 70 THEN GOTO stand_straight was posted like that. The code for the walking motions should be as written below.

'===============================================
forward_walk:
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
SPEED 2
'shift weight right
MOVE24 82,76,145,94,114, ,100,40,80, , , ,100,40,80, , , ,112,76,145,94,90, ,
SPEED 5
'lift left leg
MOVE24 90,60,156,99,114, ,90,40,80, , , ,100,40,80, , , ,114,76,145,94,94, ,
SPEED 7
'bring left leg forward
MOVE24 90,63,156,96,114, ,80,40,80, , , ,105,40,80, , , ,114,98,117,99,94, ,
SPEED 2
RETURN
'===============================================
right_and_left_step:
'center body
MOVE24 100,63,156,96,100, ,90,40,80, , , ,105,40,80, , , ,100,100,117,99,100, ,
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'lift right leg
MOVE24 114,76,145,94,94, ,100,40,80, , , ,90,40,80, , , ,90,60,156,99,114, ,
SPEED 7
'bring right leg forward
MOVE24 114,98,117,99,94, ,105,40,80, , , ,80,40,80, , , ,90,63,156,96,114, ,
SPEED 2
'center body
MOVE24 100,100,117,99,100, ,105,40,80, , , ,90,40,80, , , ,100,63,156,96,100, ,
'shift weight right
MOVE24 82,100,117,99,114, ,105,40,80, , , ,100,40,80, , , ,112,76,145,96,90, ,
SPEED 5
'lift left leg
MOVE24 90,60,156,99,114, ,90,40,80, , , ,100,40,80, , , ,114,76,145,94,94, ,
SPEED 7
'bring left leg forward
MOVE24 90,63,156,96,114, ,80,40,80, , , ,105,40,80, , , ,114,98,117,99,94, ,
SPEED 2
'center body
MOVE24 100,63,156,96,100, ,90,40,80, , , ,105,40,80, , , ,100,100,117,99,100, ,
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN
Sorry for the confusion, and the length of the code. I originally tried to post the full startup portion with the walking motions to make it understandable but I suppose the post was too long and was shorted when posting it. Furthermore, I have no idea how IF buffer <70> 70 THEN GOTO stand_straight was posted like that. The code for the walking motions should be as written below.

'===============================================
forward_walk:
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
SPEED 2
'shift weight right
MOVE24 82,76,145,94,114, ,100,40,80, , , ,100,40,80, , , ,112,76,145,94,90, ,
SPEED 5
'lift left leg
MOVE24 90,60,156,99,114, ,90,40,80, , , ,100,40,80, , , ,114,76,145,94,94, ,
SPEED 7
'bring left leg forward
MOVE24 90,63,156,96,114, ,80,40,80, , , ,105,40,80, , , ,114,98,117,99,94, ,
SPEED 2
RETURN
'===============================================
right_and_left_step:
'center body
MOVE24 100,63,156,96,100, ,90,40,80, , , ,105,40,80, , , ,100,100,117,99,100, ,
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'lift right leg
MOVE24 114,76,145,94,94, ,100,40,80, , , ,90,40,80, , , ,90,60,156,99,114, ,
SPEED 7
'bring right leg forward
MOVE24 114,98,117,99,94, ,105,40,80, , , ,80,40,80, , , ,90,63,156,96,114, ,
SPEED 2
'center body
MOVE24 100,100,117,99,100, ,105,40,80, , , ,90,40,80, , , ,100,63,156,96,100, ,
'shift weight right
MOVE24 82,100,117,99,114, ,105,40,80, , , ,100,40,80, , , ,112,76,145,96,90, ,
SPEED 5
'lift left leg
MOVE24 90,60,156,99,114, ,90,40,80, , , ,100,40,80, , , ,114,76,145,94,94, ,
SPEED 7
'bring left leg forward
MOVE24 90,63,156,96,114, ,80,40,80, , , ,105,40,80, , , ,114,98,117,99,94, ,
SPEED 2
'center body
MOVE24 100,63,156,96,100, ,90,40,80, , , ,105,40,80, , , ,100,100,117,99,100, ,
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
'===============================================
stand_straight:
'shift weight left
MOVE24 112,76,145,96,90, ,100,40,80, , , ,105,40,80, , , ,82,100,117,99,114, ,
SPEED 5
'straighten right leg
MOVE24 112,76,145,96,94, ,100,40,80, , , ,100,40,80, , , ,88,77,140,96,114, ,
SPEED 2
'stand straight, arms out
MOVE24 100,76,145,94,100, ,100,40,80, , , ,100,40,80, , , ,100,76,145,94,100, ,
RETURN
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Post by i-Bot » Wed Oct 19, 2011 8:37 pm

Post by i-Bot
Wed Oct 19, 2011 8:37 pm

At the end of right_and_left_step: you check the value of buffer, but you did not update buffer with the current value from the joystick, so it just stays in a loop.
At the end of right_and_left_step: you check the value of buffer, but you did not update buffer with the current value from the joystick, so it just stays in a loop.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by serithseraki » Wed Oct 19, 2011 9:20 pm

Post by serithseraki
Wed Oct 19, 2011 9:20 pm

Okay, will inserting this line of code allow the buffer to update?

ERX 19200, f, Retry
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step

I would test this myself but my Robonova needs leg surgery.
Okay, will inserting this line of code allow the buffer to update?

ERX 19200, f, Retry
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step

I would test this myself but my Robonova needs leg surgery.
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Post by i-Bot » Wed Oct 19, 2011 10:26 pm

Post by i-Bot
Wed Oct 19, 2011 10:26 pm

As I said it is difficult without seeing the whole of your code together.

I don't see the lable 'retry:, so not sure if this helps.

Since you seem to have got to 'right_and_left_step:' from the testing of the data returned from a 'd' command to the remote.
Code: Select all
char="d" 'Byte 3
ETX 19200,char

loop6:
ERX 19200,d,loop6

then
Code: Select all
buffer = d
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step



You need to include both of these parts in the test.
Code: Select all

char="d" 'Byte 3
ETX 19200,char

newlooplable:
ERX 19200,d,newlooplable
buffer = d
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
As I said it is difficult without seeing the whole of your code together.

I don't see the lable 'retry:, so not sure if this helps.

Since you seem to have got to 'right_and_left_step:' from the testing of the data returned from a 'd' command to the remote.
Code: Select all
char="d" 'Byte 3
ETX 19200,char

loop6:
ERX 19200,d,loop6

then
Code: Select all
buffer = d
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step



You need to include both of these parts in the test.
Code: Select all

char="d" 'Byte 3
ETX 19200,char

newlooplable:
ERX 19200,d,newlooplable
buffer = d
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by serithseraki » Thu Oct 20, 2011 4:50 am

Post by serithseraki
Thu Oct 20, 2011 4:50 am

That did it, thanks. The only thing different is "f" is the variable assigned to the joystick. Anyway this is the code that I inserted directly after the right_and_left_step routine.

Code: Select all
char="f"
ETX 19200,char
loop42:
ERX 19200,f,loop42
buffer = f
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
That did it, thanks. The only thing different is "f" is the variable assigned to the joystick. Anyway this is the code that I inserted directly after the right_and_left_step routine.

Code: Select all
char="f"
ETX 19200,char
loop42:
ERX 19200,f,loop42
buffer = f
IF buffer > 70 THEN GOTO stand_straight
IF buffer < 70 THEN GOTO right_and_left_step
serithseraki
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm


11 postsPage 1 of 1
11 postsPage 1 of 1