mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
121 stars 80 forks source link

[motion.kinesis] Organize Kinesis to support multiple devices #47

Open natezb opened 6 years ago

natezb commented 6 years ago

The Thorlabs Kinesis software can be used to control many devices, using many interrelated headers and DLLs. Each device-specific DLL depends on Thorlabs.MotionControl.DeviceManager.dll, which provides TLI_ functions for listing and getting info of all kinesis devices on the system.

Then there are the device-specific functions, e.g. those starting with FF_, ISC_, BMC_, etc. There are a number of device-specific functions that are the same (barring the prefix) across the drivers, as well as completely different functions.

I think a proper kinesis-wide driver would have a list_instruments() which doesn't require any of the device-specific driver wrappers to be built.

Other Considerations:

I'm working on this a bit now, in a separate branch which I'll be pushing shortly.

drewrisinger commented 6 years ago

@natezb What is the status of Kinesis support? Has there been any progress since Feb?

I've been looking at writing my own Kinesis drivers (plugging into the Thorlabs Kinesis C# DLLs and pythonnet to wrap them using C# classes instead of C/nicelib), and don't want to duplicate work.

Also, where did you find documentation on these FF_ and ISC_, etc functions? I looked at the Thorlabs APT and Kinesis documentation, and didn't find any references to those.

natezb commented 6 years ago

I hadn't seen pythonnet before, that's good to know about.

I haven't worked on the Kinesis support in awhile, but I just pushed some local changes from back in May into a new kinesis branch: see here.

On my machine, the docs are located at C:\Program Files\Thorlabs\Kinesis\Thorlabs.MotionControl.C_API.chm. If you expand the Modules category at the bottom of the navigation tree, it contains docs for those category-specific functions.

drewrisinger commented 6 years ago

Thanks. I'll look at contributing to this in the next week or so.

I found the C API documentation. I had missed that one and only seen the C# API. Do you have any thoughts about which API would fit better with the Instrumental code base?

On Thu, Oct 4, 2018, 11:42 PM Nate Bogdanowicz notifications@github.com wrote:

I hadn't seen pythonnet before, that's good to know about.

I haven't worked on the Kinesis support in awhile, but I just pushed some local changes from back in May into a new kinesis branch: see here https://github.com/mabuchilab/Instrumental/commits/kinesis.

On my machine, the docs are located at C:\Program Files\Thorlabs\Kinesis\Thorlabs.MotionControl.C_API.chm. If you expand the Modules category at the bottom of the navigation tree, it contains docs for those category-specific functions.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mabuchilab/Instrumental/issues/47#issuecomment-427237204, or mute the thread https://github.com/notifications/unsubscribe-auth/AJucI_Ew1gXOLjoTicf6kw6zHpJWui1lks5uhtU4gaJpZM4SRnrN .

natezb commented 6 years ago

I would say that the C API fits better, especially since we already have code wrapping it--both motion.kinesis and motion.filter_flipper wrap the C API using NiceLib. The tricky part of this, as I noted in the original post, is integrating all these similar drivers under one umbrella, which is the point of the in-progress kinesis branch.

In the general case, I wouldn't be opposed to C#-based drivers for instruments that are Windows-only.

Let me know if you encounter any issues or get confused, it's possible I left this branch in a fairly incomplete state. In particular, it may rely on NiceLib features which are not yet released, but can be obtained via the development version on GitHub.

drewrisinger commented 6 years ago

So, I was looking today at the C# vs C drivers. Before I found Instrumental, I had already written a working prototype to auto-import the C# drivers as individual classes (created by Thorlabs)

Pros:

Cons:

Neutral:

I'm primarily looking at writing drivers for Piezos (e.g. KCube Piezos), and then wrapping those to allow interfacing with a different control system. Just wanted to make my work available to more people, because there doesn't seem to be any python wrappers/drivers for any Kinesis hardware.