#!/bin/sh

caput FBCK:FB02:TR02:STATE 0

# 10 Hz, pockcel_perm
caput -a FBCK:FB02:TR02: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:FB02:TR02: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:FB02:TR02:FMATRIX 80 1 0 0 0 3 1.2336 12.0838 0 0 3 0.80216 17.442 0 0 3 0.80077 34.2755 0 0 3 0.52531 35.9228 0 0 3 0.48296 52.7549 0 0 3 0.14431 36.5211 0 0 3 -0.10361 41.0275 0 0 3 0 0 1 0 3 0 0 0.72412 12.0859 3 0 0 0.84202 30.3833 3 0 0 0.46929 32.9956 3 0 0 0.32778 45.9746 3 0 0 0.053231 39.0996 3 0 0 -0.17939 56.6196 3 0 0 -0.30464 42.04 3

# G matrix
caput -a FBCK:FB02:TR02:GMATRIX 16 40.6989 11.7045 0 0 0.26212 1.2272 0 0 0 0 57.6449 28.9045 0 0 -0.031785 0.82263

# Loop configs
caput FBCK:FB02:TR02:NAME L3
caput FBCK:FB02:TR02:INSTALLED 1
caput FBCK:FB02:TR02:TOTALPOI 1
caput FBCK:FB02:TR02:ITERATEFUNC TrajectoryFit

# Measurements
caput FBCK:FB02:TR02:M1DEVNAME BPMS:LI25:701:X
caput FBCK:FB02:TR02:M1USED 1
caput FBCK:FB02:TR02:M1CAMODE 1

caput FBCK:FB02:TR02:M2DEVNAME BPMS:LI25:801:X
caput FBCK:FB02:TR02:M2USED 1
caput FBCK:FB02:TR02:M2CAMODE 1

caput FBCK:FB02:TR02:M3DEVNAME BPMS:LI25:901:X
caput FBCK:FB02:TR02:M3USED 1
caput FBCK:FB02:TR02:M3CAMODE 1

caput FBCK:FB02:TR02:M4DEVNAME BPMS:LI26:201:X
caput FBCK:FB02:TR02:M4USED 1
caput FBCK:FB02:TR02:M4CAMODE 1

caput FBCK:FB02:TR02:M5DEVNAME BPMS:LI26:301:X
caput FBCK:FB02:TR02:M5USED 1
caput FBCK:FB02:TR02:M5CAMODE 1

caput FBCK:FB02:TR02:M6DEVNAME BPMS:LI26:401:X
caput FBCK:FB02:TR02:M6USED 1
caput FBCK:FB02:TR02:M6CAMODE 1

caput FBCK:FB02:TR02:M7DEVNAME BPMS:LI26:501:X
caput FBCK:FB02:TR02:M7USED 1
caput FBCK:FB02:TR02:M7CAMODE 1

caput FBCK:FB02:TR02:M8DEVNAME BPMS:LI26:601:X
caput FBCK:FB02:TR02:M8USED 1
caput FBCK:FB02:TR02:M8CAMODE 1

caput FBCK:FB02:TR02:M9DEVNAME BPMS:LI26:701:X
caput FBCK:FB02:TR02:M9USED 0
caput FBCK:FB02:TR02:M9CAMODE 1

caput FBCK:FB02:TR02:M10DEVNAME BPMS:LI26:801:X
caput FBCK:FB02:TR02:M10USED 0
caput FBCK:FB02:TR02:M10CAMODE 1

caput FBCK:FB02:TR02:M11DEVNAME BPMS:LI26:901:X
caput FBCK:FB02:TR02:M11USED 0
caput FBCK:FB02:TR02:M11CAMODE 1

caput FBCK:FB02:TR02:M12DEVNAME BPMS:LI27:301:X
caput FBCK:FB02:TR02:M12USED 0
caput FBCK:FB02:TR02:M12CAMODE 1

caput FBCK:FB02:TR02:M13DEVNAME BPMS:LI27:401:X
caput FBCK:FB02:TR02:M13USED 0
caput FBCK:FB02:TR02:M13CAMODE 1

caput FBCK:FB02:TR02:M14DEVNAME BPMS:LI27:701:X
caput FBCK:FB02:TR02:M14USED 0
caput FBCK:FB02:TR02:M14CAMODE 1

caput FBCK:FB02:TR02:M15DEVNAME BPMS:LI27:801:X
caput FBCK:FB02:TR02:M15USED 0
caput FBCK:FB02:TR02:M15CAMODE 1

caput FBCK:FB02:TR02:M16DEVNAME BPMS:LI25:701:Y
caput FBCK:FB02:TR02:M16USED 1
caput FBCK:FB02:TR02:M16CAMODE 1

caput FBCK:FB02:TR02:M17DEVNAME BPMS:LI25:801:Y
caput FBCK:FB02:TR02:M17USED 1
caput FBCK:FB02:TR02:M17CAMODE 1

caput FBCK:FB02:TR02:M18DEVNAME BPMS:LI25:901:Y
caput FBCK:FB02:TR02:M18USED 1
caput FBCK:FB02:TR02:M18CAMODE 1

caput FBCK:FB02:TR02:M19DEVNAME BPMS:LI26:201:Y
caput FBCK:FB02:TR02:M19USED 1
caput FBCK:FB02:TR02:M19CAMODE 1

caput FBCK:FB02:TR02:M20DEVNAME BPMS:LI26:301:Y
caput FBCK:FB02:TR02:M20USED 1
caput FBCK:FB02:TR02:M20CAMODE 1

caput FBCK:FB02:TR02:M21DEVNAME BPMS:LI26:401:Y
caput FBCK:FB02:TR02:M21USED 1
caput FBCK:FB02:TR02:M21CAMODE 1

caput FBCK:FB02:TR02:M22DEVNAME BPMS:LI26:501:Y
caput FBCK:FB02:TR02:M22USED 1
caput FBCK:FB02:TR02:M22CAMODE 1

caput FBCK:FB02:TR02:M23DEVNAME BPMS:LI26:601:Y
caput FBCK:FB02:TR02:M23USED 1
caput FBCK:FB02:TR02:M23CAMODE 1

caput FBCK:FB02:TR02:M24DEVNAME BPMS:LI26:701:Y
caput FBCK:FB02:TR02:M24USED 0
caput FBCK:FB02:TR02:M24CAMODE 1

caput FBCK:FB02:TR02:M25DEVNAME BPMS:LI26:801:Y
caput FBCK:FB02:TR02:M25USED 0
caput FBCK:FB02:TR02:M25CAMODE 1

caput FBCK:FB02:TR02:M26DEVNAME BPMS:LI26:901:Y
caput FBCK:FB02:TR02:M26USED 0
caput FBCK:FB02:TR02:M26CAMODE 1

caput FBCK:FB02:TR02:M27DEVNAME BPMS:LI27:301:Y
caput FBCK:FB02:TR02:M27USED 0
caput FBCK:FB02:TR02:M27CAMODE 1

caput FBCK:FB02:TR02:M28DEVNAME BPMS:LI27:401:Y
caput FBCK:FB02:TR02:M28USED 0
caput FBCK:FB02:TR02:M28CAMODE 1

caput FBCK:FB02:TR02:M29DEVNAME BPMS:LI27:701:Y
caput FBCK:FB02:TR02:M29USED 0
caput FBCK:FB02:TR02:M29CAMODE 1

caput FBCK:FB02:TR02:M30DEVNAME BPMS:LI27:801:Y
caput FBCK:FB02:TR02:M30USED 0
caput FBCK:FB02:TR02:M30CAMODE 1

caput FBCK:FB02:TR02:M31USED 0
caput FBCK:FB02:TR02:M32USED 0
caput FBCK:FB02:TR02:M33USED 0
caput FBCK:FB02:TR02:M34USED 0
caput FBCK:FB02:TR02:M35USED 0
caput FBCK:FB02:TR02:M36USED 0
caput FBCK:FB02:TR02:M37USED 0
caput FBCK:FB02:TR02:M38USED 0
caput FBCK:FB02:TR02:M39USED 0
caput FBCK:FB02:TR02:M40USED 0

# Reference orbit
caput -a FBCK:FB02:TR02:REFORBIT 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

# States
caput FBCK:FB02:TR02:S1NAME X Position
caput FBCK:FB02:TR02:S1USED 1

caput FBCK:FB02:TR02:S2NAME X Angle
caput FBCK:FB02:TR02:S2USED 1

caput FBCK:FB02:TR02:S3NAME Y Position
caput FBCK:FB02:TR02:S3USED 1

caput FBCK:FB02:TR02:S4NAME Y Angle
caput FBCK:FB02:TR02:S4USED 1

caput FBCK:FB02:TR02:S5USED 0
caput FBCK:FB02:TR02:S6USED 0
caput FBCK:FB02:TR02:S7USED 0
caput FBCK:FB02:TR02:S8USED 0
caput FBCK:FB02:TR02:S9USED 0
caput FBCK:FB02:TR02:S10USED 0

# Actuators
caput FBCK:FB02:TR02:A1DEVNAME XCOR:LI25:202:BCTRL
caput FBCK:FB02:TR02:A1USED 1
caput FBCK:FB02:TR02:A1CAMODE 1

caput FBCK:FB02:TR02:A2DEVNAME XCOR:LI25:602:BCTRL
caput FBCK:FB02:TR02:A2USED 1
caput FBCK:FB02:TR02:A2CAMODE 1

caput FBCK:FB02:TR02:A3DEVNAME YCOR:LI24:900:BCTRL
caput FBCK:FB02:TR02:A3USED 1
caput FBCK:FB02:TR02:A3CAMODE 1

caput FBCK:FB02:TR02:A4DEVNAME YCOR:LI25:503:BCTRL
caput FBCK:FB02:TR02:A4USED 1
caput FBCK:FB02:TR02:A4CAMODE 1

caput FBCK:FB02:TR02:A5CAMODE 0
caput FBCK:FB02:TR02:A6CAMODE 0
caput FBCK:FB02:TR02:A7CAMODE 0
caput FBCK:FB02:TR02:A8CAMODE 0
caput FBCK:FB02:TR02:A9CAMODE 0
caput FBCK:FB02:TR02:A10CAMODE 0

# Energy
caput -a FBCK:FB02:TR02:ACTENERGY 4 4.9108 5.7678 4.7127 5.5258

# Must set these up in order to have the config app work
caput FBCK:FB02:TR02:MEASNUM 30
caput FBCK:FB02:TR02:ACTNUM 4
caput FBCK:FB02:TR02:STATENUM 4
caput FBCK:FB02:TR02:PGAIN 0.1

# Enable loop
caput FBCK:FB02:TR02:INSTALLED 1
#caput FBCK:FB02:TR02:STATE 1

