#!/bin/sh

caput FBCK:FB01:TR01:STATE 0

# 10 Hz, pockcel_perm
caput -a FBCK:FB01:TR01: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:FB01:TR01: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:FB01:TR01:FMATRIX 10 1 0 0 0 0 0 0 1 0 0

# G matrix
caput -a FBCK:FB01:TR01:GMATRIX 4 0.86211 0 0 0.55455

# Loop configs
caput FBCK:FB01:TR01:NAME GunLaunch
caput FBCK:FB01:TR01:INSTALLED 1
caput FBCK:FB01:TR01:TOTALPOI 1
caput FBCK:FB01:TR01:ITERATEFUNC TrajectoryFit

# Measurements
caput FBCK:FB01:TR01:M1DEVNAME BPMS:IN20:371:X
caput FBCK:FB01:TR01:M1USED 1
caput FBCK:FB01:TR01:M1CAMODE 0

caput FBCK:FB01:TR01:M2DEVNAME BPMS:IN20:425:X
caput FBCK:FB01:TR01:M2USED 0
caput FBCK:FB01:TR01:M2CAMODE 0

caput FBCK:FB01:TR01:M3DEVNAME BPMS:IN20:511:X
caput FBCK:FB01:TR01:M3USED 0
caput FBCK:FB01:TR01:M3CAMODE 0

caput FBCK:FB01:TR01:M4DEVNAME BPMS:IN20:525:X
caput FBCK:FB01:TR01:M4USED 0
caput FBCK:FB01:TR01:M4CAMODE 0

caput FBCK:FB01:TR01:M5DEVNAME BPMS:IN20:581:X
caput FBCK:FB01:TR01:M5USED 0
caput FBCK:FB01:TR01:M5CAMODE 0

caput FBCK:FB01:TR01:M6DEVNAME BPMS:IN20:631:X
caput FBCK:FB01:TR01:M6USED 0
caput FBCK:FB01:TR01:M6CAMODE 0

caput FBCK:FB01:TR01:M7DEVNAME BPMS:IN20:651:X
caput FBCK:FB01:TR01:M7USED 0
caput FBCK:FB01:TR01:M7CAMODE 0

caput FBCK:FB01:TR01:M8DEVNAME BPMS:IN20:371:Y
caput FBCK:FB01:TR01:M8USED 1
caput FBCK:FB01:TR01:M8CAMODE 0

caput FBCK:FB01:TR01:M9DEVNAME BPMS:IN20:425:Y
caput FBCK:FB01:TR01:M9USED 0
caput FBCK:FB01:TR01:M9CAMODE 0

caput FBCK:FB01:TR01:M10DEVNAME BPMS:IN20:511:Y
caput FBCK:FB01:TR01:M10USED 0
caput FBCK:FB01:TR01:M10CAMODE 0

caput FBCK:FB01:TR01:M11DEVNAME BPMS:IN20:525:Y
caput FBCK:FB01:TR01:M11USED 0
caput FBCK:FB01:TR01:M11CAMODE 0

caput FBCK:FB01:TR01:M12DEVNAME BPMS:IN20:581:Y
caput FBCK:FB01:TR01:M12USED 0
caput FBCK:FB01:TR01:M12CAMODE 0

caput FBCK:FB01:TR01:M13DEVNAME BPMS:IN20:631:Y
caput FBCK:FB01:TR01:M13USED 0
caput FBCK:FB01:TR01:M13CAMODE 0

caput FBCK:FB01:TR01:M14DEVNAME BPMS:IN20:651:Y
caput FBCK:FB01:TR01:M14USED 0
caput FBCK:FB01:TR01:M14CAMODE 0

# States
caput FBCK:FB01:TR01:S1NAME "X Position"
caput FBCK:FB01:TR01:S1USED 1

caput FBCK:FB01:TR01:S2NAME "X Angle"
caput FBCK:FB01:TR01:S2USED 0

caput FBCK:FB01:TR01:S3NAME "Y Position"
caput FBCK:FB01:TR01:S3USED 1

caput FBCK:FB01:TR01:S4NAME "Y Angle"
caput FBCK:FB01:TR01:S4USED 0

# Actuators
caput FBCK:FB01:TR01:A1DEVNAME XCOR:IN20:221:BCTRL
#caput FBCK:FB01:TR01:A1DEVNAME FILE:/tmp/XCOR.221.BCTRL
caput FBCK:FB01:TR01:A1USED 1
caput FBCK:FB01:TR01:A1CAMODE 1

caput FBCK:FB01:TR01:A2DEVNAME YCOR:IN20:222:BCTRL
#caput FBCK:FB01:TR01:A2DEVNAME FILE:/tmp/YCOR.222.BCTRL
caput FBCK:FB01:TR01:A2USED 1
caput FBCK:FB01:TR01:A2CAMODE 1

caput FBCK:FB01:TR01:A3DEVNAME XCOR:IN20:311:BCTRL
caput FBCK:FB01:TR01:A3USED 0
caput FBCK:FB01:TR01:A3CAMODE 1

caput FBCK:FB01:TR01:A4DEVNAME YCOR:IN20:312:BCTRL
caput FBCK:FB01:TR01:A4USED 0
caput FBCK:FB01:TR01:A4CAMODE 1

#enable loop
caput FBCK:FB01:TR01:INSTALLED 1

caput FBCK:FB01:TR01:MEASNUM 14
caput FBCK:FB01:TR01:STATENUM 4
caput FBCK:FB01:TR01:ACTNUM 4
caput FBCK:FB01:TR01:PGAIN 0.1

caput -a FBCK:FB01:TR01:REFORBIT 4 -0.00018446 -0.000515 0.00079812 0.0006594
caput -a FBCK:FB01:TR01:ACTENERGY 4 0.006 0.006 0.006 0.006
