PDA

View Full Version : [Question(s)] Behavior control program question



Dmonious
07-08-2008, 05:37 PM
Hello all. I'm in the process of programming my bioloid to fight my robosapien v1 and I was wondering if there is a "random" command one can use. For instance I might want my bioloid to play page 50 or page 51 or page 52 in a random pattern in response to his ir sensor being triggered. Right now it seems like I can only load one page . Any help would be greatly appreciated. :happy:

trey3670
07-12-2008, 09:29 PM
while I dont think there is an existing program,you could write one,it would be rather long though.

ScuD
07-13-2008, 04:34 PM
I don't know what the bioloid programming includes, i've only glanced through the manual, but couldn't you take an analog input value and abuse that as a random generator?

Something along the lines of


if (ambient light level < 100) then (load page 51)
else if (ambient light level > 100) then (load page 52)
Something like that in pseudocode?

Dmonious
07-15-2008, 07:38 PM
Hello all, and thank you for your replies. Scud, the random command I was hoping to find in the bcp would do something like this:

if (ambient light level < 100) then (load page 51 or page 52)

I'm looking for different reactions from the same stimuli. I believe that nqc ("not quiet C" for legos mindstorms) had a "random" command in it. I'm hoping there's some "undocumented" way of adding the command. Otherwise I'll eventually have to learn c or c++ which would kind of suck cause I'm lazy and I kind of like the bcp interface. As a matter of fact I just checked and you could set a counter to pick from a random number in the mindstorms software.

lamont
07-16-2008, 03:04 PM
Assuming the ambient light level is a somewhat noisy signal, you'd probably have more luck simulating a random function by acting one way if ambient_light_level is even and another if it is odd.

if ((ambient_light_level mod 2) == 1) then
load page 51
else
load page 52

I'm writing my own AX-12+ communication libs, so I dont' have experience with the BCP.