-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"when" for one or "when" for all #484
Comments
Notice (as I just did!) that if you try to test this with the thymio-vpl-tutorial files from https://www.thymio.org/en:visualprogramming it will not work as the files have the old aesl code (i.e. using 'if' rather than 'when'). It is necessary to edit (or delete and replace) the VPL blocks to generate 'when' aesl code. |
Sorry ... when I have a boring day I'll update the aesl files .... |
This is a tricky issue - the changes introduced to resolve #446 and #452 have made some things more intuitive and some things less so. One could argue that in this case it is down to the user to explicitly catch the "when not detect xxx" by including all the forward sensors in their event block : Although this might be seen as slightly less intuitive (for the beginning user) - it doesn't involve implementing a hidden rule (i.e. the 'when' monitoring an extended group of sensors) I don't know what the right answer is - for VPL beginners it is desirable that their initial experience is as intuitive, predictable and rewarding as possible. For further discussion, consider this example of counter-intuitive VPL behaviour. The following VPL code is confusing because although the sound is triggered on pressing the forward button there is no colour change to red (even if the button is held). The generated aesl code reveals that the top leds are always set to green :
Perhaps it would be more appropriate if the "empty" button event block was interpreted to mean explicity false for all button states :
|
@motib - re. aesl tutorial files Sorry, my intended point was more that asebastudio should reparse the VPL immediately on loading the file - not that you should have to go round slavishly re-saving all the tutorial examples to update them! At the moment version changes in asebastudio can have unintended confusing behaviour for legacy files. Maybe this should be logged as a separate issue? |
There is a conversion when loading from VPL 1.3 to VPL 1.4, but it does not treat the "if"/"when" change. It is probably not so trivial to handle that. Moreover, Moti's aesl where updated for 1.4 but before the change from "if" to "when" was introduced. Retrospectively, it seems that it was a bad idea to do this change late in the release cycles. I am sorry for the additional work/stress. @motib do you think you can update the tutorial to have all examples working with "when"? |
I'll make an effort to find the motivation to do this. |
Quick feedback i got in a workshop yesterday: Her impression was that the ground sensor command had lower priority and asked if we could give it a higher priority. Then she said "so how can I fix it?" My conclusion to this little story is that while "when" is well appreciated for the buttons events, the IR sensors are often expected to use "if" conditions by the users I met. |
While discussing the problem of biased execution in case of ambiguity (see aseba-community/thymio-vpl2#116), we realised that the if/when question becomes less of a problem when multiple events can be used as conjunction and ambiguity is properly handled. In the case you report, you would have two lines:
This would work both with if and when. |
One of my simplest VPL programs (likes.aesl) is behaving weirdly. I finally figured out that the change from "if" to "when" had an unexpected consequence. There are four pairs:
not detect center -> stop
detect center -> move forward
detect right -> turn right
detect left -> turn left
Consider: I place my hand in front of the right sensor and the Thymio turns right; then, I remove my hand and I expect that it will stop, but it doesn't. Apparently the "when not detect center" means that the Thymio will only fire this event when the center sensor changes from detect to not detect.
It would make things much more intuitive (for me, at least...) if the "when" were checked when a change occurred to any one of a group of events: all front sensors, all rear sensors, all bottom sensors, all buttons.
The text was updated successfully, but these errors were encountered: