- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
Motion Set points
        John Holt edited this page Aug 12, 2020 
        ·
        21 revisions
      
    Wiki > The Backend System > IOCs > Motor IOCs > Motion Setpoints
Motion set points allow you to label set positions for a motor, current either 1 axis or 2 axes. The code for this is in support in the directory motionSetPoints. The configuration for a motion set point is in to parts:
- St file called 
motionsetpoints.cmdwhich sets up the db file which is stored in the configuration under the motor name:- galil is 
Settings\config\<host name>\configurations\galil - mclennan is 
Settings\config\<host name>\configurations\mcleanan - sm300 is 
Settings\config\<host name>\configurations\<sm300 ioc name e.g. SM300_01> 
 - galil is 
 - The positions which are referenced from the st file. are stored in  
Settings\config\<host name>\configurations\motionSetPoints 
The  motionsetpoints.cmd contains the following lines:
- 
Point at motion setpoint config: 
epicsEnvSet "LOOKUPFILE<X>" "$(ICPCONFIGROOT)/motionSetPoints/<motion setpoint file>" - 
Configure setpoints: 
motionSetPointsConfigure("LOOKUPFILE<X>","LOOKUPFILE<X>") - 
Load Motion Setpoint Records:
- 
For 1D setpoint not using an axis macros 
dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db","P=<motion set point prefix>,TARGET_PV1=<motor prefix>,TARGET_RBV1=<motor prefix>.RBV,TARGET_DONE=<motor prefix>.DMOV,TOL=<tolerance>,LOOKUP=LOOKUPFILE<X>") - 
For 2D setpoint not using an axis macro 
dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db","P=<motion set point prefix>,TARGET_PV1=<motor prefix>,TARGET_RBV1=<motor prefix>.RBV,TARGET_PV2=<motor prefix2>,TARGET_RBV2=<motor prefix2>.RBV,TARGET_DONE=<motor prefix>.DMOV,TARGET_DONE2=<motor prefix2>.DMOV,TOL=<tolerance>,LOOKUP=LOOKUPFILE<X>") - 
For 1D setpoints using an axis 
dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db","P=<motion set point prefix>,NAME1=<name1>,AXIS1=<axis1>,TOL=<tolerance>,LOOKUP=LOOKUPFILE<X>") - 
For 2D setpoints using axes 
dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db","P=<motion set point prefix>,NAME1=<name1>,AXIS1=<axis1>,NAME2=<name2>,AXIS2=<axis2>,TOL=<tolerance>,LOOKUP=LOOKUPFILE<X>") 
 - 
For 1D setpoint not using an axis macros 
 - 
Load In Position records: This is a 
dbLoadRecordLoopinstruction (one for eachdbLoadRecordsabove), which loads an extradbfile for one setpoint per iteration, which contains a record for indicating whether the motor is at this particular setpoint. The line should look as the corresponding line from above, except:- replace 
dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db"withdbLoadRecordsLoop("$(MOTIONSETPOINTS)/db/inPos.db" - add the loop arguments at the end (currently hardcoded), e.g.: 
LOOKUP=LOOKUPFILE<X>, "NUMPOS", 0, 30) 
 - replace 
 - A blank line at the end
 
Where:
- 
X- enumeration of lookup files, e.g. 1, 2 - 
motion setpoint file- the lookup motion setpoint file - 
motion set point prefix- the prefix you want to create for the motion setpoint, e.g.$(MYPVPREFIX)LKUP:MON3:,$(MYPVPREFIX)LKUP:SAMPLE:,$(MYPVPREFIX)LKUP:ANALYSER:(ending in a colon) - 
motor prefix- the prefix of the first/only motor e.g.$(MYPVPREFIX)MOT:MTR0601 - 
motor prefix2- the prefix of the second motor e.g.$(MYPVPREFIX)MOT:MTR0601,$(MYPVPREFIX)MOT:ANALYSER:THETA - 
tolerance- tolerance with which the position has to comply with the positions in the lookup file - 
axis1- the axis to use for the first/only motor e.g.$(MYPVPREFIX)MOT:SAMPLE:LIN - 
name1- the name of axis 1, e.g. "linear" (defaults toaxis1) - 
axis2- the axis to use for the second motor e.g.$(MYPVPREFIX)MOT:SAMPLE:ROT - 
name2- the name of axis 2, e.g. "rotational" (defaults toaxis2) 
For examples see Larmor, Demo or SANDALS.
The lookup motion setpoint file has the following format:
# Commnet, lines starting with hashes are comments
<label> <coord 1> <coord 2>
<label> <coord 1> <coord 2>
...
<label> <coord 1> <coord 2>
Field are separated by spaces. The fields are:
- `label` is the text label for the setpoint
- `coord 1` is the set point for the first/only motor
- `coord 2` is the set point of the second motor (or not included if it is 1D set point)
Often these files are calculated from xml files using the sample changer support module.
$(IFIOC_GALIL_04) epicsEnvSet "LOOKUPFILE1" "$(ICPCONFIGROOT)/motionSetPoints/monitor3.txt"
$(IFIOC_GALIL_04) motionSetPointsConfigure("LOOKUPFILE1","LOOKUPFILE1")
$(IFIOC_GALIL_04) dbLoadRecords("$(MOTIONSETPOINTS)/db/motionSetPoints.db","P=$(MYPVPREFIX)LKUP:MON3:,NAME1=linear,AXIS1=$(MYPVPREFIX)MOT:MONITOR3,TOL=0.1,LOOKUP=LOOKUPFILE1")
$(IFIOC_GALIL_04) dbLoadRecordsLoop("$(MOTIONSETPOINTS)/db/inPos.db","P=$(MYPVPREFIX)LKUP:MON3:,NAME1=linear,AXIS1=$(MYPVPREFIX)MOT:MONITOR3,TOL=0.1,LOOKUP=LOOKUPFILE1", "NUMPOS", 0, 2)
There are two motion set point OPIs:
- Motion Set Point (Few): For setpoints with only 3 or 4 positions
 - Motion Set Point: For setpoints with many positions