esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

KB_MIRROR.MAC
See other macros in category: Positioning
Description:
    Define height and tilt pseudomotors for KB mirror
Documentation:
    DESCRIPTION
      A kb mirror is controlled typically by two rotation motors. 
      One, main rotation, is located at the middle of the mirror
      while a second one is set in an eccentric point. The
      combination of both allows to drive the mirror (the center
      of it) to a certain 'tilt' angle and 'height' (for vertically
      positioned mirrors, but we will use the 'height' term for 
      all mirrors). 
    
      This macro set supports both pseudo motor style definition
      or macro motors directly in spec.
    
      Rotation angles are in milli-radians, distance in millimeters
    
      For pseudo motors:
      ------------------
         Define tilt and height motors as controller NONE in spec config
    
         In setup, for each mirror, add a line like:
              mirrorsetup kbrot kbecrot kbtilt kbhgt 85 
    
         (in the example 85 is the distance between the two rotation points)
    
      For macro motors:
      ----------------- 
         Add a MAC_MOT motor controller in spec config. 
                 Device field = "kb"
    
         Add motors tilt and height in config with controller pointing to
            MAC_MOT "kb" controller
    
         Set channels as: 
            channel 0 = tilt
            channel 1 = height
    
         Add !! manually !! in config files MOT_PAR lines to the
            tilt (channel 0) motor. (Just add lines after MOTXXX line
            correspoding to tilt motor
    
         MOTPAR:distance = 85 
         MOTPAR:kbrot = kbrot  
         MOTPAR:kbecrot = kbecrot  
    
         (in the example kbrot and kbecrot are the mnemonics for
          real motors (rotation and eccentric rotation). 85 is the
          distance between the two rotation points )
         
         Remember that one single kb motor controller is needed for
         several mirrors.  In that case it is necessary to define the
         module field in the unit/mod/chan parameter in the motor
         configuration in spec config. 
    


    DEPENDENCIES
    The file kb_mirror.mac has to be loaded ! done in idxxsetup.mac (This file needs pseudo.mac stlocal.mac)

Macros:
    mirrorsetup
    Usage: mirrorsetup <motor1> <motor2> <tilt> <offset> <distance>
    This macro allow to configure pseudo motors to control a KB-Mirror.
    A Kb_mirror is made with 2 motors mounted in leving-arm mode, one in the middle position of the mirror and one at the left side of the mirror:
    motor1 does a pure rotation of the mirror and motor2 does a kind of translation.
    So the mirror is rotated by moving m1 and tilt position = m2+m1.
    So the mirror is translated by moving first m1 of +delta and m2 of -delta and offset position = - m2 .

    m2 and m1 have to be configured in mradian unit and with a clokwise rotation.
                  X-Ray             
        <-------------------------- 
            <-  d   ->               
           o=========o==========     
           |         |               
           |         |               
           | <==     |<==           
           | m2        m1            
         ==== base                   
    
    Note: with small mirror check how the motor m1 is mounted and its position motion direction. on BM05 m1 moves the mirror in the opposite direction of m2. So the SPEC sign into the config is -1. long mirror is "correctly" mounted.

    mirrorunsetup
    Usage: mirrorunsetup <tilt> <offset>


Internal Macros:
    mirror_getangle
    Usage: mirror_getangle


    mirror_getheight
    Usage: mirror_getheight


    mirror_moveangle
    Usage: mirror_moveangle


    mirror_moveheight
    Usage: mirror_moveheight


    mirror_setuser
    Usage: mirror_setuser


    mirror_pdef
    Usage: mirror_pdef


    kb_config
    Usage: kb_config(mne,type,unit,module,chan)


    kb_calc
    Usage: kb_calc(mne,mode)


Filename: kb_mirror.mac
Author: KB_MIRROR.MAC
Last mod.: 13/01/2020 16:29 by ahoms