#!/bin/sh
# LTU Feedback

caput FBCK:FB02:TR02:STATE 0

# 10 Hz, pockcel_perm
caput -a FBCK:FB02:TR02:POI1 21 0 0 0 0 0 8 0 0 0 32 0 0 54 0 0 0 0 0 0 0 0

# F matrix
caput -a FBCK:FB02:TR02:FMATRIX 20 1 0 0 0 3 0.23827 10.9815 0 0 3 -1.1693 20.1173 0 0 3 -3.4697 44.6116 0 0 3 -3.1147 34.9654 0 0 3 0 0 1 0 3 0 0.00049525 1.7651 11.1121 3 -0.00010161 0.0010574 4.3439 37.3343 3 -0.00010916 0.0011588 3.6038 35.0322 3 -0.0001864 0.0019898 5.6193 59.5173 3

# G matrix
caput -a FBCK:FB02:TR02:GMATRIX 16 -13.8057 -15.7795 0 0 -0.030877 -1.3951 0 0 -0.0041469 0 -36.1979 8.6777 0.00021016 0 2.0431 -2.0813

# Loop configs
caput FBCK:FB02:TR02:NAME LTU
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:LTU1:680:X
caput FBCK:FB02:TR02:M1USED 1
caput FBCK:FB02:TR02:M1CAMODE 0

caput FBCK:FB02:TR02:M2DEVNAME BPMS:LTU1:720:X
caput FBCK:FB02:TR02:M2USED 1
caput FBCK:FB02:TR02:M2CAMODE 0

caput FBCK:FB02:TR02:M3DEVNAME BPMS:LTU1:730:X
caput FBCK:FB02:TR02:M3USED 1
caput FBCK:FB02:TR02:M3CAMODE 0

caput FBCK:FB02:TR02:M4DEVNAME BPMS:LTU1:740:X
caput FBCK:FB02:TR02:M4USED 1
caput FBCK:FB02:TR02:M4CAMODE 0

caput FBCK:FB02:TR02:M5DEVNAME BPMS:LTU1:750:X
caput FBCK:FB02:TR02:M5USED 1
caput FBCK:FB02:TR02:M5CAMODE 0

caput FBCK:FB02:TR02:M6DEVNAME BPMS:LTU1:680:Y
caput FBCK:FB02:TR02:M6USED 1
caput FBCK:FB02:TR02:M6CAMODE 0

caput FBCK:FB02:TR02:M7DEVNAME BPMS:LTU1:720:Y
caput FBCK:FB02:TR02:M7USED 1
caput FBCK:FB02:TR02:M7CAMODE 0

caput FBCK:FB02:TR02:M8DEVNAME BPMS:LTU1:730:Y
caput FBCK:FB02:TR02:M8USED 1
caput FBCK:FB02:TR02:M8CAMODE 0

caput FBCK:FB02:TR02:M9DEVNAME BPMS:LTU1:740:Y
caput FBCK:FB02:TR02:M9USED 1
caput FBCK:FB02:TR02:M9CAMODE 0

caput FBCK:FB02:TR02:M10DEVNAME BPMS:LTU1:750:Y
caput FBCK:FB02:TR02:M10USED 1
caput FBCK:FB02:TR02:M10CAMODE 0

caput FBCK:FB02:TR02:M11USED 0
caput FBCK:FB02:TR02:M12USED 0
caput FBCK:FB02:TR02:M13USED 0
caput FBCK:FB02:TR02:M14USED 0
caput FBCK:FB02:TR02:M15USED 0
caput FBCK:FB02:TR02:M16USED 0
caput FBCK:FB02:TR02:M17USED 0
caput FBCK:FB02:TR02:M18USED 0
caput FBCK:FB02:TR02:M19USED 0
caput FBCK:FB02:TR02:M20USED 0
caput FBCK:FB02:TR02:M21USED 0
caput FBCK:FB02:TR02:M22USED 0
caput FBCK:FB02:TR02:M23USED 0
caput FBCK:FB02:TR02:M24USED 0
caput FBCK:FB02:TR02:M25USED 0
caput FBCK:FB02:TR02:M26USED 0
caput FBCK:FB02:TR02:M27USED 0
caput FBCK:FB02:TR02:M28USED 0
caput FBCK:FB02:TR02:M29USED 0
caput FBCK:FB02:TR02:M30USED 0
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 10 0.034457 -0.0056456 0.11192 0.0092363 -0.0043691 0.0082139 -0.0039589 -0.038692 -0.090839 -0.012567
caput -a FBCK:FB02:TR02:REFORBIT 10 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

# Actuators
caput FBCK:FB02:TR02:A1DEVNAME NULL
caput FBCK:FB02:TR02:A1USED 1
caput FBCK:FB02:TR02:A1CAMODE 0

caput FBCK:FB02:TR02:A2DEVNAME NULL
caput FBCK:FB02:TR02:A2USED 1
caput FBCK:FB02:TR02:A2CAMODE 0

caput FBCK:FB02:TR02:A3DEVNAME NULL
caput FBCK:FB02:TR02:A3USED 1
caput FBCK:FB02:TR02:A3CAMODE 0

caput FBCK:FB02:TR02:A4DEVNAME NULL
caput FBCK:FB02:TR02:A4USED 1
caput FBCK:FB02:TR02:A4CAMODE 0

# Energy
caput -a FBCK:FB02:TR02:ACTENERGY 4 4.3 4.3 4.3 4.3

# Must set these up in order to have the config app work
caput FBCK:FB02:TR02:MEASNUM 10
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
