# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/etc/motion_ctrl/stages/motion_ctrl.stagexy.inbeam_tt-dev.cfg 3864 2022-03-28 07:32:22Z depa $
# configuration file for LIRCS detector position (XY) device
#

LOAD                                 = [NAME=INBEAM_TT, LIB=BasdaMoccaMpiaNDevice]

  
MOD.X.CFG.CONNECTION.ADDRESS          = tcp://192.168.61.51:4000
MOD.X.CFG.CONNECTION.CARD             = 1 
MOD.X.CFG.CONNECTION.MODULE           = 2  
MOD.X.CFG.CONNECTION.TIMEOUT:Time     = 00:00:03.000000      +UNIT=hour                             # its the time how long the service should wait for a normal command response like ACK (this timeout is blocking the service but the MoCon sends the ACK immediately)
MOD.X.CFG.CONNECTION.EVENT_TIMEOUT:Time = 00:00:00.500000    +UNIT=hour                             # its the time how long the service should wait for a event message (Pay attention: this timeout blocks the service while it is waiting for an event which might not send immediately)
MOD.X.CFG.CONNECTION.UPLOAD_TIME:Time = 00:00:00.008541000   +UNIT=hour                             # this time needs to be measured in advance to calculate the correct timing for the net profile block upload
MOD.X.CFG.DATASHEET.CONFIG            = motion_ctrl/stages/motion_ctrl.stagexy.inbeam_tt-dev_XY_datasheet.cfg

#MOD.X.CFG.DATASHEET.TRAVELRANGE:Point = [520000, 1670000]  +UNIT=steps  +LABEL=["MIN", "MAX"]
MOD.X.CFG.DATASHEET.TRAVELRANGE:Point = [-10000000, 10000000]  +UNIT=steps  +LABEL=["MIN", "MAX"]


MOD.Y.CFG.CONNECTION.ADDRESS          = tcp://192.168.61.51:4000
MOD.Y.CFG.CONNECTION.CARD             = 1 
MOD.Y.CFG.CONNECTION.MODULE           = 3  
MOD.Y.CFG.CONNECTION.TIMEOUT:Time     = 00:00:03.000000      +UNIT=hour                             # its the time how long the service should wait for a normal command response like ACK (this timeout is blocking the service but the MoCon sends the ACK immediately)
MOD.Y.CFG.CONNECTION.EVENT_TIMEOUT:Time = 00:00:00.500000    +UNIT=hour                             # its the time how long the service should wait for a event message (Pay attention: this timeout blocks the service while it is waiting for an event which might not send immediately)
MOD.Y.CFG.CONNECTION.UPLOAD_TIME:Time = 00:00:00.008541000   +UNIT=hour                             # this time needs to be measured in advance to calculate the correct timing for the net profile block upload
MOD.Y.CFG.DATASHEET.CONFIG            = motion_ctrl/stages/motion_ctrl.stagexy.inbeam_tt-dev_XY_datasheet.cfg

#MOD.Y.CFG.DATASHEET.TRAVELRANGE:Point = [670000, 2000000]  +UNIT=steps  +LABEL=["MIN", "MAX"]
MOD.Y.CFG.DATASHEET.TRAVELRANGE:Point = [-10000000, 10000000]  +UNIT=steps  +LABEL=["MIN", "MAX"]

# device configuration parameter to define which position value should be periodically updated
# default: 0 MoCon internal software Encoder
#          1 incremental Encoder
#          2 absolute Encoder
#          3 MoCon internal software Encoder + incremental Encoder
#          4 MoCon internal software Encoder + absolute Encoder
#          5 incremental Encoder + absolute Encoder
#          6 MoCon internal software Encoder + incremental Encoder + absolute Encoder
CFG.POSITION.AUTOUPDATE:Int          = 0

# device configuration parameter to define which position value should be returned by 
# getPosition or displayed in the GUI
# default: 0 MoCon internal software Encoder
#          1 incremental Encoder
#          2 absolute Encoder
CFG.POSITION.REPORT:Int              = 0

# device configuration parameter to define in which unit the position value should be returned. The value is the index of the CFG.TRANS
CFG.POSITION.UNIT:Int                = 0 

# device configuration parameter to define in which unit the position value should be returned. The value is the index of the CFG.TRANS
CFG.POSITION.UNIT                    = STEPS 
#
# device configuration parameter
#
# Depending on how many named position you like to have add here the properties with the positions values and the labels.
# The labels are used to display them in the GUI. The position values are the absolute target positions of the motor in steps.
# The property of the named position needs to be numbered serially.
#

CFG.NAMED_POS.ABS.0:Point                  =  [821487, 878994]              +LABEL=["X", "Y"] +NAME="IN"
#CFG.NAMED_POS.ABS.1:Point                  =  [1171801,834501]              +LABEL=["X", "Y"] +NAME="NPOS_2"

#
# This is the named position for relative movements. It can be used in engineering mode in order to move the motor to a relative position several times.
# without to edit the target position permanently.
#
CFG.NAMED_POS.REL.0:Point                  = [0.1,0.1]               +LABEL=["X", "Y"] +NAME="Rel. 0"

#
# This are the position switch codings for the single named positions
#
#CFG.NAMED_POS.SWITCH.0 = 0xFE
#CFG.NAMED_POS.SWITCH.0 = 0x5
#CFG.NAMED_POS.SWITCH.1 = 0xFD
#CFG.NAMED_POS.SWITCH.2 = 0xFC
#CFG.NAMED_POS.SWITCH.3 = 0xFB

#
# It follows the definition of the coordination transformation 
# from the focal plane in the motor coordinate system.
# It is also used to convert to different units.

CFG.TRANS.STEPS:WMatrix = [[1, 0], [0, 1], [0, 0]]   +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=0       

# According to LN-MPIA-VER-CRY-001 motor #2 has a range of 20100 steps for
# the x coordinate and motor #3 has a range of 19700 steps for the y-coord.
# The number of steps for a full range of 30.03 degrees is 3268, which
# gives 0.009186 deg per step. Note that both signs may still be individually
# wrong and may be negative (depending on whether sky rotations are flipped...)
# RJM 2016-11-10
# CFG.TRANS.MM:WMatrix     = [[0.00918605, 0], [0, 0.00918605], [0, 0]] +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=1           
# transformation matrix in motor coordinate system
CFG.TRANS.MM:WMatrix     = [[6.867e-6, 0], [0, 6.867e-6], [0, 0]] +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=1
# CFG.TRANS.MM:WMatrix     = [[1.3734e-5, 0], [0, 1.3734e-5], [0, 0]] +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=1
# CFG.TRANS.MICRON:WMatrix = [[1.3734e-2, 0], [0, 1.3734e-2], [0, 0]] +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=2

# CFG.TRANS.ARCSEC:WMatrix = [[68.7723334, 0], [0, 68.7723334], [0, 0]] +LABEL=["Scale X", "Shear X", "Shear Y", "Scale Y", "Offset X", "Offset Y"] +PREC=3
