PnCConf rework

More
07 Mar 2013 07:41 #30997 by arvidb
PnCConf rework was created by arvidb
I didn't mean to hijack BigJohnT's thread here , and I guess the appropriate thing is to start a new thread here in the GUI's section anyway, so here it is!

So, to continue the discussion from the above thread:

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.

I see. Some googling gives that it is a form of operator overloading, which explains it to me.

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

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.

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:

File Attachment:

File Name: pncconf2-1...7.tar.gz
File Size:2 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
07 Mar 2013 20:56 #31024 by andypugh
Replied by andypugh on topic PnCConf rework

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.

More
07 Mar 2013 21:48 - 07 Mar 2013 21:53 #31031 by BigJohnT
Replied by BigJohnT on topic PnCConf rework
How would you query the 5i25 card in python?

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
Last edit: 07 Mar 2013 21:53 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
07 Mar 2013 22:27 #31033 by andypugh
Replied by andypugh on topic PnCConf rework

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.

More
07 Mar 2013 23:04 #31036 by BigJohnT
Replied by BigJohnT on topic PnCConf rework
I think you can use the dbus library in python to find out what cards are in the pci buss then go from there. I don't see any interface to halcmd in the python interface...

John

Please Log in or Create an account to join the conversation.

More
08 Mar 2013 07:29 - 08 Mar 2013 07:29 #31053 by arvidb
Replied by arvidb on topic PnCConf rework
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, 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.

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.
Last edit: 08 Mar 2013 07:29 by arvidb.

Please Log in or Create an account to join the conversation.

More
08 Mar 2013 07:57 #31055 by andypugh
Replied by andypugh on topic PnCConf rework

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,

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.

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.

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.

Question: are there nets with special meaning to LinuxCNC? Or are all nets used only by explicitly connected components?

No, nets are all created ad-hoc by the hal file. There are no magic signal names.

Question: the motmod module (which supplies the axis and motion components) seems to be automatically loaded? Is that correct?

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).

is there any reason not to use two-pass loading of HAL files?

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.

Please Log in or Create an account to join the conversation.

More
08 Mar 2013 09:17 #31059 by arvidb
Replied by arvidb on topic PnCConf rework

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.

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?

Thanks for answering my other questions!

Please Log in or Create an account to join the conversation.

More
08 Mar 2013 10:30 #31061 by cmorley
Replied by cmorley on topic PnCConf rework
This is the other side of live config interrogation. You get the pinnames and location and that's about it. Without context it's insufficient.

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.

More
08 Mar 2013 10:35 #31062 by cmorley
Replied by cmorley on topic PnCConf rework
I'm not a fan of twopass simply cause it's programmed in TCL
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.

Time to create page: 0.100 seconds
Powered by Kunena Forum