#!/bin/sh

caput FBCK:FB01:TR03:STATE 0

# 0.5 HZ
#caput -a FBCK:FB01:TR03:POI1 21 0 0 0 0 0 0 0 256 0 0 55 0 0 0 0 0 0 0 0 0 0

# 0.5 HZ, pockcel_perm
#caput -a FBCK:FB01:TR03:POI1 21 0 0 0 8 0 0 0 256 0 0 55 0 0 0 0 0 0 0 0 0 0

# 1 HZ, pockcel_perm
#caput -a FBCK:FB01:TR03:POI1 21 0 0 0 8 0 0 0 128 0 0 55 0 0 0 0 0 0 0 0 0 0

# 5 Hz, pockcel_perm
#caput -a FBCK:FB01:TR03:POI1 21 0 0 0 8 0 0 0 64 0 0 55 0 0 0 0 0 0 0 0 0 0

# 10 Hz, pockcel_perm
caput -a FBCK:FB01:TR03:POI1 21 0 0 0 8 0 0 0 32 0 0 55 0 0 0 0 0 0 0 0 0 0

# 10 Hz
#caput -a FBCK:FB01:TR03:POI1 21 0 0 0 0 0 0 0 32 0 0 55 0 0 0 0 0 0 0 0 0 0

# F matrix
caput -a FBCK:FB01:TR03:FMATRIX 10 1 0 0 0 0 0 0 1 0 0

# G matrix
caput -a FBCK:FB01:TR03:GMATRIX 4 7.5417 0 0 7.8864

# Loop configs
caput FBCK:FB01:TR03:NAME XCAV
caput FBCK:FB01:TR03:INSTALLED 1
caput FBCK:FB01:TR03:TOTALPOI 1
caput FBCK:FB01:TR03:ITERATEFUNC TrajectoryFit

# Measurements
caput FBCK:FB01:TR03:M1DEVNAME BPMS:LI21:201:X
#caput FBCK:FB01:TR03:M1DEVNAME FILE:/data/dat/BPMS:LI21:201:X
caput FBCK:FB01:TR03:M1USED 1
caput FBCK:FB01:TR03:M1CAMODE 0

caput FBCK:FB01:TR03:M2DEVNAME BPMS:LI21:201:Y
#caput FBCK:FB01:TR03:M2DEVNAME FILE:/data/dat/BPMS:LI21:201:Y
caput FBCK:FB01:TR03:M2USED 1
caput FBCK:FB01:TR03:M2CAMODE 0

caput FBCK:FB01:TR03:M3USED 0
caput FBCK:FB01:TR03:M4USED 0
caput FBCK:FB01:TR03:M5USED 0
caput FBCK:FB01:TR03:M6USED 0
caput FBCK:FB01:TR03:M7USED 0
caput FBCK:FB01:TR03:M8USED 0
caput FBCK:FB01:TR03:M9USED 0
caput FBCK:FB01:TR03:M10USED 0
caput FBCK:FB01:TR03:M11USED 0
caput FBCK:FB01:TR03:M12USED 0
caput FBCK:FB01:TR03:M13USED 0
caput FBCK:FB01:TR03:M14USED 0

# States
caput FBCK:FB01:TR03:S2NAME "X Position"
#caput FBCK:FB01:TR03:S1NAME FILE:/data/dat/X.Pos
caput FBCK:FB01:TR03:S1USED 1

caput FBCK:FB01:TR03:S2NAME "Y Position"
#caput FBCK:FB01:TR03:S2NAME FILE:/data/dat/Y.Pos
caput FBCK:FB01:TR03:S2USED 1

# Actuators
caput FBCK:FB01:TR03:A1DEVNAME XCOR:LI21:101:BCTRL
#caput FBCK:FB01:TR03:A1DEVNAME FILE:/data/dat/XCOR:LI21:101:BCTRL
caput FBCK:FB01:TR03:A1USED 1
caput FBCK:FB01:TR03:A1CAMODE 1

caput FBCK:FB01:TR03:A2DEVNAME YCOR:LI21:136:BCTRL
#caput FBCK:FB01:TR03:A2DEVNAME FILE:/data/dat/YCOR:LI21:136:BCTRL
caput FBCK:FB01:TR03:A2USED 1
caput FBCK:FB01:TR03:A2CAMODE 1

#enable loop
caput FBCK:FB01:TR03:INSTALLED 1

caput FBCK:FB01:TR03:MEASNUM 2
caput FBCK:FB01:TR03:STATENUM 2
caput FBCK:FB01:TR03:ACTNUM 2
caput FBCK:FB01:TR03:PGAIN 0.1

caput -a FBCK:FB01:TR03:REFORBIT 2 0.041736 0.028021
caput -a FBCK:FB01:TR03:ACTENERGY 2 0.141797 0.182819
