PnCConf rework
So, to continue the discussion from the above thread:
I see. Some googling gives that it is a form of operator overloading, which explains it to me.The particular line you quoted is part of an initializing sequence of data. (and it's a class of data as well)
Here is a very shortened version:
class Data:
def __init__(self):
for temp in("x","y","z","a","s"):
self[temp+"drivertype"]= "custom"
self[temp+"steprev"]= 200
self[temp+"microstep"]= 5
def __getitem__(self, item):
return getattr(self, item)
def __setitem__(self, item, value):
return setattr(self, item, value)
The two special methods allow self[ ] to work.
In this case I am using them to allow me to use a for loop to initialize common data to all the axes.
Well, I'll see what I can do! I think that what I have in mind is more of a major rework to get it properly object oriented. That would make both maintenance and extension (more Mesa cards etc) a lot easier. I don't know what to do about the glade situation... I guess I'll start looking at it and then we'll see if you like the results and if we can take it all the way.If you would like to hack on PNCconf - that would be great.
I would like to break it up a bit into a couple of files.
There is dead code to remove ( the never-could-get-it-to-work-happily test panel)
The HAL file printing should be broken out of the data class I think.
I need to figure out what I am going to do about the glade problem (The druid widget is broken in newer versions then dropped in the newest version)
and the assistant widget that replaces it has problems too - or at least it did the last time I looked.
And I really need a different data model for Mesa pins....
I am preoccupied at the moment with Gscreen....
Chris M
I spent yesterday evening coding, mostly to figure out how Python works. I like it a lot, except that it is so loosely typed (I miss the static analysing done by a compiler!). I came up with this which could act as an example of what I mean by object oriented approach. It doesn't really do anything useful; it prints out a list of connectors and (probably not entirely correct) HAL pin names for 7i77 and/or 7i76 cards attached to one or more 5i25 boards. It should run on any computer with Python-2.7:
Please Log in or Create an account to join the conversation.
Well, I'll see what I can do! I think that what I have in mind is more of a major rework to get it properly object oriented.
I think it is probably worth considering abandoning the "offline" idea, and making it configure the currently installed hardware.
The current database idea made sense when the database was automatically created and each card had a fixed pinout. With the advent of smart-serial cards which can be connected anywhere and which create different pinouts depending on their setup mode I think the program needs to query the hardware.
The info could be worked out by lots of halcmd commands. Is there a Python version/binding ?
PCI bus query should be easy enough, and it may be possible to use parport_pc to query parports by index number to find 7i43s.
7i80DB? No idea.
Please Log in or Create an account to join the conversation.
I found this compbio.cs.toronto.edu/repos/snowflock/x...thon/xen/util/pci.py but don't understand it yet.
I think you can use dbus www.daniweb.com/software-development/pyt...rd-details-in-python
John
Please Log in or Create an account to join the conversation.
How would you query the 5i25 card in python?
Is it harder than querying a 5i23?
Is there any interface between Python and halcmd?
The data is all available at the command prompt. I don't know if that helps at all.
halrun
loadrt hostmot2
for each parallel port
for each firmware in hm2/7i43
loadrt hm2_7i43 ioaddr=XXX config="firmware= XXXX"
show pin
unloadrt hm2_7i43
next
next
I don't claim that this is an _elegant_ approach.
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
Of course that doesn't exclude an "auto detect" feature.
It is possible to issue hal commands from python, that's what pncconf does today to e.g. run the open loop test. (I think it starts a shell and runs halcmd in it.)
Question: are there nets with special meaning to LinuxCNC? Or are all nets used only by explicitly connected components?
Question: the motmod module (which supplies the axis and motion components) seems to be automatically loaded? Is that correct? Are there more such modules?
Question: is there any reason not to use two-pass loading of HAL files? It would make it somewhat easier to automatically generate a HAL file, I think.
Please Log in or Create an account to join the conversation.
Bear in mind that new sserial cards keep appearing. And new operating modes appear whenever Mesa get bored.I think it should be relatively straight forward to support arbitrary "chains" of cards (i.e. 5i25->7i77->some SSerial card...) -- that's what I had in mind,
The 7i73 is a tiny, cheap card. It has 24 possible pinouts depending on the jumper and software settings.
This was why the current structure was used, with xml files auto-generated by the firmware build system. Then cards were launched with no firmware. And firmwares were introduced that are not in the LinuxCNC system. The problem is keeping the configuration files up-to-date.actually. Also, think about the problems people have with missing Field power on the 7i77/7i76. It seems many (including me) like to set up the machine while waiting for the cards, or before having everything connected.
No, nets are all created ad-hoc by the hal file. There are no magic signal names.Question: are there nets with special meaning to LinuxCNC? Or are all nets used only by explicitly connected components?
No, it has to be explicitly loaded, and is entirely optional. I oftem make configs without it for test purposes. Some people run complete machines without it (limit3 is an adequate motion controller for some systems).Question: the motmod module (which supplies the axis and motion components) seems to be automatically loaded? Is that correct?
No. I use it to modularise configs. But it's fairly new and is complicated by the fact that not all components understand the "names=" syntax.is there any reason not to use two-pass loading of HAL files?
Please Log in or Create an account to join the conversation.
Even if you auto-detect the HAL pin names, how would you know what the user could do with them? Of course, one could recognise, say, "encoder" and guess that this is a quadrature encoder input... but that seems prone to error?Bear in mind that new sserial cards keep appearing. And new operating modes appear whenever Mesa get bored.
The 7i73 is a tiny, cheap card. It has 24 possible pinouts depending on the jumper and software settings.
Thanks for answering my other questions!
Please Log in or Create an account to join the conversation.
Peter has talked of adding daughter board hints and that would help.
But there is no way currently (or with live interrogation) to plug a new daughterboard in and expect PNCconf to know much about it.
But making it easier to add new board info would be very helpful.
Interrogation could be very helpful as an aid to configuration for the user. eg (won't show boards options that are not connected)
We would need away to 'fake' interrogation so we can do testing without having the boards.
Please Log in or Create an account to join the conversation.
And I think TCL will be phased out in linuxcnc3 (I sure hope so)
The concept of two pass seems fine, though unless it become more main stream I'd prefer PNCconf to build HAL files as close to 'normal' as practical.
Chris M
Please Log in or Create an account to join the conversation.