From fd141da765c5e0509c794cabaa051c039a560968 Mon Sep 17 00:00:00 2001 From: Felix Wechsler Date: Mon, 18 Oct 2021 17:16:02 -0400 Subject: [PATCH 1/2] Fix for loop, that all pos are shown --- get_position.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_position.py b/get_position.py index 36c5230..00c982b 100644 --- a/get_position.py +++ b/get_position.py @@ -31,7 +31,7 @@ def main(args): with pyAPT.MTS50(serial_number=con[2]) as con: print('\tPosition (mm) = %.2f [enc:%d]'%(con.position(), con.position(raw=True))) - return 0 + return 0 else: print('\tNo APT controllers found. Maybe you need to specify a PID') return 1 From 6e5111891c11feb198ed40b08ede1ff8f3eacc02 Mon Sep 17 00:00:00 2001 From: roflmaostc Date: Tue, 19 Oct 2021 18:12:51 -0400 Subject: [PATCH 2/2] Add KDC 101 controller --- pyAPT/__init__.py | 5 +++-- pyAPT/kdc101.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 pyAPT/kdc101.py diff --git a/pyAPT/__init__.py b/pyAPT/__init__.py index 27aa681..7d6183a 100644 --- a/pyAPT/__init__.py +++ b/pyAPT/__init__.py @@ -1,18 +1,19 @@ from __future__ import absolute_import import pylibftdi -from pyAPT import message, controller, mts50, prm1 +from pyAPT import message, controller, mts50, prm1, kdc101 __version__ = "0.01" __author__ = "Shuning Bian" __all__ = ['Message', 'Controller', 'MTS50', 'OutOfRangeError', 'PRM1', - 'add_PID'] + "KDC101", 'add_PID'] Message = message.Message Controller = controller.Controller MTS50 = mts50.MTS50 PRM1 = prm1.PRM1 +KDC101 = kdc101.KDC101 OutOfRangeError = controller.OutOfRangeError _PRODUCT_IDS = pylibftdi.USB_PID_LIST diff --git a/pyAPT/kdc101.py b/pyAPT/kdc101.py new file mode 100644 index 0000000..b0f64a8 --- /dev/null +++ b/pyAPT/kdc101.py @@ -0,0 +1,25 @@ +from __future__ import absolute_import, division +from .controller import Controller + +class KDC101(Controller): + """ + A controller for a KDC101 linear translation stage. + """ + def __init__(self,*args, **kwargs): + super(KDC101, self).__init__(*args, **kwargs) + + # can be set manually in the menu of the KDC101 + self.max_velocity = 0.48 + self.max_acceleration = 0.48 + + # see manual https://www.thorlabs.com/drawings/7edd686f3ac5c5ad-097D682C-AA42-53E4-3C7EB522A4840171/KDC101-KDC101ManualforAPT.pdf + enccnt = 34304 + T = 2048/6e6 + + # these equations are taken from the APT protocol manual + self.position_scale = enccnt + self.velocity_scale = enccnt * T * 65536 + self.acceleration_scale = enccnt * T * T * 65536 + + self.linear_range = (0,50) +