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

how to use a flag?

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
18 postsPage 1 of 21, 2
18 postsPage 1 of 21, 2

how to use a flag?

Post by has » Fri Nov 17, 2006 11:03 am

Post by has
Fri Nov 17, 2006 11:03 am

currently i'm using a CM-5 with AX-12 and AX-S1....i'm having problem with the programming as i dont understand how to loop just one time.

scenario: when the sensor senses something, it keeps looping over and over again. but i only want it to carry out the action once.

anyone can help?
currently i'm using a CM-5 with AX-12 and AX-S1....i'm having problem with the programming as i dont understand how to loop just one time.

scenario: when the sensor senses something, it keeps looping over and over again. but i only want it to carry out the action once.

anyone can help?
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by Robo1 » Fri Nov 17, 2006 11:25 am

Post by Robo1
Fri Nov 17, 2006 11:25 am

Something like this should work

DoneOnce = false;

do{
if(DoneOnce == false){
//code
DoneOnce = true;
}

}while(condition)

that should work bren
Something like this should work

DoneOnce = false;

do{
if(DoneOnce == false){
//code
DoneOnce = true;
}

}while(condition)

that should work bren
Robo1
Savvy Roboteer
Savvy Roboteer
Posts: 501
Joined: Fri Jun 30, 2006 1:00 am
Location: UK - Bristol

Post by inaki » Fri Nov 17, 2006 12:47 pm

Post by inaki
Fri Nov 17, 2006 12:47 pm

If you only want to perform once the task you dont need any flow control sentence, just do the task !

In BCP language a sentence similar to a FOR/NEXT in Basic would be:

LOAD EndValue, 10
LOAD Counter, 0
Loop:
IF Counter > EndValue THEN JUMP ExitLoop
DoMyWorkHere
COMPUTE Counter = Counter + 1
JUMP Loop
ExitLoop:
If you only want to perform once the task you dont need any flow control sentence, just do the task !

In BCP language a sentence similar to a FOR/NEXT in Basic would be:

LOAD EndValue, 10
LOAD Counter, 0
Loop:
IF Counter > EndValue THEN JUMP ExitLoop
DoMyWorkHere
COMPUTE Counter = Counter + 1
JUMP Loop
ExitLoop:
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

still cant get it to do it just one time....

Post by has » Mon Nov 20, 2006 9:27 am

Post by has
Mon Nov 20, 2006 9:27 am

Thanks for the information but i tried and it loop again and again.... i just want the sensor to loop, not the play motion action.....

(what i write in my program)
in BCP dialog:
LOAD endvalue 10
LOAD counter 1
IF counter > endvalue THEN JUMP exitloop
IF 103:27 > 45 THEN LOAD PLAY MOTION 29(my work)
COMPUTE counter = counter + 1
JUMP loop
exitloop;


What does the endvalue do?

my scenario:
item moved by conveyor and sensor to sense and stop the conveyor.
After it stop, motor 15 were to activate(done in motion editor ,play motion page 29)after it done with motion play, the conveyor were activated to move again.
Thanks for the information but i tried and it loop again and again.... i just want the sensor to loop, not the play motion action.....

(what i write in my program)
in BCP dialog:
LOAD endvalue 10
LOAD counter 1
IF counter > endvalue THEN JUMP exitloop
IF 103:27 > 45 THEN LOAD PLAY MOTION 29(my work)
COMPUTE counter = counter + 1
JUMP loop
exitloop;


What does the endvalue do?

my scenario:
item moved by conveyor and sensor to sense and stop the conveyor.
After it stop, motor 15 were to activate(done in motion editor ,play motion page 29)after it done with motion play, the conveyor were activated to move again.
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by inaki » Mon Nov 20, 2006 11:18 am

Post by inaki
Mon Nov 20, 2006 11:18 am

The EndValue is just the top value of the loop. You can replace the line:
IF Counter > endvalue THEN...
with an immediate value:
IF Counter > 10 THEN

I don't see the "Loop" label in your code. Where have you placed it ?

Do you have the sensor with an ID = 103 ? Usually it is 100, have you changed it ?
The EndValue is just the top value of the loop. You can replace the line:
IF Counter > endvalue THEN...
with an immediate value:
IF Counter > 10 THEN

I don't see the "Loop" label in your code. Where have you placed it ?

Do you have the sensor with an ID = 103 ? Usually it is 100, have you changed it ?
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

iiiii......

Post by has » Mon Nov 20, 2006 12:10 pm

Post by has
Mon Nov 20, 2006 12:10 pm

i place the loop
BCP language:
loop IF counter > endvalue THEN JUMP exitloop
i got six sensors so the sensor i'm using is 103
i rename it as i got 6 sensors..
i place the loop
BCP language:
loop IF counter > endvalue THEN JUMP exitloop
i got six sensors so the sensor i'm using is 103
i rename it as i got 6 sensors..
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by inaki » Mon Nov 20, 2006 1:50 pm

Post by inaki
Mon Nov 20, 2006 1:50 pm

Ohhhh 6 sensors! Nice!

Please, may you attach your BCP program in your message so I can take a look at the actual code ? (hint: use Robosavvy file manager)
Ohhhh 6 sensors! Nice!

Please, may you attach your BCP program in your message so I can take a look at the actual code ? (hint: use Robosavvy file manager)
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

Post by has » Mon Nov 20, 2006 2:36 pm

Post by has
Mon Nov 20, 2006 2:36 pm

[url]http://robosavvy.com/Builders/has/[url]
[/url]
[url]http://robosavvy.com/Builders/has/[url]
[/url]
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by inaki » Tue Nov 21, 2006 9:22 am

Post by inaki
Tue Nov 21, 2006 9:22 am

Has, I have read the BCP file. Which part of the code is the one that is working wrong ?
Has, I have read the BCP file. Which part of the code is the one that is working wrong ?
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

pic...

Post by has » Tue Nov 21, 2006 9:43 am

Post by has
Tue Nov 21, 2006 9:43 am

i willl send u e bcf pic and the part ...
i willl send u e bcf pic and the part ...
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

pic...

Post by has » Tue Nov 21, 2006 9:46 am

Post by has
Tue Nov 21, 2006 9:46 am

has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by inaki » Tue Nov 21, 2006 10:07 am

Post by inaki
Tue Nov 21, 2006 10:07 am

Has, I think I have found the problem.
In line 36 you do:

JUMP loop2

loop2 is located in line 27. However in line 28 you LOAD counter again!.

This is wrong because 'counter' never will be greater than 1. You must move the label 'loop2' to line 29.
Has, I think I have found the problem.
In line 36 you do:

JUMP loop2

loop2 is located in line 27. However in line 28 you LOAD counter again!.

This is wrong because 'counter' never will be greater than 1. You must move the label 'loop2' to line 29.
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

but bro....

Post by has » Tue Nov 21, 2006 12:20 pm

Post by has
Tue Nov 21, 2006 12:20 pm

but my loop2 already at line 29 before.....
but my loop2 already at line 29 before.....
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

pic of the.....

Post by has » Thu Nov 23, 2006 1:50 pm

Post by has
Thu Nov 23, 2006 1:50 pm

http://robosavvy.com/Builders/has/
i wana show u wat i do to the servo and i would like to ask u how am i going to complile every program??? i jz need tips.... thanks
http://robosavvy.com/Builders/has/
i wana show u wat i do to the servo and i would like to ask u how am i going to complile every program??? i jz need tips.... thanks
has
Robot Builder
Robot Builder
User avatar
Posts: 13
Joined: Thu Nov 02, 2006 1:00 am

Post by inaki » Thu Nov 23, 2006 9:58 pm

Post by inaki
Thu Nov 23, 2006 9:58 pm

Soory Has, I don't understand your last message. :-(
Soory Has, I don't understand your last message. :-(
inaki
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 233
Joined: Sun Mar 06, 2005 1:00 am
Location: EH

Next
18 postsPage 1 of 21, 2
18 postsPage 1 of 21, 2