DAQ: added functionality to move aerotech x y and z to a coordinate. And to update the offset in aerotech.
This commit is contained in:
1 parent
dc8d7799b1
commit
e607f872a6
2 files changed
+33
-5
No files matched your search
+19
-2
@@ -10,6 +10,7 @@ from enum import Enum
|
||||
|
||||
import numpy as np
|
||||
from epics import PV
|
||||
from fontTools.feaLib.ast import deviceToString
|
||||
|
||||
from aare.common.beamline import MXBeamline
|
||||
from aare.common.coordinate import Coordinate, SmargonCoordinate
|
||||
@@ -215,11 +216,18 @@ class BeamlineDevices:
|
||||
# Aertoech Automation1
|
||||
@property
|
||||
def aerotech_pos(self) -> Coordinate:
|
||||
return Coordinate(x=0, y=0, z=0)
|
||||
return Coordinate(x=self.__aerotech.gmx.readback,
|
||||
y=self.__aerotech.gmy.readback, z=self.__aerotech.gmz.readback)
|
||||
|
||||
@aerotech_pos.setter
|
||||
def aerotech_pos(self, pos: Coordinate):
|
||||
pass
|
||||
self.__aerotech.gmx.move(pos.x, wait=False)
|
||||
self.__aerotech.gmy.move(pos.y, wait=False)
|
||||
self.__aerotech.gmz.move(pos.z, wait=False)
|
||||
self.__aerotech.gmx.move(pos.x, wait=True)
|
||||
self.__aerotech.gmy.move(pos.y, wait=True)
|
||||
self.__aerotech.gmz.move(pos.z, wait=True)
|
||||
#TODO add wait pos?
|
||||
|
||||
@property
|
||||
def aerotech_omega(self) -> float:
|
||||
@@ -260,3 +268,12 @@ class BeamlineDevices:
|
||||
|
||||
def smargon_move_home(self):
|
||||
self.__smargon.move_home(wait=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from aare.common.beamline import mx_beamline
|
||||
beamline = mx_beamline()
|
||||
devs = BeamlineDevices(beamline)
|
||||
print(devs.aerotech_pos)
|
||||
devs.aerotech_pos = Coordinate(x=124.0, y=1.0, z=1.0)
|
||||
print(devs.aerotech_pos)
|
||||
devs.aerotech_omega = 0.0
|
||||
@@ -1,9 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
from enum import Enum
|
||||
|
||||
import automation1 as a1
|
||||
#import automation1 as a1
|
||||
from epics import PV, Motor
|
||||
|
||||
from aare.common.beamline import MXBeamline, mx_beamline
|
||||
@@ -101,9 +102,19 @@ class AerotechControllerEpics:
|
||||
raise ValueError(f"Invalid task id {task_id}")
|
||||
self.__task_id.put(task_id)
|
||||
|
||||
def __put(self, axis: MyMotor, attr: str, value: float):
|
||||
try:
|
||||
axis.put(attr=attr, value=value)
|
||||
except Exception as e:
|
||||
raise ValueError(f"Error setting {axis.name} {attr} to {value}: {e}")
|
||||
|
||||
def set_offset(self, axis: MyMotor, offset: float):
|
||||
self.__put(axis=axis, attr="OFF", value=offset)
|
||||
|
||||
def home_all(self):
|
||||
#self.__task_id.put(2)
|
||||
#self.__task_reset()
|
||||
self.__task_reset()
|
||||
time.sleep(0.1)
|
||||
self.__task_id.put(2)
|
||||
print(self.__task_id.get())
|
||||
self.__task_filename.put("home_all.a1exe")
|
||||
@@ -125,4 +136,4 @@ if __name__ == "__main__":
|
||||
|
||||
aerotech_epics = AerotechControllerEpics(beamline)
|
||||
#aerotech_epics.home_all()
|
||||
aerotech_epics.omega.move(0.0)
|
||||
#aerotech_epics.omega.move(90.0)
|
||||
Reference in new issue
Block a user