Made progress in both these areas (also bug /dev/ttyACM issue with Mega on Linux is fixed)
Autocompletion now returns relevant functions after CTRL+SPACE
if you want to know some of the Arduino methods you can just type arduino. (ctrl+space) in the Jython editor and a list of possible methods will come up.. It has a link for (more help and javadocs), unfortunately it doesn't currently describe what the method or parameters do ... but hey, it's a start :)
Python script generation - "Recording"
You can press System->recording->start recording
And all the messages the GUI Service sends out (effectively all the actions you do) will be recorded and translated into a Python script which you can re-use to get your system to the same state after a re-start. Or you can see the "cause" and "effect" of what you do on the GUI.
Here is how :
I'm wondering the best format. Currently, it spits out 3 different flavors/formats. Binary msg files, xml files, and Python.py files. I think Python would be the most useful, but I'd like to hear other opinions.
Here is an example of the python (slightly tweaked) that is generated...
So I set the record button on, and graphically added an Arduino, and 2 Servos, connected the Arduino to my serial port and attached the 2 servos to the arduino, all in the gui - then pressed stop recording - and this was (kind of) the script generated ... not too bad :D
arduino = runtime.createAndStart("arduino","Arduino") arduino.setSerialDevice("COM10",57600,8,1,0) arduino.pinMode(18,0) arduino.analogReadPollingStart(18) runtime.createAndStart("pan","Servo") pan.publishState() runtime.createAndStart("tilt","Servo") tilt.publishState() pan.attach("arduino",9) tilt.attach("arduino",10) tilt.moveTo(90) pan.moveTo(100) pan.moveTo(104) pan.moveTo(105) pan.moveTo(106) pan.moveTo(108) pan.moveTo(109) pan.moveTo(110) pan.moveTo(111) pan.moveTo(112) pan.moveTo(113) pan.moveTo(115) pan.moveTo(116) pan.moveTo(117) pan.moveTo(118) pan.moveTo(119) pan.moveTo(119) tilt.moveTo(88) tilt.moveTo(89)
Now, I could load this up in the Jython editor and run it and I'd have (close) to the same state as when I stopped recording. Another little caveat is that when it would run in Jython the moveTo commands would be one right after the other with no pause - they would kill my servos. But if I wanted to I could put sleep statements between or remove some of the commands.