#!/bin/sh
# L2 Launch 
# BPMS -> File
# Magnets -> File
# Test multiple patterns!

caput FBCK:FB03:TR01:STATE 0

# 0.5 HZ, pockcel_perm
#caput -a FBCK:FB03:TR01:POI2 21 0 0 0 0 0 8 0 0 0 256 0 0 0 0 0 0 0 0 0 0 0

# 1 HZ, pockcel_perm, exclude 0.5 Hz
#caput -a FBCK:FB03:TR01:POI1 21 0 0 0 0 0 8 0 0 0 128 0 0 0 0 0 0 0 0 0 256 0

# 1 HZ, exclude 0.5 Hz
caput -a FBCK:FB03:TR01:POI1 21 0 0 0 0 0 0 0 0 0 128 0 0 54 0 0 0 0 0 0 256 0

# 0.5 HZ
caput -a FBCK:FB03:TR01:POI2 21 0 0 0 0 0 0 0 0 0 256 0 0 54 0 0 0 0 0 0 0 0

# F matrix
caput -a FBCK:FB03:TR01:FMATRIX 40 1 0 0 0 4 0.23918 10.3291 0 0 4 -0.64393 23.995 0 0 4 -0.36735 7.2518 0 0 4 0 0 1 0 4 0 0 1.4138 10.3347 4 0 0 -0.51264 4.9749 4 0 0 -1.2004 3.5638 4

# G matrix
caput -a FBCK:FB03:TR01:GMATRIX 16 5.7343 8.2411 0 0 -0.057862 0.23759 0 0 0 0 -2.0573 2.581 0 0 -0.92958 0.16559

# Loop configs
caput FBCK:FB03:TR01:NAME L2LaunchPOI
caput FBCK:FB03:TR01:INSTALLED 1
caput FBCK:FB03:TR01:TOTALPOI 2
caput FBCK:FB03:TR01:ITERATEFUNC TrajectoryFit

# Measurements
caput FBCK:FB03:TR01:M1DEVNAME FILE:/data/poi/m1
caput FBCK:FB03:TR01:M1USED 1
caput FBCK:FB03:TR01:M1CAMODE 0

caput FBCK:FB03:TR01:M2DEVNAME FILE:/data/poi/m2
caput FBCK:FB03:TR01:M2USED 1
caput FBCK:FB03:TR01:M2CAMODE 0

caput FBCK:FB03:TR01:M3DEVNAME FILE:/data/poi/m3
caput FBCK:FB03:TR01:M3USED 1
caput FBCK:FB03:TR01:M3CAMODE 0

caput FBCK:FB03:TR01:M4DEVNAME FILE:/data/poi/m4
caput FBCK:FB03:TR01:M4USED 1
caput FBCK:FB03:TR01:M4CAMODE 0

caput FBCK:FB03:TR01:M5DEVNAME FILE:/data/poi/m5
caput FBCK:FB03:TR01:M5USED 1
caput FBCK:FB03:TR01:M5CAMODE 0

caput FBCK:FB03:TR01:M6DEVNAME FILE:/data/poi/m6
caput FBCK:FB03:TR01:M6USED 1
caput FBCK:FB03:TR01:M6CAMODE 0

caput FBCK:FB03:TR01:M7DEVNAME FILE:/data/poi/m7
caput FBCK:FB03:TR01:M7USED 1
caput FBCK:FB03:TR01:M7CAMODE 0

caput FBCK:FB03:TR01:M8DEVNAME FILE:/data/poi/m8
caput FBCK:FB03:TR01:M8USED 1
caput FBCK:FB03:TR01:M8CAMODE 0

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

# Reference orbit
caput -a FBCK:FB03:TR01:REFORBIT 8 0 0 0 0 0 0 0 0

# States
caput FBCK:FB03:TR01:S1NAME FILE:/data/poi/s1
caput FBCK:FB03:TR01:S1USED 1

caput FBCK:FB03:TR01:S2NAME FILE:/data/poi/s2
caput FBCK:FB03:TR01:S2USED 1

caput FBCK:FB03:TR01:S3NAME FILE:/data/poi/s3
caput FBCK:FB03:TR01:S3USED 1

caput FBCK:FB03:TR01:S4NAME FILE:/data/poi/s4
caput FBCK:FB03:TR01:S4USED 1

# Actuators
caput FBCK:FB03:TR01:A1DEVNAME FILE:/data/poi/a1
caput FBCK:FB03:TR01:A1USED 1
caput FBCK:FB03:TR01:A1CAMODE 1

caput FBCK:FB03:TR01:A2DEVNAME FILE:/data/poi/a2
caput FBCK:FB03:TR01:A2USED 1
caput FBCK:FB03:TR01:A2CAMODE 1

caput FBCK:FB03:TR01:A3DEVNAME FILE:/data/poi/a3
caput FBCK:FB03:TR01:A3USED 1
caput FBCK:FB03:TR01:A3CAMODE 1

caput FBCK:FB03:TR01:A4DEVNAME FILE:/data/poi/a4
caput FBCK:FB03:TR01:A4USED 1
caput FBCK:FB03:TR01:A4CAMODE 1

# Energy
caput -a FBCK:FB03:TR01:ACTENERGY 4 0.25 0.25 0.25 0.25

# Must set these up in order to have the config app work
caput FBCK:FB03:TR01:MEASNUM 8
caput FBCK:FB03:TR01:ACTNUM 4
caput FBCK:FB03:TR01:STATENUM 4
caput FBCK:FB03:TR01:PGAIN 0.1

# Enable loop
caput FBCK:FB03:TR01:INSTALLED 1
####caput FBCK:FB03:TR01:STATE 1
