[visionegg] Re: gratingTCP
- From: Andrew Straw <andrew.straw@xxxxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Mon, 8 Jul 2002 20:53:04 +0930
Hi Jamie,
> What is wrong with:
>
> go_duration = const((3.,'seconds'))
> contrast = const(0.9, 0.1)
> go = const(1)
First, the short answer:
go=const(0,1,ONCE)
Now the long answer, which delves deep into the subtle points of the
Controller class. These issues are important because the Controller
class is the foundation of the real-time behavior of the Vision Egg.
The names such as go_duration, contrast, and go, refer to controllers
that the gratingTCP demo has created. These "tcp names" are assigned
independently from the name of the parameter under control. For example,
go controls a parameter of the Presentation class called enter_go_loop.
This enter_go_loop parameter is an integer which acts as a boolean. When
in run forever mode, enter_go_loop is checked on every frame drawn. If
this parameter is non-zero, a go loop is immediately entered. Because
"go" is a controller, it exhibits all the behavior of controllers, and
should be treated as such.
Every controller has five values that determine its behavior, and each
can be set over TCP. When you reassign a tcp controller, you can use
five arguments, the last four of which are optional:
during_go [, between_go [, eval_frequency [, temporal_variables [,
return_type ]]]]
If you assign only the first argument, during_go, that value is also
used as the between_go value. Therefore, a statement go=const(1) is the
same as go=const(1,1). Also, the default value for the eval_frequency
of ConstantController is ONCE | TRANSITIONS (the bitwise or).
Because the enter_go_loop parameter has no function when the Vision Egg
is already in a go loop, the first argument is unused. However, if no
second argument is given, it defaults to the first argument, so in this
case the first argument would be used as the between_go value.
All together, this means that the statement "go=const(1)" is equivalent
to "go=const(1,1,ONCE|TRANSITIONS)" which says, "Immediately enter the
go loop (because of the ONCE command), and when you come out of the go
loop (a TRANSITION), enter the go loop again." What you want to use is
"go=const(0,1,ONCE)", which means "Immediately (because of ONCE) enter
the go loop, but then don't enter it again (because now the controller
will not be evaluated on the transitions into and out of the go loop)."
You can execute that statement as often as you like, and provided you
are not already in a go loop, it will put you in one immediately.
I hope this clears it up for you! Because entering a go loop from "run
forever" mode is so important, I've been debating creating a special
command to do that, but I haven't implemented anything yet. Maybe this
will be the motivation I need. And the other thing this points out is
that I need to create the documentation ASAP. Actually, much of this is
already documented. If you run "pydoc", it allows you to browse the
documentation that currently exists. I suggest reading the documentation
for class Controller in the Core.py module.
Cheers!
Andrew
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- References:
- [visionegg] Re: graingTCP
- From: jamie carroll theobald
Other related posts:
- » [visionegg] Re: gratingTCP
- [visionegg] Re: graingTCP
- From: jamie carroll theobald