aseba-community / thymio-vpl2

Next generation VPL for Thymio using Qt Quick from Qt 5.x
GNU Lesser General Public License v3.0
2 stars 5 forks source link

add random timer block #122

Open mbonani opened 6 years ago

mbonani commented 6 years ago

to make interesting behavior a random timer could allow more complex behavior and more efficient ones the user can choose the min and max

davidjsherman commented 6 years ago

Can the existing noisy sensors be used to define a true source of random noise?

mbonani commented 6 years ago

Is depend what you call "true source of random noise", I know there is several level and I am not expert in that. I just know that in Thymio the seed is feed at power up

mbonani commented 6 years ago
    // get the random seed
    seed = 0;
    for(i = 0; i < 5; i++) {
        seed += vmVariables.buttons_mean[i];
        seed += vmVariables.buttons_noise[i];
    }
    seed += vmVariables.vbat[0];
    seed += vmVariables.vbat[1];

    for(i = 0; i < 3; i++) 
        seed += vmVariables.acc[i];

    AsebaSetRandomSeed(seed);

using several sensor value

stephanemagnenat commented 6 years ago

@mbonani could you write down some example of program that would use this timer?

mbonani commented 6 years ago

It come from a discussion I have with @FrancescoMondada, he present me a demo that use random values to just explore a round table. The demo has a simple state machine that can easy be understand. It is simple enough for young user or not techno people to be understandable and still interesting to introduce some computational thinking. I suggest to make it also in VPL (that is possible) but one key element was the random value he was using. It permit to explore the table and not to make a predictable path. Finally to make it in VPL it is just missing the random timer. balade-table.zip

davidjsherman commented 6 years ago

The implementation of one of my proposals for ambiguous rules would also use randomness, but for decision making. Regardless, an example for a random timer would be a path-following in the LOST (white-white) state: it could swerve at constant speed for a random amount of time, to look for the path again.

If I understand the snippet in the comment the sensors are used to seed a pseudo-random number generator. It seems ironic to use pseudo-randomness when the inexpensive components in the robot intuitively provide such beautiful sources of true randomness.

stephanemagnenat commented 6 years ago

I think that a random timer is a very interesting concept that we can absolutely consider, as an advanced version of a deterministic timer. Of course, we have to implement a proper state machine first (see #51).

I think that we should have a more structured approach to select our features. My idea is to build a list of example programs we would like to use in our educational activities, and for each of them list the features we need. We could do this on a wiki attached to this repository. This would also help when selecting the features for a new iteration of Thymio.

riedo commented 6 years ago

In my experience people have expressed the wish to use randomness to create games in groups, for example to use Thymio as a sort of dice (you touch the button, the circle LED turn like a spin wheel and stops at a random one), or in games like "1,2,3 Soleil!" where you don't know how much time you will have to complete a certain task. I the first case it would be convenient to have a random state generator (similar to the existing state action) and in the second the random timer could be used.

davidjsherman commented 6 years ago

An idea for an icon: https://graphicdesign.stackexchange.com/a/93073

catarina0 commented 2 years ago

Hello, I have to do a school project but I am having difficulties with the code on how to make the thymio generate randomly the leds (meaning the leds color change automatically). Does anyone know how to code that ? Thank you

riedo commented 2 years ago

Hello, VPL2 is not developed anymore so Mobsya's team does not check this github regularly (Mobsya is the company that produces Thymio robots and maintains the software Thymio Suite) In which programming language are you trying to do that? you can contact mobsya's support team through our website: https://www.thymio.org/support/programming-in-vpl/