#!/bin/sh

caput FBCK:FB02:TR03:STATE 0

# 10 Hz, pockcel_perm
caput -a FBCK:FB02: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:FB02: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:FB02:TR03:FMATRIX 30 1 0 0 0 3 1.005 88.1358 0 0 3 1.0052 89.646 0 0 3 0 0 1 0 0 0 0 0.99998 88.0959 3 0 0 0.99531 88.7723 3

# G matrix
caput -a FBCK:FB02:TR03:GMATRIX 16 36.4425 0.10685 0 0 1.0937 1 0 0 0 0 30.6792 -0.21656 0 0 0.92068 1

# Loop configs
caput FBCK:FB02:TR03:NAME BSYLaunch
caput FBCK:FB02:TR03:INSTALLED 1
caput FBCK:FB02:TR03:TOTALPOI 1
caput FBCK:FB02:TR03:ITERATEFUNC TrajectoryFit

# Measurements
caput FBCK:FB02:TR03:M1DEVNAME BPMS:BSY0:61:X
caput FBCK:FB02:TR03:M1USED 1
caput FBCK:FB02:TR03:M1CAMODE 0

caput FBCK:FB02:TR03:M2DEVNAME BPMS:BSY0:63:X
caput FBCK:FB02:TR03:M2USED 0
caput FBCK:FB02:TR03:M2CAMODE 0

caput FBCK:FB02:TR03:M3DEVNAME BPMS:BSY0:83:X
caput FBCK:FB02:TR03:M3USED 1
caput FBCK:FB02:TR03:M3CAMODE 0

caput FBCK:FB02:TR03:M4DEVNAME BPMS:BSY0:85:X
caput FBCK:FB02:TR03:M4USED 1
caput FBCK:FB02:TR03:M4CAMODE 0

caput FBCK:FB02:TR03:M5DEVNAME BPMS:BSY0:88:X
caput FBCK:FB02:TR03:M5USED 0
caput FBCK:FB02:TR03:M5CAMODE 0

caput FBCK:FB02:TR03:M6DEVNAME BPMS:BSY0:61:Y
caput FBCK:FB02:TR03:M6USED 1
caput FBCK:FB02:TR03:M6CAMODE 0

caput FBCK:FB02:TR03:M7DEVNAME BPMS:BSY0:63:Y
caput FBCK:FB02:TR03:M7USED 0
caput FBCK:FB02:TR03:M7CAMODE 0

caput FBCK:FB02:TR03:M8DEVNAME BPMS:BSY0:83:Y
caput FBCK:FB02:TR03:M8USED 1
caput FBCK:FB02:TR03:M8CAMODE 0

caput FBCK:FB02:TR03:M9DEVNAME BPMS:BSY0:85:Y
caput FBCK:FB02:TR03:M9USED 1
caput FBCK:FB02:TR03:M9CAMODE 0

caput FBCK:FB02:TR03:M10DEVNAME BPMS:BSY0:88:Y
caput FBCK:FB02:TR03:M10USED 0
caput FBCK:FB02:TR03:M10CAMODE 0

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

# Reference orbit
caput -a FBCK:FB02:TR03: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:FB02:TR03:S1NAME X Position
caput FBCK:FB02:TR03:S1USED 1

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

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

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

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

# Actuators
caput FBCK:FB02:TR03:A1DEVNAME XCOR:BSY0:34:BCTRL
caput FBCK:FB02:TR03:A1USED 1
caput FBCK:FB02:TR03:A1CAMODE 1

caput FBCK:FB02:TR03:A2DEVNAME XCOR:BSY0:60:BCTRL
caput FBCK:FB02:TR03:A2USED 1
caput FBCK:FB02:TR03:A2CAMODE 1

caput FBCK:FB02:TR03:A3DEVNAME YCOR:BSY0:35:BCTRL
caput FBCK:FB02:TR03:A3USED 1
caput FBCK:FB02:TR03:A3CAMODE 1

caput FBCK:FB02:TR03:A4DEVNAME YCOR:BSY0:62:BCTRL
caput FBCK:FB02:TR03:A4USED 1
caput FBCK:FB02:TR03:A4CAMODE 1

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

# Energy
caput -a FBCK:FB02:TR03:ACTENERGY 4 14.162 14.162 14.162 14.162

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

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

