That's right, humans can now use and play with the service script at the bottom of every service page.
So for every service, there is a (or soon to be) nice service page - which describes what the service is used for AND has a nice example script at the bottom in Python (soon to be other languages).
An example (only one I've verified) is our UltrasonicSensor service.
It's service page is here http://myrobotlab.org/service/UltrasonicSensor
And below is the script on the develop branch of pyrobotlab/servce/UltrasonicSensor.py
[[service/UltrasonicSensor.py]]
The test system will run the file and prepend this line to the service script
virtual = True
and then the Auto-Magic Elf will endlessly test - no conflict - no confusion - no special rules
just 3 lines of code (possibly a couple more if multiple virtual Arduinos or Serial ports are needed)
...goodtimes....
btw this auto-magic elf pointed out at least 6 bugs which i have corrected now in the script ...
auto testing elf harmony
This is excellent. Now we just need good script examples for all of our services ;)
I was wondering, do you think the automagic elf could auto-prepend more of the boiler plate stuff like
if
(
'virtual'
in
globals
()
and
virtual):
virtualArduino
=
Runtime.start(
"virtualArduino"
,
"VirtualArduino"
)
virtualArduino.connect(port)
?
and we can just use a convention for all scripts to use "COM99" or something like that for their arduino..
o/w every script needs to create the virtual arduino and connect to the symbolic port.
Ya .. usually .. more simple
Ya .. usually .. more simple is better .. but sometimes its finding a sweet-spot between
Tranparency & Ease of Use
With what you propose - your having "Ease of Use" - because the end user won't have to look at this code they potentially won't be using. Most the time I would agree with this.
However, its a single if condition, and always "off" for the end user, unless they turn it on. But its a good "seed" for users without hardware. Not only do auto-magic elves benefit from virtual hardware, but potentially "real" users can benefit greatly from virtual hardware.
So, I (in this case) prefer Transparency of potentially using virtual hardware vs hiding everything from the user.