Note: This is a time-line of
PyVCP development and perhaps not a good introduction to the current pyVCP for a beginner. The
[Integrator Manual] contains a better introduction to pyVCP (HTML format here:
http://www.linuxcnc.org/docs/2.2/html/hal_pyvcp.html)
To Do
- indicating stuff that's in the emc.status structure ? (this could be done with a component that exports the emc.status structure info to HAL pins, see emcshow.py)
- pyvcp designer ? (GUI for building panels)
- suggestion: there's many xml gui editors already(entity farpy ..), they may be useful if the hal info was 'add-on/separable'
- New widgets or improvements to existing widgets:
- chart (shows current and past values for a float, a la auto-roll mode on a scope)
- Log-scale based displays/inputs
- suggestion: jogwheel might use <Shift-Button-4> , <Control-Button-4> for speed ranges
- add a separate scale-output ? count*scale = out can be done with the knob2float component
- Applications/TODO:
- interactive PID tuning
- gui for siggen
2007 02 13
A big DRO from Goslowjimbo
maybe it doesnt look too big here, but it was 1180x974 on my system!
- this application is an example of Hal working with PyVCP, it works without emc
- halrun is used to 'run' it. and several useful methods are in the example
jmkasunich talks about the technique used
the way it works is:
loadusr runs and starts pyvcp
loadusr -W means it waits until pyvcp is _started_
then it continues with your hal script (link commands)
then after everything is set up, it hits waitusr
and waits for pyvcp to exit
when you are all done (20 mins later, or whatever), you close pyvcp
and the waitusr stops
at that point halrun cleans up everything
here's the file's needed
- upload:pyvcp-dro2.hal
- upload:pyvcp-dro.xml
- and the instructions:
- put the above files into your emc root directory (eg: /home/tomp/emc2-head/)
- halrun pyvcp-dro2.hal
for a different way to get a large DRO in AXIS, modify the coordinate display font as shown here:
http://linuxcnc.org/docs/devel/html/gui_axis.html#r1_11_2
lots of new stuff (1Feb2007)
Jepler and Tomp have been busy enhancing pyvcp. At least the following things are new:
- a Tabs widget for notebook style layout see http://imagebin.org/7128 and http://imagebin.org/7129
- XML attribute style markup: <label text="This is a LED indicator"/>
- better error messages
- better control of layout using <boxfill fill=""/>, <boxanchor anchor=""/>, and <boxexpand expand=""/>
- new layout container Labelframe, a labeled frame. (should it be called labelbox ?)
- new layout container Table for sorting widgets into a grid pattern
code snippets for many widgets can be found here http://linuxcnc.org/docs/2.2/html/hal_vcp.html
Here's a sample grid layout:
Tabs widget by Jepler
new Dial widget (21jan2007)
tomp has contributed a new Dial widget. Dial looks similar to jogwheel, but its output is a FLOAT, and the resolution (how much the output changes per 'tick') can be changed. The mouse-bindings are currently:
- drag or mouse-wheel rotates the dial
- shift - left-button-click will reset the dial to the initial value (0 if not specified)
- doubleclick-left-button will decrease the resolution by 10x (e.g from 0.1 to 0.01)
- doubleclick-right-button will increase the resolution by 10x (e.g. from 10 to 100)
- shift-middle-button-click will reset the resolution to its initial value
Started on documentation (11jan2007)
There is now a bit of text about pyVCP and some screenshots in the [Integrator Manual]
The pyVCP text from the manual is now also available in HTML format at http://www.linuxcnc.org/docs/2.2/html/hal_vcp.html
new widgets: Jogwheel and Meter (9jan2007)
Jogwheel is a round thing which reacts to both the mouse-wheel, and dragging with the mouse. It outputs a HAL_FLOAT corresponding to the wheel position. Markup like this:
<jogwheel>
[ <cpr>33</cpr> ] (counts per revolution)
[ <halpin>"myjogwheel"</halpin> ]
[ <size>300</size> ]
</jogwheel>
Meter resembles an analog voltmeter, and is used to display the value of a HAL_FLOAT:
<meter>
[ <size>300</size> ]
[ <halpin>"mymeter"</halpin> ]
[ <text>"My Voltage"</text> ]
[ <min_>-22</min_> ]
[ <max_>123</max_> ]
</meter>
a note on BIG fonts (8jan2007)
For a DRO, you might like really big fonts. The maximum size of a font is predetermined by what X fonts you have installed, the phase of the moon etc. etc.
It looks like a standard font like 'Helvetica' or 'Arial' or 'Roman' wont show as the correct size when trying to size it abouve 40-50 or so.
On the standard Ubuntu 6.06 install which most EMCers use 'courier 10 pitch' seems to be a font that's available in big size. So for a big label or number widget you might specify:
<font>('courier 10 pitch',100)</font>
also see here for how to modify the coordinate display font in AXIS:
http://linuxcnc.org/docs/devel/html/gui_axis.html#r1_11_2
new widget: Radiobutton (7jan2007)
<radiobutton>
<choices>["one","two","three"]</choices>
</radiobutton>
will create a radiobutton which sets one of the defined BITs true. The pins in the example will be named
compname.radiobutton.0.one
compname.radiobutton.0.two
compname.radiobutton.0.three
new syntax for calling pyVCP (4jan2007)
The syntax is now
pyvcp -c halcomp_name myfile.xml
and the created hal pins will be named with the prefix halcomp_name, i.e. halcomp_name.led halcomp_name.number etc.
This also means that it's possible to simultaneously open two or more panels if you want to:
pyvcp -c mypanel1 myfile1.xml
pyvcp -c mypanel2 myfile2.xml
ans so on.
running pyVCP standalone (3jan2007)
It's now possible to run pyVCP both as a part of AXIS (see instructions below), and standalone.
running pyVCP standalone might be useful when developing a new panel (you don't want to start and restart emc every time to see the effect of changes in the XML), or for RT applications where only HAL is required (simple DRO display etc.)
to run standalone enter the command
pyvcp myfile.xml
that will create a pyvcp panel with the widgets described in myfile.xml
new jognumber widget (2jan2007)
A jognumber controls a HAL_FLOAT. When you point the mouse over the jognumber and spin the mouse wheel the number will increment or decrement by a set value(=resolution)
running pyVCP from the .ini file (2jan2007)
The latest HEAD now supports running pyVCP with AXIS by specifying:
PYVCP = your_pyvcp.xml
in the [DISPLAY] section of the ini file.
You can also run a HAL file after the GUI has started by specifying:
POSTGUI_HALFILE = hookup_pyvcp_pins.hal
in the [HAL] section of the ini.
This is demonstrated in the sim/lathe config which shows the spindle speed with a pyVCP bar widget. It looks like this:
integrating pyVCP with AXIS (1jan2007)
jepler made some small changes to vcpparse.py (
http://pastebin.ca/299178), and suggested the following content for ~/.axisrc:
import vcpparse2
f = Tkinter.Frame(root_window)
f.grid(row=0, column=4, rowspan=6)
vcpparse2.create_vcp(f, comp)
This way we can get the pyVCP widgets alongside AXIS!:
pyVCP with an XML file controlling layout (29dec2006)
Here's a development of the pyVCP idea. The widgets and their placement are specified in an XML file, and there's a parser which reads through the XML file and generates the pyVCP widgets.
wiki uploads are still not working for me so I use pastebin:
To see that I am not fooling you, here are the HAL pins generated from the example above:
pyVCP (28dec2006)
a first trial at generating Tkinter widgets that are connected to HAL pins:
- The first widget is a slider that controls the value of a FLOAT HAL pin
- The second widget is a button that controls a BIT HAL pin (1 only when the button is pressed and held down)
- The third widget is a checkbox, which works like a button, but the BIT HAL pin is stuck in either the on or off position
- The fourth widget is a LED (red), which indicates the status of a BIT HAL pin.
- The fifth widget is a bar-indicator that displays the value of a FLOAT HAL pin
- the sixth widget is a numerical display of a FLOAT HAL pin
- the final widget is a simple static label
upload:pyvcp.py is a linbrary of widgets that are basically inherited from Tkinter, but the HAL functionality has been added
upload:pyvcp_test.py is a test program that will generate the screenshot shown above
upload:mpvcp.xml example of XML file(20jun2011)