loading
 
"state" variable"
Anonymous
11 years
in both tutorials "orienting the lego roverbot" and "adding vision to the lego nxt",  the variable "state" is used.
I don't understand were does this variable come from and how it is modified !

Thanks
State Variable
Anonymous
11 years
The "state" variable used in both tutorials does not come from anywhere. It is just a container that holds which state we are currently operating in. The only place that modifies this variable is the VBScript module. (Although in the NXT demo it is used to change filters in the processing pipeline but this is read only.)

When RoboRealm first starts all variables are initialized to 0 or "". Thus the first time the VBScript module runs the variable does not exist. The first section of the script that will execute is the 'case 0' part. Once the appropriate conditions have been met (which may be 1 or 100 frames later) the VBScript code will set the state to '1' which means on return the next section of code 'case 1' will be executed. Note the GetVariable at the
top of the code ... this is used to read back what state we last left the routine. Remember that the VBScript code is being executed once per
image frame.

You can use whatever variable name you would like as long as you keep it consistent with the code in the VBScript module. I.e. if you read "my_var" as your state variable then be sure to set "my_var" when needed.

STeven.
Anonymous 11 years
thanks a lot for your answer, it is much more clear now.

For your information, I use roborealm to count laps in a slot cars game (TCR electric cars). I use a webcam and roborealm to recognise the cars each time they pass on the start track (with a color filter) and it works quite well !
Anonymous 11 years
That's great! Any chance you could post an image or video for us to link too? Having more examples of what can be done with RR is always great! We'd also link to you from our resources page under user projects.

Let us know if you can share.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index