/* Generated with snc from LaserSteering.i */ /* Program "LaserSteering" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 107 "../LaserSteering.st" double cam_C1_h_err; # line 109 "../LaserSteering.st" double cam_C1_h_err_avg; # line 111 "../LaserSteering.st" double cam_C1_v_err; # line 113 "../LaserSteering.st" double cam_C1_v_err_avg; # line 115 "../LaserSteering.st" double cam_C1_dark_img; # line 119 "../LaserSteering.st" double cam_C1_splt_img; # line 123 "../LaserSteering.st" double cam_C2_h_err; # line 125 "../LaserSteering.st" double cam_C2_h_err_avg; # line 127 "../LaserSteering.st" double cam_C2_v_err; # line 129 "../LaserSteering.st" double cam_C2_v_err_avg; # line 131 "../LaserSteering.st" double cam_C2_dark_img; # line 135 "../LaserSteering.st" double cam_C2_splt_img; # line 139 "../LaserSteering.st" double cam_VCC_h_err; # line 141 "../LaserSteering.st" double cam_VCC_h_err_avg; # line 143 "../LaserSteering.st" double cam_VCC_v_err; # line 145 "../LaserSteering.st" double cam_VCC_v_err_avg; # line 147 "../LaserSteering.st" double cam_VCC_dark_img; # line 151 "../LaserSteering.st" double cam_VCC_splt_img; # line 156 "../LaserSteering.st" unsigned int loop1_fdbk_enbl; # line 160 "../LaserSteering.st" double loop1_adj_min; # line 164 "../LaserSteering.st" double loop1_adj_max; # line 168 "../LaserSteering.st" unsigned int loop2_fdbk_enbl; # line 172 "../LaserSteering.st" double loop2_adj_min; # line 176 "../LaserSteering.st" double loop2_adj_max; # line 181 "../LaserSteering.st" unsigned short feedback_status; # line 186 "../LaserSteering.st" unsigned short CHECK_TIMES; # line 191 "../LaserSteering.st" double m18h_adjustment; # line 194 "../LaserSteering.st" double m18h_calc_dest; # line 195 "../LaserSteering.st" double m18h_dest; # line 198 "../LaserSteering.st" double m18h_pos; # line 202 "../LaserSteering.st" unsigned int m18h_moving; # line 206 "../LaserSteering.st" double m18h_dhlm; # line 210 "../LaserSteering.st" double m18h_dllm; # line 215 "../LaserSteering.st" double m18v_adjustment; # line 218 "../LaserSteering.st" double m18v_calc_dest; # line 219 "../LaserSteering.st" double m18v_dest; # line 222 "../LaserSteering.st" double m18v_pos; # line 226 "../LaserSteering.st" unsigned int m18v_moving; # line 230 "../LaserSteering.st" double m18v_dhlm; # line 234 "../LaserSteering.st" double m18v_dllm; # line 239 "../LaserSteering.st" double m17h_adjustment; # line 242 "../LaserSteering.st" double m17h_calc_dest; # line 243 "../LaserSteering.st" double m17h_dest; # line 246 "../LaserSteering.st" double m17h_pos; # line 250 "../LaserSteering.st" unsigned int m17h_moving; # line 254 "../LaserSteering.st" double m17h_dhlm; # line 258 "../LaserSteering.st" double m17h_dllm; # line 263 "../LaserSteering.st" double m17v_adjustment; # line 266 "../LaserSteering.st" double m17v_calc_dest; # line 267 "../LaserSteering.st" double m17v_dest; # line 270 "../LaserSteering.st" double m17v_pos; # line 274 "../LaserSteering.st" unsigned int m17v_moving; # line 278 "../LaserSteering.st" double m17v_dhlm; # line 282 "../LaserSteering.st" double m17v_dllm; # line 287 "../LaserSteering.st" double m2h_adjustment; # line 290 "../LaserSteering.st" double m2h_calc_dest; # line 291 "../LaserSteering.st" double m2h_dest; # line 294 "../LaserSteering.st" double m2h_pos; # line 298 "../LaserSteering.st" unsigned int m2h_moving; # line 302 "../LaserSteering.st" double m2h_dhlm; # line 306 "../LaserSteering.st" double m2h_dllm; # line 311 "../LaserSteering.st" double m2v_adjustment; # line 314 "../LaserSteering.st" double m2v_calc_dest; # line 315 "../LaserSteering.st" double m2v_dest; # line 318 "../LaserSteering.st" double m2v_pos; # line 322 "../LaserSteering.st" unsigned int m2v_moving; # line 326 "../LaserSteering.st" double m2v_dhlm; # line 330 "../LaserSteering.st" double m2v_dllm; # line 338 "../LaserSteering.st" double var_loop1Gain_C1; # line 339 "../LaserSteering.st" double var_loop1Gain_C2; # line 340 "../LaserSteering.st" double var_loop1Deadband_C1; # line 341 "../LaserSteering.st" double var_loop1Deadband_C2; # line 342 "../LaserSteering.st" unsigned int var_loop1Reset; # line 343 "../LaserSteering.st" unsigned int DEBUG; # line 360 "../LaserSteering.st" double var_loop1InitPosition_m18h; # line 361 "../LaserSteering.st" double var_loop1InitPosition_m18v; # line 362 "../LaserSteering.st" double var_loop1InitPosition_m17h; # line 363 "../LaserSteering.st" double var_loop1InitPosition_m17v; # line 365 "../LaserSteering.st" double var_loop1ErrorAccumulator_C1h; # line 366 "../LaserSteering.st" double var_loop1ErrorAccumulator_C1v; # line 367 "../LaserSteering.st" double var_loop1ErrorAccumulator_C2h; # line 368 "../LaserSteering.st" double var_loop1ErrorAccumulator_C2v; # line 370 "../LaserSteering.st" int var_internalReset; # line 372 "../LaserSteering.st" long tempum1; # line 375 "../LaserSteering.st" int loop; # line 376 "../LaserSteering.st" int i; # line 377 "../LaserSteering.st" int j; # line 378 "../LaserSteering.st" int tempum; # line 380 "../LaserSteering.st" int dest_in_range; # line 381 "../LaserSteering.st" double loop1_max_drift; # line 382 "../LaserSteering.st" double loop2_max_drift; # line 395 "../LaserSteering.st" float LOOP1_DECPL_MTRX[4][4]; # line 396 "../LaserSteering.st" float LOOP2_DECPL_MTRX[2][2]; }; /* C code definitions */ # line 88 "../LaserSteering.st" #include "string.h" # line 89 "../LaserSteering.st" #include "math.h" # line 90 "../LaserSteering.st" #include "epicsTime.h" /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}, {{0,0},{0,0}}, }; *pVar = pVarInit; } /****** Code for state "initialization" in state set "laser_stabilization" ******/ /* Delay function for state "initialization" in state set "laser_stabilization" */ static void D_laser_stabilization_initialization(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "initialization" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_initialization(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { if (TRUE) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "initialization" in state set "laser_stabilization" */ static void A_laser_stabilization_initialization(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 467 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[0][0] = -0.3988; # line 468 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[0][1] = 0.0275; # line 469 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[0][2] = 0.0000; # line 470 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[0][3] = 0.0000; # line 472 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[1][0] = -0.0405; # line 473 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[1][1] = 0.5418; # line 474 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[1][2] = 0.0000; # line 475 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[1][3] = 0.0000; # line 477 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[2][0] = -0.4588; # line 478 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[2][1] = 0.0223; # line 479 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[2][2] = 0.0297; # line 480 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[2][3] = -0.0011; # line 482 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[3][0] = 0.0363; # line 483 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[3][1] = -0.6240; # line 484 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[3][2] = -0.0008; # line 485 "../LaserSteering.st" pVar->LOOP1_DECPL_MTRX[3][3] = -0.0425; # line 487 "../LaserSteering.st" pVar->LOOP2_DECPL_MTRX[0][0] = 0.04535; # line 488 "../LaserSteering.st" pVar->LOOP2_DECPL_MTRX[0][1] = -0.00155; # line 490 "../LaserSteering.st" pVar->LOOP2_DECPL_MTRX[1][0] = -0.00040; # line 491 "../LaserSteering.st" pVar->LOOP2_DECPL_MTRX[1][1] = -0.07035; # line 495 "../LaserSteering.st" pVar->var_loop1InitPosition_m18h = pVar->m18h_pos; # line 496 "../LaserSteering.st" pVar->var_loop1InitPosition_m18v = pVar->m18v_pos; # line 497 "../LaserSteering.st" pVar->var_loop1InitPosition_m17h = pVar->m17h_pos; # line 498 "../LaserSteering.st" pVar->var_loop1InitPosition_m17v = pVar->m17v_pos; # line 500 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1h = 0.0; # line 501 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1v = 0.0; # line 502 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2h = 0.0; # line 503 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2v = 0.0; # line 505 "../LaserSteering.st" pVar->var_internalReset = 0; # line 508 "../LaserSteering.st" pVar->feedback_status = 0; # line 509 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); # line 511 "../LaserSteering.st" if (pVar->DEBUG) # line 514 "../LaserSteering.st" printf("initialization: init pos, m18h = %lf, m18v = %lf, m17h = %lf, m17v = %lf\n", pVar->var_loop1InitPosition_m18h, pVar->var_loop1InitPosition_m18v, pVar->var_loop1InitPosition_m17h, pVar->var_loop1InitPosition_m17v); } return; } } /****** Code for state "idle" in state set "laser_stabilization" ******/ /* Entry function for state "idle" in state set "laser_stabilization" */ static void I_laser_stabilization_idle(SS_ID ssId, struct UserVar *pVar) { # line 525 "../LaserSteering.st" if (pVar->DEBUG) # line 525 "../LaserSteering.st" printf("idle: entry\n"); # line 528 "../LaserSteering.st" if (pVar->var_loop1Reset != 0 || !pVar->loop1_fdbk_enbl || pVar->var_internalReset) { # line 531 "../LaserSteering.st" pVar->var_loop1InitPosition_m18h = pVar->m18h_pos; # line 532 "../LaserSteering.st" pVar->var_loop1InitPosition_m18v = pVar->m18v_pos; # line 533 "../LaserSteering.st" pVar->var_loop1InitPosition_m17h = pVar->m17h_pos; # line 534 "../LaserSteering.st" pVar->var_loop1InitPosition_m17v = pVar->m17v_pos; # line 536 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1h = 0.0; # line 537 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1v = 0.0; # line 538 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2h = 0.0; # line 539 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2v = 0.0; # line 542 "../LaserSteering.st" pVar->var_loop1Reset = 0; # line 543 "../LaserSteering.st" seq_pvPut(ssId, 60/*var_loop1Reset*/, 0); # line 545 "../LaserSteering.st" if (pVar->DEBUG) # line 548 "../LaserSteering.st" printf("idle: entry - reset, init pos, m18h = %lf, m18v = %lf, m17h = %lf, m17v = %lf\n", pVar->var_loop1InitPosition_m18h, pVar->var_loop1InitPosition_m18v, pVar->var_loop1InitPosition_m17h, pVar->var_loop1InitPosition_m17v); } } /* Delay function for state "idle" in state set "laser_stabilization" */ static void D_laser_stabilization_idle(SS_ID ssId, struct UserVar *pVar) { # line 553 "../LaserSteering.st" seq_delayInit(ssId, 0, ((0.2))); } /* Event function for state "idle" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_idle(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 553 "../LaserSteering.st" if (seq_delay(ssId, 0)) { *pNextState = 2; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "idle" in state set "laser_stabilization" */ static void A_laser_stabilization_idle(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 556 "../LaserSteering.st" pVar->feedback_status = 0; # line 557 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; } } /****** Code for state "loop1_check_motor" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_check_motor" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_check_motor(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop1_check_motor" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_check_motor(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 567 "../LaserSteering.st" if ((!pVar->m18h_moving) && (!pVar->m18v_moving) && (!pVar->m17h_moving) && (!pVar->m17v_moving)) { *pNextState = 3; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop1_check_motor" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_check_motor(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 569 "../LaserSteering.st" if (pVar->DEBUG) # line 569 "../LaserSteering.st" printf("loop1_check_motor\n"); # line 572 "../LaserSteering.st" pVar->loop = 0; # line 573 "../LaserSteering.st" pVar->cam_C1_h_err_avg = 0; # line 574 "../LaserSteering.st" pVar->cam_C1_v_err_avg = 0; # line 575 "../LaserSteering.st" pVar->cam_C2_h_err_avg = 0; # line 576 "../LaserSteering.st" pVar->cam_C2_v_err_avg = 0; } return; } } /****** Code for state "loop1_check_centroid" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_check_centroid" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_check_centroid(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop1_check_centroid" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_check_centroid(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 585 "../LaserSteering.st" if (seq_pvGet(ssId, 0/*cam_C1_h_err*/, 0) != pvStatOK || seq_pvGet(ssId, 1/*cam_C1_v_err*/, 0) != pvStatOK || seq_pvGet(ssId, 4/*cam_C2_h_err*/, 0) != pvStatOK || seq_pvGet(ssId, 5/*cam_C2_v_err*/, 0) != pvStatOK) { *pNextState = 10; *pTransNum = 0; return TRUE; } # line 592 "../LaserSteering.st" if (pVar->cam_C1_dark_img || pVar->cam_C1_splt_img || pVar->cam_C2_dark_img || pVar->cam_C2_splt_img) { *pNextState = 10; *pTransNum = 1; return TRUE; } # line 599 "../LaserSteering.st" if (seq_pvGet(ssId, 0/*cam_C1_h_err*/, 0) == pvStatOK && seq_pvGet(ssId, 1/*cam_C1_v_err*/, 0) == pvStatOK && seq_pvGet(ssId, 4/*cam_C2_h_err*/, 0) == pvStatOK && seq_pvGet(ssId, 5/*cam_C2_v_err*/, 0) == pvStatOK) { *pNextState = 4; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "loop1_check_centroid" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_check_centroid(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 588 "../LaserSteering.st" pVar->feedback_status = 1; # line 589 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { # line 595 "../LaserSteering.st" pVar->feedback_status = 11; # line 596 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 2: { # line 601 "../LaserSteering.st" if (pVar->DEBUG) # line 601 "../LaserSteering.st" printf("loop1_check_centroid: average index %d\n", pVar->loop); # line 603 "../LaserSteering.st" pVar->cam_C1_h_err_avg += pVar->cam_C1_h_err; # line 604 "../LaserSteering.st" pVar->cam_C1_v_err_avg += pVar->cam_C1_v_err; # line 605 "../LaserSteering.st" pVar->cam_C2_h_err_avg += pVar->cam_C2_h_err; # line 606 "../LaserSteering.st" pVar->cam_C2_v_err_avg += pVar->cam_C2_v_err; # line 607 "../LaserSteering.st" pVar->loop++; } return; } } /****** Code for state "loop1_calc_avg" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_calc_avg" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_calc_avg(SS_ID ssId, struct UserVar *pVar) { # line 617 "../LaserSteering.st" seq_delayInit(ssId, 0, ((0.1))); } /* Event function for state "loop1_calc_avg" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_calc_avg(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 617 "../LaserSteering.st" if (pVar->loop < pVar->CHECK_TIMES && seq_delay(ssId, 0)) { *pNextState = 3; *pTransNum = 0; return TRUE; } # line 621 "../LaserSteering.st" if (pVar->loop >= pVar->CHECK_TIMES) { *pNextState = 5; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop1_calc_avg" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_calc_avg(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 624 "../LaserSteering.st" pVar->cam_C1_h_err_avg = pVar->cam_C1_h_err_avg / pVar->loop; # line 625 "../LaserSteering.st" pVar->cam_C1_v_err_avg = pVar->cam_C1_v_err_avg / pVar->loop; # line 626 "../LaserSteering.st" pVar->cam_C2_h_err_avg = pVar->cam_C2_h_err_avg / pVar->loop; # line 627 "../LaserSteering.st" pVar->cam_C2_v_err_avg = pVar->cam_C2_v_err_avg / pVar->loop; # line 630 "../LaserSteering.st" if (fabs(pVar->cam_C1_h_err_avg) < pVar->var_loop1Deadband_C1) # line 630 "../LaserSteering.st" pVar->cam_C1_h_err_avg = 0.0; # line 631 "../LaserSteering.st" if (fabs(pVar->cam_C1_v_err_avg) < pVar->var_loop1Deadband_C1) # line 631 "../LaserSteering.st" pVar->cam_C1_v_err_avg = 0.0; # line 632 "../LaserSteering.st" if (fabs(pVar->cam_C2_h_err_avg) < pVar->var_loop1Deadband_C2) # line 632 "../LaserSteering.st" pVar->cam_C2_h_err_avg = 0.0; # line 633 "../LaserSteering.st" if (fabs(pVar->cam_C2_v_err_avg) < pVar->var_loop1Deadband_C2) # line 633 "../LaserSteering.st" pVar->cam_C2_v_err_avg = 0.0; # line 636 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1h += pVar->cam_C1_h_err_avg * pVar->var_loop1Gain_C1; # line 637 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C1v += pVar->cam_C1_v_err_avg * pVar->var_loop1Gain_C1; # line 638 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2h += pVar->cam_C2_h_err_avg * pVar->var_loop1Gain_C2; # line 639 "../LaserSteering.st" pVar->var_loop1ErrorAccumulator_C2v += pVar->cam_C2_v_err_avg * pVar->var_loop1Gain_C2; # line 645 "../LaserSteering.st" pVar->m18h_adjustment = pVar->var_loop1ErrorAccumulator_C1h * pVar->LOOP1_DECPL_MTRX[0][0] + pVar->var_loop1ErrorAccumulator_C1v * pVar->LOOP1_DECPL_MTRX[0][1] + pVar->var_loop1ErrorAccumulator_C2h * pVar->LOOP1_DECPL_MTRX[0][2] + pVar->var_loop1ErrorAccumulator_C2v * pVar->LOOP1_DECPL_MTRX[0][3]; # line 650 "../LaserSteering.st" pVar->m18v_adjustment = pVar->var_loop1ErrorAccumulator_C1h * pVar->LOOP1_DECPL_MTRX[1][0] + pVar->var_loop1ErrorAccumulator_C1v * pVar->LOOP1_DECPL_MTRX[1][1] + pVar->var_loop1ErrorAccumulator_C2h * pVar->LOOP1_DECPL_MTRX[1][2] + pVar->var_loop1ErrorAccumulator_C2v * pVar->LOOP1_DECPL_MTRX[1][3]; # line 655 "../LaserSteering.st" pVar->m17h_adjustment = pVar->var_loop1ErrorAccumulator_C1h * pVar->LOOP1_DECPL_MTRX[2][0] + pVar->var_loop1ErrorAccumulator_C1v * pVar->LOOP1_DECPL_MTRX[2][1] + pVar->var_loop1ErrorAccumulator_C2h * pVar->LOOP1_DECPL_MTRX[2][2] + pVar->var_loop1ErrorAccumulator_C2v * pVar->LOOP1_DECPL_MTRX[2][3]; # line 660 "../LaserSteering.st" pVar->m17v_adjustment = pVar->var_loop1ErrorAccumulator_C1h * pVar->LOOP1_DECPL_MTRX[3][0] + pVar->var_loop1ErrorAccumulator_C1v * pVar->LOOP1_DECPL_MTRX[3][1] + pVar->var_loop1ErrorAccumulator_C2h * pVar->LOOP1_DECPL_MTRX[3][2] + pVar->var_loop1ErrorAccumulator_C2v * pVar->LOOP1_DECPL_MTRX[3][3]; # line 663 "../LaserSteering.st" seq_pvPut(ssId, 20/*m18h_adjustment*/, 0); # line 664 "../LaserSteering.st" seq_pvPut(ssId, 26/*m18v_adjustment*/, 0); # line 665 "../LaserSteering.st" seq_pvPut(ssId, 32/*m17h_adjustment*/, 0); # line 666 "../LaserSteering.st" seq_pvPut(ssId, 38/*m17v_adjustment*/, 0); # line 669 "../LaserSteering.st" pVar->loop1_max_drift = 0.0; # line 670 "../LaserSteering.st" pVar->loop1_max_drift = (((pVar->loop1_max_drift) < (fabs(pVar->cam_C1_h_err_avg))) ? (fabs(pVar->cam_C1_h_err_avg)) : (pVar->loop1_max_drift)); # line 671 "../LaserSteering.st" pVar->loop1_max_drift = (((pVar->loop1_max_drift) < (fabs(pVar->cam_C1_v_err_avg))) ? (fabs(pVar->cam_C1_v_err_avg)) : (pVar->loop1_max_drift)); # line 672 "../LaserSteering.st" pVar->loop1_max_drift = (((pVar->loop1_max_drift) < (fabs(pVar->cam_C2_h_err_avg))) ? (fabs(pVar->cam_C2_h_err_avg)) : (pVar->loop1_max_drift)); # line 673 "../LaserSteering.st" pVar->loop1_max_drift = (((pVar->loop1_max_drift) < (fabs(pVar->cam_C2_v_err_avg))) ? (fabs(pVar->cam_C2_v_err_avg)) : (pVar->loop1_max_drift)); # line 675 "../LaserSteering.st" if (pVar->DEBUG) { # line 676 "../LaserSteering.st" printf("loop1_calc_avg:\n"); # line 677 "../LaserSteering.st" printf(" average error: c1h = %lf, c1v = %lf, c2h = %lf, c2v = %lf\n", pVar->cam_C1_h_err_avg, pVar->cam_C1_v_err_avg, pVar->cam_C2_h_err_avg, pVar->cam_C2_v_err_avg); # line 679 "../LaserSteering.st" printf(" accumulated error: c1h = %lf, c1v = %lf, c2h = %lf, c2v = %lf\n", pVar->var_loop1ErrorAccumulator_C1h, pVar->var_loop1ErrorAccumulator_C1v, pVar->var_loop1ErrorAccumulator_C2h, pVar->var_loop1ErrorAccumulator_C2v); # line 680 "../LaserSteering.st" printf(" motor adj: m18h = %lf, m18v = %lf, m17h = %lf, m17v = %lf\n", pVar->m18h_adjustment, pVar->m18v_adjustment, pVar->m17h_adjustment, pVar->m17v_adjustment); } } return; } } /****** Code for state "loop1_calc_dest" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_calc_dest" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_calc_dest(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop1_calc_dest" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_calc_dest(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 692 "../LaserSteering.st" if (!pVar->loop1_fdbk_enbl) { *pNextState = 10; *pTransNum = 0; return TRUE; } # line 699 "../LaserSteering.st" if (pVar->loop1_fdbk_enbl && (pVar->loop1_max_drift < pVar->loop1_adj_min)) { *pNextState = 10; *pTransNum = 1; return TRUE; } # line 704 "../LaserSteering.st" if (pVar->loop1_fdbk_enbl && (pVar->loop1_max_drift > pVar->loop1_adj_max)) { *pNextState = 1; *pTransNum = 2; return TRUE; } # line 713 "../LaserSteering.st" if (pVar->loop1_fdbk_enbl && pVar->loop1_max_drift >= pVar->loop1_adj_min && pVar->loop1_max_drift <= pVar->loop1_adj_max) { *pNextState = 6; *pTransNum = 3; return TRUE; } return FALSE; } /* Action function for state "loop1_calc_dest" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_calc_dest(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 695 "../LaserSteering.st" pVar->feedback_status = 2; # line 696 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { } return; case 2: { # line 707 "../LaserSteering.st" pVar->feedback_status = 3; # line 708 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); # line 710 "../LaserSteering.st" pVar->var_internalReset = 1; } return; case 3: { # line 716 "../LaserSteering.st" pVar->m18h_calc_dest = pVar->var_loop1InitPosition_m18h + pVar->m18h_adjustment; # line 717 "../LaserSteering.st" pVar->m18v_calc_dest = pVar->var_loop1InitPosition_m18v + pVar->m18v_adjustment; # line 718 "../LaserSteering.st" pVar->m17h_calc_dest = pVar->var_loop1InitPosition_m17h + pVar->m17h_adjustment; # line 719 "../LaserSteering.st" pVar->m17v_calc_dest = pVar->var_loop1InitPosition_m17v + pVar->m17v_adjustment; # line 721 "../LaserSteering.st" pVar->dest_in_range = 1; # line 722 "../LaserSteering.st" if (pVar->m18h_calc_dest > pVar->m18h_dhlm || pVar->m18h_calc_dest < pVar->m18h_dllm) # line 722 "../LaserSteering.st" pVar->dest_in_range = 0; # line 723 "../LaserSteering.st" if (pVar->m18v_calc_dest > pVar->m18v_dhlm || pVar->m18v_calc_dest < pVar->m18v_dllm) # line 723 "../LaserSteering.st" pVar->dest_in_range = 0; # line 724 "../LaserSteering.st" if (pVar->m17h_calc_dest > pVar->m17h_dhlm || pVar->m17h_calc_dest < pVar->m17h_dllm) # line 724 "../LaserSteering.st" pVar->dest_in_range = 0; # line 725 "../LaserSteering.st" if (pVar->m17v_calc_dest > pVar->m17v_dhlm || pVar->m17v_calc_dest < pVar->m17v_dllm) # line 725 "../LaserSteering.st" pVar->dest_in_range = 0; # line 727 "../LaserSteering.st" if (pVar->DEBUG) # line 728 "../LaserSteering.st" printf("loop1_calc_dest: new motor des: m18h = %lf, m18v = %lf, m17h = %lf, m17v = %lf\n", pVar->m18h_calc_dest, pVar->m18v_calc_dest, pVar->m17h_calc_dest, pVar->m17v_calc_dest); } return; } } /****** Code for state "loop1_range_check" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_range_check" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_range_check(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop1_range_check" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_range_check(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 737 "../LaserSteering.st" if (!pVar->dest_in_range) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 744 "../LaserSteering.st" if (pVar->dest_in_range) { *pNextState = 7; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop1_range_check" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_range_check(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 740 "../LaserSteering.st" pVar->feedback_status = 4; # line 741 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { # line 746 "../LaserSteering.st" if (pVar->DEBUG) # line 746 "../LaserSteering.st" printf("m18h_calc_dest - in range\n"); } return; } } /****** Code for state "loop1_adjust_motors" in state set "laser_stabilization" ******/ /* Entry function for state "loop1_adjust_motors" in state set "laser_stabilization" */ static void I_laser_stabilization_loop1_adjust_motors(SS_ID ssId, struct UserVar *pVar) { # line 758 "../LaserSteering.st" pVar->tempum1 = lround(pVar->m18h_calc_dest * 1000.0); # line 759 "../LaserSteering.st" pVar->m18h_dest = pVar->tempum1 / 1000.0; # line 761 "../LaserSteering.st" pVar->tempum1 = lround(pVar->m18v_calc_dest * 1000.0); # line 762 "../LaserSteering.st" pVar->m18v_dest = pVar->tempum1 / 1000.0; # line 764 "../LaserSteering.st" pVar->tempum1 = lround(pVar->m17h_calc_dest * 1000.0); # line 765 "../LaserSteering.st" pVar->m17h_dest = pVar->tempum1 / 1000.0; # line 767 "../LaserSteering.st" pVar->tempum1 = lround(pVar->m17v_calc_dest * 1000.0); # line 768 "../LaserSteering.st" pVar->m17v_dest = pVar->tempum1 / 1000.0; # line 771 "../LaserSteering.st" seq_pvPut(ssId, 21/*m18h_dest*/, 0); # line 772 "../LaserSteering.st" seq_pvPut(ssId, 27/*m18v_dest*/, 0); # line 773 "../LaserSteering.st" seq_pvPut(ssId, 33/*m17h_dest*/, 0); # line 774 "../LaserSteering.st" seq_pvPut(ssId, 39/*m17v_dest*/, 0); # line 777 "../LaserSteering.st" pVar->feedback_status = 5; # line 778 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); # line 780 "../LaserSteering.st" if (pVar->DEBUG) # line 781 "../LaserSteering.st" printf("loop1_adjust_motors: final motor des: m18h = %lf, m18v = %lf, m17h = %lf, m17v = %lf\n", pVar->m18h_dest, pVar->m18v_dest, pVar->m17h_dest, pVar->m17v_dest); } /* Delay function for state "loop1_adjust_motors" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_adjust_motors(SS_ID ssId, struct UserVar *pVar) { # line 784 "../LaserSteering.st" seq_delayInit(ssId, 0, ((0.5))); } /* Event function for state "loop1_adjust_motors" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_adjust_motors(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 784 "../LaserSteering.st" if (seq_delay(ssId, 0)) { *pNextState = 8; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop1_adjust_motors" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_adjust_motors(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "loop1_wait_motors" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_wait_motors" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_wait_motors(SS_ID ssId, struct UserVar *pVar) { # line 794 "../LaserSteering.st" seq_delayInit(ssId, 0, ((5.0))); } /* Event function for state "loop1_wait_motors" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_wait_motors(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 794 "../LaserSteering.st" if (seq_delay(ssId, 0) || ((!pVar->m18h_moving) && (!pVar->m18v_moving) && (!pVar->m17h_moving) && (!pVar->m17v_moving))) { *pNextState = 9; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop1_wait_motors" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_wait_motors(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 796 "../LaserSteering.st" if (pVar->DEBUG) # line 796 "../LaserSteering.st" printf("loop1_wait_motors - waiting\n"); } return; } } /****** Code for state "loop1_check_position" in state set "laser_stabilization" ******/ /* Delay function for state "loop1_check_position" in state set "laser_stabilization" */ static void D_laser_stabilization_loop1_check_position(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop1_check_position" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop1_check_position(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 806 "../LaserSteering.st" if ((fabs(pVar->m18h_pos - pVar->m18h_calc_dest) >= 0.001) || (fabs(pVar->m18v_pos - pVar->m18v_calc_dest) >= 0.001) || (fabs(pVar->m17h_pos - pVar->m17h_calc_dest) >= 0.001) || (fabs(pVar->m17v_pos - pVar->m17v_calc_dest) >= 0.001)) { *pNextState = 7; *pTransNum = 0; return TRUE; } # line 813 "../LaserSteering.st" if ((fabs(pVar->m18h_pos - pVar->m18h_calc_dest) < 0.001) && (fabs(pVar->m18v_pos - pVar->m18v_calc_dest) < 0.001) && (fabs(pVar->m17h_pos - pVar->m17h_calc_dest) < 0.001) && (fabs(pVar->m17v_pos - pVar->m17v_calc_dest) < 0.001)) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop1_check_position" in state set "laser_stabilization" */ static void A_laser_stabilization_loop1_check_position(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 809 "../LaserSteering.st" if (pVar->DEBUG) # line 809 "../LaserSteering.st" printf("loop1_check_position - position wrong\n"); } return; case 1: { # line 816 "../LaserSteering.st" pVar->feedback_status = 0; # line 817 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; } } /****** Code for state "loop2_check_motor" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_check_motor" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_check_motor(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop2_check_motor" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_check_motor(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 825 "../LaserSteering.st" if ((!pVar->m2h_moving) && (!pVar->m2v_moving)) { *pNextState = 11; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop2_check_motor" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_check_motor(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 827 "../LaserSteering.st" pVar->loop = 0; # line 828 "../LaserSteering.st" pVar->cam_VCC_h_err_avg = 0; # line 829 "../LaserSteering.st" pVar->cam_VCC_v_err_avg = 0; # line 832 "../LaserSteering.st" pVar->m2h_calc_dest = pVar->m2h_pos; # line 833 "../LaserSteering.st" pVar->m2v_calc_dest = pVar->m2v_pos; } return; } } /****** Code for state "loop2_check_centroid" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_check_centroid" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_check_centroid(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop2_check_centroid" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_check_centroid(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 839 "../LaserSteering.st" if (seq_pvGet(ssId, 8/*cam_VCC_h_err*/, 0) != pvStatOK || seq_pvGet(ssId, 9/*cam_VCC_v_err*/, 0) != pvStatOK) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 845 "../LaserSteering.st" if (pVar->cam_VCC_dark_img || pVar->cam_VCC_splt_img) { *pNextState = 1; *pTransNum = 1; return TRUE; } # line 851 "../LaserSteering.st" if (seq_pvGet(ssId, 8/*cam_VCC_h_err*/, 0) == pvStatOK && seq_pvGet(ssId, 9/*cam_VCC_v_err*/, 0) == pvStatOK) { *pNextState = 12; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "loop2_check_centroid" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_check_centroid(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 841 "../LaserSteering.st" pVar->feedback_status = 6; # line 842 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { # line 847 "../LaserSteering.st" pVar->feedback_status = 12; # line 848 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 2: { # line 853 "../LaserSteering.st" pVar->cam_VCC_h_err_avg += pVar->cam_VCC_h_err; # line 854 "../LaserSteering.st" pVar->cam_VCC_v_err_avg += pVar->cam_VCC_v_err; # line 855 "../LaserSteering.st" pVar->loop++; } return; } } /****** Code for state "loop2_calc_avg" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_calc_avg" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_calc_avg(SS_ID ssId, struct UserVar *pVar) { # line 861 "../LaserSteering.st" seq_delayInit(ssId, 0, ((0.1))); } /* Event function for state "loop2_calc_avg" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_calc_avg(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 861 "../LaserSteering.st" if (pVar->loop < pVar->CHECK_TIMES && seq_delay(ssId, 0)) { *pNextState = 11; *pTransNum = 0; return TRUE; } # line 865 "../LaserSteering.st" if (pVar->loop >= pVar->CHECK_TIMES) { *pNextState = 13; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop2_calc_avg" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_calc_avg(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 868 "../LaserSteering.st" pVar->cam_VCC_h_err_avg = pVar->cam_VCC_h_err_avg / pVar->loop; # line 869 "../LaserSteering.st" pVar->cam_VCC_v_err_avg = pVar->cam_VCC_v_err_avg / pVar->loop; # line 871 "../LaserSteering.st" pVar->m2h_adjustment = pVar->cam_VCC_h_err_avg * pVar->LOOP2_DECPL_MTRX[0][0] + pVar->cam_VCC_v_err_avg * pVar->LOOP2_DECPL_MTRX[0][1]; # line 872 "../LaserSteering.st" seq_pvPut(ssId, 44/*m2h_adjustment*/, 0); # line 874 "../LaserSteering.st" pVar->m2v_adjustment = pVar->cam_VCC_h_err_avg * pVar->LOOP2_DECPL_MTRX[1][0] + pVar->cam_VCC_v_err_avg * pVar->LOOP2_DECPL_MTRX[1][1]; # line 875 "../LaserSteering.st" seq_pvPut(ssId, 50/*m2v_adjustment*/, 0); # line 877 "../LaserSteering.st" pVar->loop2_max_drift = 0.0; # line 878 "../LaserSteering.st" pVar->loop2_max_drift = (((pVar->loop2_max_drift) < (fabs(pVar->cam_VCC_h_err_avg))) ? (fabs(pVar->cam_VCC_h_err_avg)) : (pVar->loop2_max_drift)); # line 879 "../LaserSteering.st" pVar->loop2_max_drift = (((pVar->loop2_max_drift) < (fabs(pVar->cam_VCC_v_err_avg))) ? (fabs(pVar->cam_VCC_v_err_avg)) : (pVar->loop2_max_drift)); } return; } } /****** Code for state "loop2_calc_dest" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_calc_dest" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_calc_dest(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop2_calc_dest" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_calc_dest(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 885 "../LaserSteering.st" if (!pVar->loop2_fdbk_enbl) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 891 "../LaserSteering.st" if (pVar->loop2_fdbk_enbl && (pVar->loop2_max_drift < pVar->loop2_adj_min)) { *pNextState = 1; *pTransNum = 1; return TRUE; } # line 895 "../LaserSteering.st" if (pVar->loop2_fdbk_enbl && (pVar->loop2_max_drift > pVar->loop2_adj_max)) { *pNextState = 1; *pTransNum = 2; return TRUE; } # line 901 "../LaserSteering.st" if (pVar->loop2_fdbk_enbl && pVar->loop2_max_drift >= pVar->loop2_adj_min && pVar->loop2_max_drift <= pVar->loop2_adj_max) { *pNextState = 14; *pTransNum = 3; return TRUE; } return FALSE; } /* Action function for state "loop2_calc_dest" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_calc_dest(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 887 "../LaserSteering.st" pVar->feedback_status = 7; # line 888 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { } return; case 2: { # line 897 "../LaserSteering.st" pVar->feedback_status = 8; # line 898 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 3: { # line 903 "../LaserSteering.st" pVar->m2h_calc_dest += pVar->m2h_adjustment; # line 904 "../LaserSteering.st" pVar->m2v_calc_dest += pVar->m2v_adjustment; # line 906 "../LaserSteering.st" pVar->dest_in_range = 1; # line 907 "../LaserSteering.st" if (pVar->m2h_calc_dest > pVar->m2h_dhlm || pVar->m2h_calc_dest < pVar->m2h_dllm) # line 907 "../LaserSteering.st" pVar->dest_in_range = 0; # line 908 "../LaserSteering.st" if (pVar->m2v_calc_dest > pVar->m2v_dhlm || pVar->m2v_calc_dest < pVar->m2v_dllm) # line 908 "../LaserSteering.st" pVar->dest_in_range = 0; } return; } } /****** Code for state "loop2_range_check" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_range_check" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_range_check(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop2_range_check" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_range_check(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 914 "../LaserSteering.st" if (!pVar->dest_in_range) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 920 "../LaserSteering.st" if (pVar->dest_in_range) { *pNextState = 15; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop2_range_check" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_range_check(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 916 "../LaserSteering.st" pVar->feedback_status = 9; # line 917 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; case 1: { } return; } } /****** Code for state "loop2_adjust_motors" in state set "laser_stabilization" ******/ /* Entry function for state "loop2_adjust_motors" in state set "laser_stabilization" */ static void I_laser_stabilization_loop2_adjust_motors(SS_ID ssId, struct UserVar *pVar) { # line 929 "../LaserSteering.st" pVar->tempum = pVar->m2h_calc_dest * 1000; # line 930 "../LaserSteering.st" pVar->m2h_dest = pVar->tempum / 1000.0; # line 931 "../LaserSteering.st" seq_pvPut(ssId, 45/*m2h_dest*/, 0); # line 933 "../LaserSteering.st" pVar->tempum = pVar->m2v_calc_dest * 1000; # line 934 "../LaserSteering.st" pVar->m2v_dest = pVar->tempum / 1000.0; # line 935 "../LaserSteering.st" seq_pvPut(ssId, 51/*m2v_dest*/, 0); # line 937 "../LaserSteering.st" pVar->feedback_status = 10; # line 938 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } /* Delay function for state "loop2_adjust_motors" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_adjust_motors(SS_ID ssId, struct UserVar *pVar) { # line 941 "../LaserSteering.st" seq_delayInit(ssId, 0, ((0.5))); } /* Event function for state "loop2_adjust_motors" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_adjust_motors(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 941 "../LaserSteering.st" if (seq_delay(ssId, 0)) { *pNextState = 16; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop2_adjust_motors" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_adjust_motors(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "loop2_wait_motors" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_wait_motors" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_wait_motors(SS_ID ssId, struct UserVar *pVar) { # line 948 "../LaserSteering.st" seq_delayInit(ssId, 0, ((5.0))); } /* Event function for state "loop2_wait_motors" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_wait_motors(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 948 "../LaserSteering.st" if (seq_delay(ssId, 0) || ((!pVar->m2h_moving) && (!pVar->m2v_moving))) { *pNextState = 17; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "loop2_wait_motors" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_wait_motors(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "loop2_check_position" in state set "laser_stabilization" ******/ /* Delay function for state "loop2_check_position" in state set "laser_stabilization" */ static void D_laser_stabilization_loop2_check_position(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "loop2_check_position" in state set "laser_stabilization" */ static seqBool E_laser_stabilization_loop2_check_position(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 955 "../LaserSteering.st" if ((fabs(pVar->m2h_pos - pVar->m2h_calc_dest) >= 0.001) || (fabs(pVar->m2v_pos - pVar->m2v_calc_dest) >= 0.001)) { *pNextState = 15; *pTransNum = 0; return TRUE; } # line 959 "../LaserSteering.st" if ((fabs(pVar->m2h_pos - pVar->m2h_calc_dest) < 0.001) && (fabs(pVar->m2v_pos - pVar->m2v_calc_dest) < 0.001)) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "loop2_check_position" in state set "laser_stabilization" */ static void A_laser_stabilization_loop2_check_position(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 961 "../LaserSteering.st" pVar->feedback_status = 0; # line 962 "../LaserSteering.st" seq_pvPut(ssId, 18/*feedback_status*/, 0); } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"CAMR:LR20:113:CTRD_H_ERR", offsetof(struct UserVar, cam_C1_h_err), "cam_C1_h_err", "double", 1, 1, 0, 0, 0, 0}, {"CAMR:LR20:113:CTRD_V_ERR", offsetof(struct UserVar, cam_C1_v_err), "cam_C1_v_err", "double", 1, 2, 0, 0, 0, 0}, {"CAMR:LR20:113:DARKIMG", offsetof(struct UserVar, cam_C1_dark_img), "cam_C1_dark_img", "double", 1, 3, 0, 1, 0, 0}, {"CAMR:LR20:113:SPLTIMG", offsetof(struct UserVar, cam_C1_splt_img), "cam_C1_splt_img", "double", 1, 4, 0, 1, 0, 0}, {"CAMR:LR20:114:CTRD_H_ERR", offsetof(struct UserVar, cam_C2_h_err), "cam_C2_h_err", "double", 1, 5, 0, 0, 0, 0}, {"CAMR:LR20:114:CTRD_V_ERR", offsetof(struct UserVar, cam_C2_v_err), "cam_C2_v_err", "double", 1, 6, 0, 0, 0, 0}, {"CAMR:LR20:114:DARKIMG", offsetof(struct UserVar, cam_C2_dark_img), "cam_C2_dark_img", "double", 1, 7, 0, 1, 0, 0}, {"CAMR:LR20:114:SPLTIMG", offsetof(struct UserVar, cam_C2_splt_img), "cam_C2_splt_img", "double", 1, 8, 0, 1, 0, 0}, {"CAMR:IN20:186:CTRD_H_ERR", offsetof(struct UserVar, cam_VCC_h_err), "cam_VCC_h_err", "double", 1, 9, 0, 0, 0, 0}, {"CAMR:IN20:186:CTRD_V_ERR", offsetof(struct UserVar, cam_VCC_v_err), "cam_VCC_v_err", "double", 1, 10, 0, 0, 0, 0}, {"CAMR:IN20:186:DARKIMG", offsetof(struct UserVar, cam_VCC_dark_img), "cam_VCC_dark_img", "double", 1, 11, 0, 1, 0, 0}, {"CAMR:IN20:186:SPLTIMG", offsetof(struct UserVar, cam_VCC_splt_img), "cam_VCC_splt_img", "double", 1, 12, 0, 1, 0, 0}, {"LASR:LR20:110:POS_FDBK", offsetof(struct UserVar, loop1_fdbk_enbl), "loop1_fdbk_enbl", "unsigned int", 1, 13, 0, 1, 0, 0}, {"LASR:LR20:110:POS_FDBK_MIN", offsetof(struct UserVar, loop1_adj_min), "loop1_adj_min", "double", 1, 14, 0, 1, 0, 0}, {"LASR:LR20:110:POS_FDBK_MAX", offsetof(struct UserVar, loop1_adj_max), "loop1_adj_max", "double", 1, 15, 0, 1, 0, 0}, {"LASR:IN20:160:POS_FDBK", offsetof(struct UserVar, loop2_fdbk_enbl), "loop2_fdbk_enbl", "unsigned int", 1, 16, 0, 1, 0, 0}, {"LASR:IN20:160:POS_FDBK_MIN", offsetof(struct UserVar, loop2_adj_min), "loop2_adj_min", "double", 1, 17, 0, 1, 0, 0}, {"LASR:IN20:160:POS_FDBK_MAX", offsetof(struct UserVar, loop2_adj_max), "loop2_adj_max", "double", 1, 18, 0, 1, 0, 0}, {"LASR:IN20:100:POS_FDBK_STS", offsetof(struct UserVar, feedback_status), "feedback_status", "unsigned short", 1, 19, 0, 0, 0, 0}, {"LASR:IN20:100:POS_FDBK_AVGTIME", offsetof(struct UserVar, CHECK_TIMES), "CHECK_TIMES", "unsigned short", 1, 20, 0, 1, 0, 0}, {"LASR:LR20:110:M18H_ADJ", offsetof(struct UserVar, m18h_adjustment), "m18h_adjustment", "double", 1, 21, 0, 0, 0, 0}, {"MIRR:LR20:113:M18_MOTR_H.VAL", offsetof(struct UserVar, m18h_dest), "m18h_dest", "double", 1, 22, 0, 0, 0, 0}, {"MIRR:LR20:113:M18_MOTR_H.RBV", offsetof(struct UserVar, m18h_pos), "m18h_pos", "double", 1, 23, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_H.MOVN", offsetof(struct UserVar, m18h_moving), "m18h_moving", "unsigned int", 1, 24, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_H.DHLM", offsetof(struct UserVar, m18h_dhlm), "m18h_dhlm", "double", 1, 25, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_H.DLLM", offsetof(struct UserVar, m18h_dllm), "m18h_dllm", "double", 1, 26, 0, 1, 0, 0}, {"LASR:LR20:110:M18V_ADJ", offsetof(struct UserVar, m18v_adjustment), "m18v_adjustment", "double", 1, 27, 0, 0, 0, 0}, {"MIRR:LR20:113:M18_MOTR_V.VAL", offsetof(struct UserVar, m18v_dest), "m18v_dest", "double", 1, 28, 0, 0, 0, 0}, {"MIRR:LR20:113:M18_MOTR_V.RBV", offsetof(struct UserVar, m18v_pos), "m18v_pos", "double", 1, 29, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_V.MOVN", offsetof(struct UserVar, m18v_moving), "m18v_moving", "unsigned int", 1, 30, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_V.DHLM", offsetof(struct UserVar, m18v_dhlm), "m18v_dhlm", "double", 1, 31, 0, 1, 0, 0}, {"MIRR:LR20:113:M18_MOTR_V.DLLM", offsetof(struct UserVar, m18v_dllm), "m18v_dllm", "double", 1, 32, 0, 1, 0, 0}, {"LASR:LR20:110:M17H_ADJ", offsetof(struct UserVar, m17h_adjustment), "m17h_adjustment", "double", 1, 33, 0, 0, 0, 0}, {"MIRR:LR20:114:M17_MOTR_H.VAL", offsetof(struct UserVar, m17h_dest), "m17h_dest", "double", 1, 34, 0, 0, 0, 0}, {"MIRR:LR20:114:M17_MOTR_H.RBV", offsetof(struct UserVar, m17h_pos), "m17h_pos", "double", 1, 35, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_H.MOVN", offsetof(struct UserVar, m17h_moving), "m17h_moving", "unsigned int", 1, 36, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_H.DHLM", offsetof(struct UserVar, m17h_dhlm), "m17h_dhlm", "double", 1, 37, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_H.DLLM", offsetof(struct UserVar, m17h_dllm), "m17h_dllm", "double", 1, 38, 0, 1, 0, 0}, {"LASR:LR20:110:M17V_ADJ", offsetof(struct UserVar, m17v_adjustment), "m17v_adjustment", "double", 1, 39, 0, 0, 0, 0}, {"MIRR:LR20:114:M17_MOTR_V.VAL", offsetof(struct UserVar, m17v_dest), "m17v_dest", "double", 1, 40, 0, 0, 0, 0}, {"MIRR:LR20:114:M17_MOTR_V.RBV", offsetof(struct UserVar, m17v_pos), "m17v_pos", "double", 1, 41, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_V.MOVN", offsetof(struct UserVar, m17v_moving), "m17v_moving", "unsigned int", 1, 42, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_V.DHLM", offsetof(struct UserVar, m17v_dhlm), "m17v_dhlm", "double", 1, 43, 0, 1, 0, 0}, {"MIRR:LR20:114:M17_MOTR_V.DLLM", offsetof(struct UserVar, m17v_dllm), "m17v_dllm", "double", 1, 44, 0, 1, 0, 0}, {"LASR:IN20:160:M2H_ADJ", offsetof(struct UserVar, m2h_adjustment), "m2h_adjustment", "double", 1, 45, 0, 0, 0, 0}, {"MIRR:IN20:162:M2_MOTR_H.VAL", offsetof(struct UserVar, m2h_dest), "m2h_dest", "double", 1, 46, 0, 0, 0, 0}, {"MIRR:IN20:162:M2_MOTR_H.RBV", offsetof(struct UserVar, m2h_pos), "m2h_pos", "double", 1, 47, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_H.MOVN", offsetof(struct UserVar, m2h_moving), "m2h_moving", "unsigned int", 1, 48, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_H.DHLM", offsetof(struct UserVar, m2h_dhlm), "m2h_dhlm", "double", 1, 49, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_H.DLLM", offsetof(struct UserVar, m2h_dllm), "m2h_dllm", "double", 1, 50, 0, 1, 0, 0}, {"LASR:IN20:160:M2V_ADJ", offsetof(struct UserVar, m2v_adjustment), "m2v_adjustment", "double", 1, 51, 0, 0, 0, 0}, {"MIRR:IN20:162:M2_MOTR_V.VAL", offsetof(struct UserVar, m2v_dest), "m2v_dest", "double", 1, 52, 0, 0, 0, 0}, {"MIRR:IN20:162:M2_MOTR_V.RBV", offsetof(struct UserVar, m2v_pos), "m2v_pos", "double", 1, 53, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_V.MOVN", offsetof(struct UserVar, m2v_moving), "m2v_moving", "unsigned int", 1, 54, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_V.DHLM", offsetof(struct UserVar, m2v_dhlm), "m2v_dhlm", "double", 1, 55, 0, 1, 0, 0}, {"MIRR:IN20:162:M2_MOTR_V.DLLM", offsetof(struct UserVar, m2v_dllm), "m2v_dllm", "double", 1, 56, 0, 1, 0, 0}, {"LASR:IN20:110:GAINC1", offsetof(struct UserVar, var_loop1Gain_C1), "var_loop1Gain_C1", "double", 1, 57, 0, 1, 0, 0}, {"LASR:IN20:110:GAINC2", offsetof(struct UserVar, var_loop1Gain_C2), "var_loop1Gain_C2", "double", 1, 58, 0, 1, 0, 0}, {"LASR:IN20:110:DEADBANDC1", offsetof(struct UserVar, var_loop1Deadband_C1), "var_loop1Deadband_C1", "double", 1, 59, 0, 1, 0, 0}, {"LASR:IN20:110:DEADBANDC2", offsetof(struct UserVar, var_loop1Deadband_C2), "var_loop1Deadband_C2", "double", 1, 60, 0, 1, 0, 0}, {"LASR:IN20:110:RESET", offsetof(struct UserVar, var_loop1Reset), "var_loop1Reset", "unsigned int", 1, 61, 0, 1, 0, 0}, {"LASR:IN20:110:DEBUG", offsetof(struct UserVar, DEBUG), "DEBUG", "unsigned int", 1, 62, 0, 1, 0, 0} }; /* Event masks for state set "laser_stabilization" */ static const seqMask EM_laser_stabilization_initialization[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_idle[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_check_motor[] = { 0x41000000, 0x00000410, }; static const seqMask EM_laser_stabilization_loop1_check_centroid[] = { 0x000001fe, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_calc_avg[] = { 0x00100000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_calc_dest[] = { 0x0000e000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_range_check[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_adjust_motors[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop1_wait_motors[] = { 0x41000000, 0x00000410, }; static const seqMask EM_laser_stabilization_loop1_check_position[] = { 0x20800000, 0x00000208, }; static const seqMask EM_laser_stabilization_loop2_check_motor[] = { 0x00000000, 0x00410000, }; static const seqMask EM_laser_stabilization_loop2_check_centroid[] = { 0x00001e00, 0x00000000, }; static const seqMask EM_laser_stabilization_loop2_calc_avg[] = { 0x00100000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop2_calc_dest[] = { 0x00070000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop2_range_check[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop2_adjust_motors[] = { 0x00000000, 0x00000000, }; static const seqMask EM_laser_stabilization_loop2_wait_motors[] = { 0x00000000, 0x00410000, }; static const seqMask EM_laser_stabilization_loop2_check_position[] = { 0x00000000, 0x00208000, }; /* State table for state set "laser_stabilization" */ static seqState G_laser_stabilization_states[] = { { /* state name */ "initialization", /* action function */ A_laser_stabilization_initialization, /* event function */ E_laser_stabilization_initialization, /* delay function */ D_laser_stabilization_initialization, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_initialization, /* state options */ (0) }, { /* state name */ "idle", /* action function */ A_laser_stabilization_idle, /* event function */ E_laser_stabilization_idle, /* delay function */ D_laser_stabilization_idle, /* entry function */ I_laser_stabilization_idle, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_idle, /* state options */ (0) }, { /* state name */ "loop1_check_motor", /* action function */ A_laser_stabilization_loop1_check_motor, /* event function */ E_laser_stabilization_loop1_check_motor, /* delay function */ D_laser_stabilization_loop1_check_motor, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_check_motor, /* state options */ (0) }, { /* state name */ "loop1_check_centroid", /* action function */ A_laser_stabilization_loop1_check_centroid, /* event function */ E_laser_stabilization_loop1_check_centroid, /* delay function */ D_laser_stabilization_loop1_check_centroid, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_check_centroid, /* state options */ (0) }, { /* state name */ "loop1_calc_avg", /* action function */ A_laser_stabilization_loop1_calc_avg, /* event function */ E_laser_stabilization_loop1_calc_avg, /* delay function */ D_laser_stabilization_loop1_calc_avg, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_calc_avg, /* state options */ (0) }, { /* state name */ "loop1_calc_dest", /* action function */ A_laser_stabilization_loop1_calc_dest, /* event function */ E_laser_stabilization_loop1_calc_dest, /* delay function */ D_laser_stabilization_loop1_calc_dest, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_calc_dest, /* state options */ (0) }, { /* state name */ "loop1_range_check", /* action function */ A_laser_stabilization_loop1_range_check, /* event function */ E_laser_stabilization_loop1_range_check, /* delay function */ D_laser_stabilization_loop1_range_check, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_range_check, /* state options */ (0) }, { /* state name */ "loop1_adjust_motors", /* action function */ A_laser_stabilization_loop1_adjust_motors, /* event function */ E_laser_stabilization_loop1_adjust_motors, /* delay function */ D_laser_stabilization_loop1_adjust_motors, /* entry function */ I_laser_stabilization_loop1_adjust_motors, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_adjust_motors, /* state options */ (0) }, { /* state name */ "loop1_wait_motors", /* action function */ A_laser_stabilization_loop1_wait_motors, /* event function */ E_laser_stabilization_loop1_wait_motors, /* delay function */ D_laser_stabilization_loop1_wait_motors, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_wait_motors, /* state options */ (0) }, { /* state name */ "loop1_check_position", /* action function */ A_laser_stabilization_loop1_check_position, /* event function */ E_laser_stabilization_loop1_check_position, /* delay function */ D_laser_stabilization_loop1_check_position, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop1_check_position, /* state options */ (0) }, { /* state name */ "loop2_check_motor", /* action function */ A_laser_stabilization_loop2_check_motor, /* event function */ E_laser_stabilization_loop2_check_motor, /* delay function */ D_laser_stabilization_loop2_check_motor, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_check_motor, /* state options */ (0) }, { /* state name */ "loop2_check_centroid", /* action function */ A_laser_stabilization_loop2_check_centroid, /* event function */ E_laser_stabilization_loop2_check_centroid, /* delay function */ D_laser_stabilization_loop2_check_centroid, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_check_centroid, /* state options */ (0) }, { /* state name */ "loop2_calc_avg", /* action function */ A_laser_stabilization_loop2_calc_avg, /* event function */ E_laser_stabilization_loop2_calc_avg, /* delay function */ D_laser_stabilization_loop2_calc_avg, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_calc_avg, /* state options */ (0) }, { /* state name */ "loop2_calc_dest", /* action function */ A_laser_stabilization_loop2_calc_dest, /* event function */ E_laser_stabilization_loop2_calc_dest, /* delay function */ D_laser_stabilization_loop2_calc_dest, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_calc_dest, /* state options */ (0) }, { /* state name */ "loop2_range_check", /* action function */ A_laser_stabilization_loop2_range_check, /* event function */ E_laser_stabilization_loop2_range_check, /* delay function */ D_laser_stabilization_loop2_range_check, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_range_check, /* state options */ (0) }, { /* state name */ "loop2_adjust_motors", /* action function */ A_laser_stabilization_loop2_adjust_motors, /* event function */ E_laser_stabilization_loop2_adjust_motors, /* delay function */ D_laser_stabilization_loop2_adjust_motors, /* entry function */ I_laser_stabilization_loop2_adjust_motors, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_adjust_motors, /* state options */ (0) }, { /* state name */ "loop2_wait_motors", /* action function */ A_laser_stabilization_loop2_wait_motors, /* event function */ E_laser_stabilization_loop2_wait_motors, /* delay function */ D_laser_stabilization_loop2_wait_motors, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_wait_motors, /* state options */ (0) }, { /* state name */ "loop2_check_position", /* action function */ A_laser_stabilization_loop2_check_position, /* event function */ E_laser_stabilization_loop2_check_position, /* delay function */ D_laser_stabilization_loop2_check_position, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_laser_stabilization_loop2_check_position, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "laser_stabilization", /* states */ G_laser_stabilization_states, /* number of states */ 18, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram LaserSteering = { /* magic number */ 2001006, /* program name */ "LaserSteering", /* channels */ G_channels, /* num. channels */ 62, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ sizeof(struct UserVar), /* param */ "stack=200000", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_DEBUG | OPT_NEWEF | OPT_REENT), /* init func */ G_prog_init, /* entry func */ NULL, /* exit func */ NULL, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void LaserSteeringRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&LaserSteering); } epicsExportRegistrar(LaserSteeringRegistrar);