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

Programming Question

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

Programming Question

Post by viper1 » Wed Nov 26, 2008 2:39 am

Post by viper1
Wed Nov 26, 2008 2:39 am

I noticed someting in a couple of routines, in basic, that there was: "FOR i = 0 TO 5" As in the Push Up Routine:
And was wondering what its used for??
'***************pushup ********************************

pushup:
SPEED 10
GOSUB sit2

'lean forward
MOVE G6A, 98, 161, 26, 160, 103, 100
MOVE G6B,180, 17, 98, , ,
MOVE G6C,177, 20, 91, , ,
MOVE G6D, 99, 158, 27, 157, 102, 100
WAIT

'hands down
MOVE G6A,100, 163, 60, 154, 102,
MOVE G6B,180, 17, 98, , ,
MOVE G6C,177, 20, 91, , ,
MOVE G6D,100, 164, 63, 148, 100,
WAIT

'extend legs
MOVE G6A,100, 61, 157, 74, 105,

MOVE G6D,100, 61, 167, 68, 99,
WAIT


FOR i = 0 TO 5
'bend arms
MOVE G6A,100, 61, 157, 74, 105,
MOVE G6B,180, 89, 11, 100, 100, 100
MOVE G6C,177, 84, 11, 100, 100, 100
MOVE G6D,100, 61, 166, 68, 98, 100
WAIT

'straighten arms
MOVE G6B,181, 17, 98, , ,
MOVE G6C,177, 22, 92, , ,
WAIT
NEXT i

GOSUB one_hand_pushup
RETURN

'*********************************************************
'stand up from forward pushup
standup:

'legs out
SPEED 15
MOVE G6A, 76, 165, 54, 162, 156,
MOVE G6B,181, 17, 98, , ,
MOVE G6C,177, 22, 92, , ,
MOVE G6D, 76, 165, 54, 162, 156,
WAIT


'tilt body back
MOVE G6A, 76, 165, 54, 162, 156, 100
MOVE G6B,163, 17, 98, 100, 100, 100
MOVE G6C,163, 17, 98, 100, 100, 100
MOVE G6D, 76, 165, 54, 162, 156, 100
WAIT


' lean back for stand up

MOVE G6A, 60, 164, 21, 162, 136,
MOVE G6B,145, 17, 98, 100, 100, 100
MOVE G6C,145, 17, 98, 100, 100, 100
MOVE G6D, 60, 164, 21, 162, 136,
WAIT


GOSUB standard_pose
RETURN
What is this and what is its purpose?
I noticed someting in a couple of routines, in basic, that there was: "FOR i = 0 TO 5" As in the Push Up Routine:
And was wondering what its used for??
'***************pushup ********************************

pushup:
SPEED 10
GOSUB sit2

'lean forward
MOVE G6A, 98, 161, 26, 160, 103, 100
MOVE G6B,180, 17, 98, , ,
MOVE G6C,177, 20, 91, , ,
MOVE G6D, 99, 158, 27, 157, 102, 100
WAIT

'hands down
MOVE G6A,100, 163, 60, 154, 102,
MOVE G6B,180, 17, 98, , ,
MOVE G6C,177, 20, 91, , ,
MOVE G6D,100, 164, 63, 148, 100,
WAIT

'extend legs
MOVE G6A,100, 61, 157, 74, 105,

MOVE G6D,100, 61, 167, 68, 99,
WAIT


FOR i = 0 TO 5
'bend arms
MOVE G6A,100, 61, 157, 74, 105,
MOVE G6B,180, 89, 11, 100, 100, 100
MOVE G6C,177, 84, 11, 100, 100, 100
MOVE G6D,100, 61, 166, 68, 98, 100
WAIT

'straighten arms
MOVE G6B,181, 17, 98, , ,
MOVE G6C,177, 22, 92, , ,
WAIT
NEXT i

GOSUB one_hand_pushup
RETURN

'*********************************************************
'stand up from forward pushup
standup:

'legs out
SPEED 15
MOVE G6A, 76, 165, 54, 162, 156,
MOVE G6B,181, 17, 98, , ,
MOVE G6C,177, 22, 92, , ,
MOVE G6D, 76, 165, 54, 162, 156,
WAIT


'tilt body back
MOVE G6A, 76, 165, 54, 162, 156, 100
MOVE G6B,163, 17, 98, 100, 100, 100
MOVE G6C,163, 17, 98, 100, 100, 100
MOVE G6D, 76, 165, 54, 162, 156, 100
WAIT


' lean back for stand up

MOVE G6A, 60, 164, 21, 162, 136,
MOVE G6B,145, 17, 98, 100, 100, 100
MOVE G6C,145, 17, 98, 100, 100, 100
MOVE G6D, 60, 164, 21, 162, 136,
WAIT


GOSUB standard_pose
RETURN
What is this and what is its purpose?
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Post by Sazabi » Wed Nov 26, 2008 7:52 am

Post by Sazabi
Wed Nov 26, 2008 7:52 am

it's a cycle used to repeat part of code few times, here - repeat pushups for 6 times. See "Next i" after "straighten arms" code blog? that's the end of cycle, musthave if you use "for".
it's a cycle used to repeat part of code few times, here - repeat pushups for 6 times. See "Next i" after "straighten arms" code blog? that's the end of cycle, musthave if you use "for".
Sazabi
Savvy Roboteer
Savvy Roboteer
Posts: 73
Joined: Mon Jan 07, 2008 8:57 am

Programming Question

Post by viper1 » Thu Nov 27, 2008 12:26 am

Post by viper1
Thu Nov 27, 2008 12:26 am

Oh ok Thanks.
So what if I wanted to run a routine where he bends his knees, and I want them to stay in that position while he does something else with his arms or claws while his knees are continued to stay in that position. Is that where the wait command would be used?
Oh ok Thanks.
So what if I wanted to run a routine where he bends his knees, and I want them to stay in that position while he does something else with his arms or claws while his knees are continued to stay in that position. Is that where the wait command would be used?
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm


3 postsPage 1 of 1
3 postsPage 1 of 1