#!/bin/sh

caput FBCK:FB05:TR02:STATE 0

caput FBCK:FB05:TR02:TOTALPOI 1

# 5Hz
caput -a FBCK:FB05:TR02:POI1 21 0 0 0 0 0 0 0 64 0 0 55 0 0 0 0 0 0 0 0 0 0

# F matrix
caput -a FBCK:FB05:TR02:FMATRIX 50 1 0 0 0 3 0.97811 1.9127 0 0 3 0.12335 0.80696 0 0 3 1.65 -0.33597 0 0 3 3.1276 -0.39243 0 0 3 0 0 1 0 3 0 0 1.022 1.997 3 0 0 1.8976 4.2539 3 0 0 -0.17824 2.3499 3 0 0 -0.29402 1.5882 3 0 0 0 0 0 0 0 0 0

# G matrix
caput -a FBCK:FB05:TR02:GMATRIX 10 2.5181 2.8809 0 0 -0.33363 1.1087 0 0 0 0 -0.34556 2.3591 0 0 -0.5343 0.89322 0 0 0 0 
# Loop configs
caput FBCK:FB05:TR02:NAME InjectorLaunchFILE
caput FBCK:FB05:TR02:INSTALLED 1
caput FBCK:FB05:TR02:TOTALPOI 1
caput FBCK:FB05:TR02:ITERATEFUNC InjectorLaunch

# Measurements
caput FBCK:FB05:TR02:M1DEVNAME FILE:/data/TR02/BPMS:IN20:525:X
caput FBCK:FB05:TR02:M1USED 0
caput FBCK:FB05:TR02:M1CAMODE 0

caput FBCK:FB05:TR02:M2DEVNAME FILE:/data/TR02/BPMS:IN20:581:X
caput FBCK:FB05:TR02:M2USED 1
caput FBCK:FB05:TR02:M2CAMODE 0

caput FBCK:FB05:TR02:M3DEVNAME FILE:/data/TR02/BPMS:IN20:631:X
caput FBCK:FB05:TR02:M3USED 1
caput FBCK:FB05:TR02:M3CAMODE 0

caput FBCK:FB05:TR02:M4DEVNAME FILE:/data/TR02/BPMS:IN20:651:X
caput FBCK:FB05:TR02:M4USED 1
caput FBCK:FB05:TR02:M4CAMODE 0

caput FBCK:FB05:TR02:M5DEVNAME FILE:/data/TR02/BPMS:IN20:771:X
caput FBCK:FB05:TR02:M5USED 1
caput FBCK:FB05:TR02:M5CAMODE 0

caput FBCK:FB05:TR02:M6DEVNAME FILE:/data/TR02/BPMS:IN20:781:X
caput FBCK:FB05:TR02:M6USED 1
caput FBCK:FB05:TR02:M6CAMODE 0

#caput FBCK:FB05:TR02:M7DEVNAME FILE:/data/TR02/BPMS:IN20:925:X
#caput FBCK:FB05:TR02:M7USED 1
#caput FBCK:FB05:TR02:M7CAMODE 0

caput FBCK:FB05:TR02:M7DEVNAME FILE:/data/TR02/BPMS:IN20:525:Y
caput FBCK:FB05:TR02:M7USED 0
caput FBCK:FB05:TR02:M7CAMODE 0

caput FBCK:FB05:TR02:M8DEVNAME FILE:/data/TR02/BPMS:IN20:581:Y
caput FBCK:FB05:TR02:M8USED 1
caput FBCK:FB05:TR02:M8CAMODE 0

caput FBCK:FB05:TR02:M9DEVNAME FILE:/data/TR02/BPMS:IN20:631:Y
caput FBCK:FB05:TR02:M9USED 1
caput FBCK:FB05:TR02:M9CAMODE 0

caput FBCK:FB05:TR02:M10DEVNAME FILE:/data/TR02/BPMS:IN20:651:Y
caput FBCK:FB05:TR02:M10USED 1
caput FBCK:FB05:TR02:M10CAMODE 0

caput FBCK:FB05:TR02:M11DEVNAME FILE:/data/TR02/BPMS:IN20:771:Y
caput FBCK:FB05:TR02:M11USED 1
caput FBCK:FB05:TR02:M11CAMODE 0

caput FBCK:FB05:TR02:M12DEVNAME FILE:/data/TR02/BPMS:IN20:781:Y
caput FBCK:FB05:TR02:M12USED 1
caput FBCK:FB05:TR02:M12CAMODE 0

#caput FBCK:FB05:TR02:M14DEVNAME FILE:/data/TR02/BPMS:IN20:925:Y
#caput FBCK:FB05:TR02:M14USED 1
#caput FBCK:FB05:TR02:M14CAMODE 0

caput FBCK:FB05:TR02:M13USED 0
caput FBCK:FB05:TR02:M14USED 0
caput FBCK:FB05:TR02:M15USED 0
caput FBCK:FB05:TR02:M16USED 0
caput FBCK:FB05:TR02:M17USED 0
caput FBCK:FB05:TR02:M18USED 0
caput FBCK:FB05:TR02:M19USED 0
caput FBCK:FB05:TR02:M20USED 0
caput FBCK:FB05:TR02:M21USED 0
caput FBCK:FB05:TR02:M22USED 0
caput FBCK:FB05:TR02:M23USED 0
caput FBCK:FB05:TR02:M24USED 0
caput FBCK:FB05:TR02:M25USED 0
caput FBCK:FB05:TR02:M26USED 0
caput FBCK:FB05:TR02:M27USED 0
caput FBCK:FB05:TR02:M28USED 0
caput FBCK:FB05:TR02:M29USED 0
caput FBCK:FB05:TR02:M30USED 0
caput FBCK:FB05:TR02:M31USED 0
caput FBCK:FB05:TR02:M32USED 0
caput FBCK:FB05:TR02:M33USED 0
caput FBCK:FB05:TR02:M34USED 0
caput FBCK:FB05:TR02:M35USED 0
caput FBCK:FB05:TR02:M36USED 0
caput FBCK:FB05:TR02:M37USED 0
caput FBCK:FB05:TR02:M38USED 0
caput FBCK:FB05:TR02:M39USED 0
caput FBCK:FB05:TR02:M40USED 0

# Reference orbit
caput -a FBCK:FB05:TR02:REFORBIT 18 -0.0059313 -0.12648 -0.13236 0.051098 -0.082934 -0.10219 -0.0022403 -0.03867 0.10587 -0.16693 0 0 0 0 0 0 0 0 

# States
caput FBCK:FB05:TR02:S1NAME FILE:/data/TR02/XPos
caput FBCK:FB05:TR02:S1USED 1

caput FBCK:FB05:TR02:S2NAME FILE:/data/TR02/XAng
caput FBCK:FB05:TR02:S2USED 1

caput FBCK:FB05:TR02:S3NAME FILE:/data/TR02/YPos
caput FBCK:FB05:TR02:S3USED 1

caput FBCK:FB05:TR02:S4NAME FILE:/data/TR02/YAng
caput FBCK:FB05:TR02:S4USED 1

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

# Actuators
caput FBCK:FB05:TR02:A1DEVNAME FILE:/data/TR02/XCOR:IN20:381:BCTRL
caput FBCK:FB05:TR02:A1USED 1
caput FBCK:FB05:TR02:A1CAMODE 1

caput FBCK:FB05:TR02:A2DEVNAME FILE:/data/TR02/XCOR:IN20:521:BCTRL
caput FBCK:FB05:TR02:A2USED 1
caput FBCK:FB05:TR02:A2CAMODE 1

caput FBCK:FB05:TR02:A3DEVNAME FILE:/data/TR02/YCOR:IN20:382:BCTRL
caput FBCK:FB05:TR02:A3USED 1
caput FBCK:FB05:TR02:A3CAMODE 1

caput FBCK:FB05:TR02:A4DEVNAME FILE:/data/TR02/YCOR:IN20:522:BCTRL
caput FBCK:FB05:TR02:A4USED 1
caput FBCK:FB05:TR02:A4CAMODE 1

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

# Energy
caput -a FBCK:FB05:TR02:ACTENERGY 4 0.073564 0.135 0.073564 0.135

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

# Enable loop
caput FBCK:FB05:TR02:INSTALLED 1
caput FBCK:FB05:TR02:SAVE 1
caput FBCK:FB05:TR02:SAVE 0
#caput FBCK:FB05:TR02:STATE 1

