Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nidaq driver is very rudimentary #37

Open
vascotenner opened this issue Dec 9, 2014 · 4 comments
Open

nidaq driver is very rudimentary #37

vascotenner opened this issue Dec 9, 2014 · 4 comments

Comments

@vascotenner
Copy link

The NIDaqmx driver to talk with daq cards from national instruments is not working. Some functions a written, but untested.

There are some nidaq wrappers written already, but non of them is running with python 3 out of the box.

I like pylibnidaq, because it has a more or less "high-leve" api; https://code.google.com/p/pylibnidaqmx/
I just made some adjustments to to source, so that this project runs on python3:
https://code.google.com/p/pylibnidaqmx/issues/detail?id=39

Can someone comment how we could implement this wrapper in the lantz framework? The cleanest solution would just be to import this module, however, I can imagine that in order to get is neatly in the lantz framework, some additional tweaks are necesary.

@hgrecco
Copy link
Contributor

hgrecco commented Dec 9, 2014

I think it is good to have a few guidelines for this. We should:

  • leverage from other libraries (as we do with PyVISA).
  • contribute back to them.
  • keep Lantz slim and highlevel (when possible).
  • provide solutions for common scenarios.

The first thing is to decide if pylibnidaqmx is the right choice. I agree with your assessment but I am not sure how active it is. In any case, we could collaborate with it (if the project leaders agree, of course) And in fact you have already by providing Python3 compatibility. If they accept the contribution, we can go forward.

Going to the wrapping. We tried to wrap Tasks and Channels in the past but did not worked very well for the final users. It was a good idea but was just too low level. The difficult but interesting thing about DAQmx is that tasks go beyond single instruments. This allows you to do complex stuff, but at the same time breaks the abstraction that we use in Lantz (1 instrument = 1 object). However, in my experience, there are lot of "single DAQ" uses and therefore my suggestion would be to provide those common scenario solutions.

Some wild thoughts: I think we should start by wrapping a device (in a similar way to what is done in drivers/ni/daqmx/base.py) but proving DictFeats for analog/digital input/outputs, and certain methods to create tasks on the fly for common operations. All these should leverage from pylibnidaqmx.

Because DAQmx has good introspection capabilities, we could create drivers on the fly. In other words, we do not need to create a NIXXXX class for all possible values of XXXX. We just need to have a functions that create the class or an object on demand based on introspection.

My suggestion would be (this is how I usually design an API): write an application using Lantz with DAQmx. Not the one we have, but the one you would like to have. The implementation will follow.

ignamv pushed a commit to ignamv/lantz that referenced this issue Jan 16, 2015
@claypipkin
Copy link

Just curious... was any progress made on this? I just discovered Lantz and am trying to get it to communicate with my ni9234 daq without much luck.

@hgrecco
Copy link
Contributor

hgrecco commented Feb 20, 2015

There is not. I would love to move forward in this direction but I have my hands full at the moment. Sorry

@vascotenner
Copy link
Author

There is a working pyhton3 version of pylibnidaqmx: https://code.google.com/p/pylibnidaqmx/issues/detail?id=39
It has not been merged yet to master. I'm using it, but did not include it in the Lantz framework. I read only one channel at the time, or write to an analog output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants