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

thorlabs k10cr1 issues #101

Open
TraceBivens opened this issue Sep 30, 2019 · 4 comments
Open

thorlabs k10cr1 issues #101

TraceBivens opened this issue Sep 30, 2019 · 4 comments

Comments

@TraceBivens
Copy link

TraceBivens commented Sep 30, 2019

I'm having several issues with controlling k10cr1 rotation stages. The least important of these is that I have to use a try/except block to call instrument('saved_instrument') twice for each stage in order to actually load the things, the first call to instrument() raises a 'no known Paramset' error.

More importantly, I'm getting different behavior from different stages. We have 3 K10CR1 stages, one that we've had for a while and a pair that we just got in. In the case of the older one, stage.home() works as expected after an offset has been defined, but the stage always reports position relative to the zero point when it was initialized; this means that move_to() does not account for the offset.

After determining this, I started working on one of the newer stages and discovered that stage.home() doesn't appear to work at all in this case; the active light comes on, but the stage doesn't move.

@natezb
Copy link
Contributor

natezb commented Oct 2, 2019

Thanks for the report. What version of Instrumental and NiceLib are you using?

I'd be interested to see the traceback you get when trying to open the instrument, and (maybe more usefully) your instrumental.conf file.

I haven't seen the issue with not-homing before. Maybe the new stage is only compatible with a newer version of the Thorlabs Kinesis API?

Also, you can look at the code for the K10CR1 and search for offset to see how it's used internally. I haven't thought about this stuff in awhile, but how do you expect the offset should work?

@TraceBivens
Copy link
Author

TraceBivens commented Oct 2, 2019 via email

@TraceBivens
Copy link
Author

TraceBivens commented Oct 3, 2019

Here's an example including the traceback.

Using NiceLib version 0.6
Instrumental version 0.5

Python 3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 22:01:29) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.8.0 -- An enhanced Interactive Python.

from instrumental import instrument

rotator_top = instrument('rotator_top')
Traceback (most recent call last):

  File "<ipython-input-2-1b38e9fe6e86>", line 1, in <module>
    rotator_top = instrument('rotator_top')

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\__init__.py", line 1267, in instrument
    inst = find_nonvisa_instrument(params)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\__init__.py", line 1167, in find_nonvisa_instrument
    return create_instrument(driver_module, classname, normalized_params)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\__init__.py", line 1087, in create_instrument
    return cls._create(paramset)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\__init__.py", line 513, in _create
    obj._initialize(**paramset.get('settings', {}))

  File "<decorator-gen-1>", line 2, in _initialize

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\util.py", line 293, in wrapper
    result = func(*new_args, **new_kwargs)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\motion\kinesis.py", line 212, in _initialize
    self._wait_for_message(GenericDevice.SettingsInitialized)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\motion\kinesis.py", line 261, in _wait_for_message
    msg_id, msg_data = self._decode_message(self.dev.WaitForMessage())

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\site-packages\instrumental\drivers\motion\kinesis.py", line 254, in _decode_message
    msg_id = MessageIDs[msg_type](msg_id_int)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\enum.py", line 310, in __call__
    return cls.__new__(cls, value)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\enum.py", line 564, in __new__
    raise exc

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\enum.py", line 548, in __new__
    result = cls._missing_(value)

  File "C:\ProgramData\Miniconda3\envs\autobot\lib\enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))

ValueError: 5 is not a valid GenericDevice

Here's the config file:

# Instrumental config file
#
# Settings are organized under sections denoted by headings [section name]
# Within each section, settings are written in key = value form.
# Don't use quotation marks around the values.

[servers] #--------------------------------------------------------------------
# This section lists available Instrumental servers and their addresses in
# host:port form. The keys are server aliases.

#myServer = 0.0.0.0:28265


[instruments] #----------------------------------------------------------------
# This section includes instruments and their parameters. The keys are aliases,
# and the values are written as python dicts of instrument parameters. See the
# examples below for more info.

# VISA instruments
#myScope = {'visa_address': 'TCPIP::0.0.0.1::INSTR'}
#myAFG = {'visa_address': 'TCPIP::0.0.0.2::INSTR'}

# NI-DAQ device
#myDAQ = {'nidaq_devname': 'Dev1'}

# Thorlabs/uEye camera
#myCam = {'ueye_cam_id': 2}

# Entry auto-created 2019-09-25 13:26:58
attenuator = {'serial': '55001000', 'module': 'motion.kinesis', 'classname': 'K10CR1'}

# Entry auto-created 2019-09-25 13:33:35
rotator_top = {'serial': '55114554', 'module': 'motion.kinesis', 'classname': 'K10CR1'}

# Entry auto-created 2019-09-25 13:33:50
rotator_bottom = {'serial': '55114654', 'module': 'motion.kinesis', 'classname': 'K10CR1'}


[prefs] #----------------------------------------------------------------------
# This section is for miscellaneous user-specific preferences.

# This is a path to the root directory where data files will be saved
data_directory = ~/Data

@TraceBivens
Copy link
Author

Sorry about the formatting, i'm kinda new to github and still figuring out how to get stuff to look right

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

2 participants