From 349bcfdac52bf91f21b9e8f030eb8d617ebcb488 Mon Sep 17 00:00:00 2001 From: Guilherme Rodrigues de Lima Date: Fri, 1 Mar 2024 13:51:40 -0300 Subject: [PATCH 1/2] Bug fix and new function E-727 controller - Bug fix in PID control function. Now all axes work correctly. - New format in the declaration of the PI_SupportCL.db file, allowing individual axes to be created. - New PV's OverFlow and On-Target features have been added to protect equipment. - New PV clear the last error. --- .../iocBoot/iocPIGCS2/PI_GCS2 _CL.cmd | 22 -- iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.cmd | 5 +- .../iocBoot/iocPIGCS2/PI_GCS2.substitutions | 23 ++ iocs/pigcs2IOC/pigcs2App/Db/Makefile | 4 + pigcs2App/Db/Makefile | 1 + pigcs2App/Db/PI_Support.db | 21 +- pigcs2App/Db/PI_SupportCL.db | 346 +++--------------- pigcs2App/Db/PI_SupportCtrl.db | 7 - pigcs2App/Db/PI_SupportError.db | 13 + pigcs2App/src/PIE727Controller.cpp | 44 +++ pigcs2App/src/PIE727Controller.h | 3 + pigcs2App/src/PIGCS2PiezoCL.h | 63 ++-- pigcs2App/src/PIGCSController.cpp | 21 ++ pigcs2App/src/PIGCSController.h | 6 +- pigcs2App/src/PIasynAxis.cpp | 68 ++-- pigcs2App/src/PIasynAxis.h | 4 +- pigcs2App/src/PIasynController.cpp | 18 +- pigcs2App/src/PIasynController.h | 2 + 18 files changed, 285 insertions(+), 386 deletions(-) delete mode 100644 iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2 _CL.cmd create mode 100644 pigcs2App/Db/PI_SupportError.db diff --git a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2 _CL.cmd b/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2 _CL.cmd deleted file mode 100644 index f5ef8c6..0000000 --- a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2 _CL.cmd +++ /dev/null @@ -1,22 +0,0 @@ -# PI GCS2 support with Closed loop params - -dbLoadTemplate("PI_GCS2.substitutions") - -drvAsynIPPortConfigure("C867_ETH","192.168.1.75:50000",0,0,0) -# Turn on asyn trace -asynSetTraceMask("C867_ETH",0,3) -asynSetTraceIOMask("C867_ETH",0,1) - -# PI_GCS2_CreateController(portName, asynPort, numAxes, priority, stackSize, movingPollingRate, idlePollingRate) -PI_GCS2_CreateController("C867", "C867_ETH",2, 0,0, 100, 1000) - -# Turn off asyn trace -asynSetTraceMask("C867_ETH",0,1) -asynSetTraceIOMask("C867_ETH",0,0) - -#!dbLoadRecords("$(TOP)/db/PI_Support.db","P=pigcs2:,R=m1:,PORT=C867,ADDR=0,TIMEOUT=1") -#!dbLoadRecords("$(TOP)/db/PI_Support.db","P=pigcs2:,R=m2:,PORT=C867,ADDR=1,TIMEOUT=1") -dbLoadRecords("$(TOP)/db/PI_SupportCL.db","P=pigcs2:,PORT=C867_ETH") - -# asyn record for troubleshooting -dbLoadRecords("$(ASYN)/db/asynRecord.db","P=pigcs2:,R=asyn_1,PORT=C867_ETH,ADDR=0,OMAX=256,IMAX=256") diff --git a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.cmd b/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.cmd index 3306454..6c924ca 100644 --- a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.cmd +++ b/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.cmd @@ -14,8 +14,5 @@ PI_GCS2_CreateController("C867", "C867_ETH",2, 0,0, 100, 1000) asynSetTraceMask("C867_ETH",0,1) asynSetTraceIOMask("C867_ETH",0,0) -#!dbLoadRecords("$(TOP)/db/PI_Support.db","P=pigcs2:,R=m1:,PORT=C867,ADDR=0,TIMEOUT=1") -#!dbLoadRecords("$(TOP)/db/PI_Support.db","P=pigcs2:,R=m2:,PORT=C867,ADDR=1,TIMEOUT=1") - # asyn record for troubleshooting -dbLoadRecords("$(ASYN)/db/asynRecord.db","P=pigcs2:,R=asyn_1,PORT=C867_ETH,ADDR=0,OMAX=256,IMAX=256") +#dbLoadRecords("$(ASYN)/db/asynRecord.db","P=pigcs2:,R=asyn_1,PORT=C867_ETH,ADDR=0,OMAX=256,IMAX=256") diff --git a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.substitutions b/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.substitutions index 902e375..45fc499 100644 --- a/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.substitutions +++ b/iocs/pigcs2IOC/iocBoot/iocPIGCS2/PI_GCS2.substitutions @@ -7,3 +7,26 @@ pattern # U-624.03 {pigcs2:, "m2", "asynMotor", "C867", 1, "Motor 2", deg, Pos, 5, 0, .2, 0, 1, .2, 0.0020, 4, 0.0, 0.0, ""} } + +#file "$(TOP)/db/PI_Support.db" +#{ +#pattern +#{P, M, PORT, ADDR, TIMEOUT } +#{pigcs2:, "m1:", "C867", 0, 1 } +#{pigcs2:, "m2:", "C867", 1, 1 } +#} + +#file "$(TOP)/db/PI_SupportCL.db" +#{ +#pattern +#{P, M, PORT, ADDR, TIMEOUT } +#{pigcs2:, "m1:", "C867", 0, 1 } +#{pigcs2:, "m2:", "C867", 1, 1 } +#} + +#file "$(TOP)/db/PI_SupportError.db" +#{ +#pattern +#{P, PORT } +#{pigcs2:, "C867" } +#} \ No newline at end of file diff --git a/iocs/pigcs2IOC/pigcs2App/Db/Makefile b/iocs/pigcs2IOC/pigcs2App/Db/Makefile index 73c1c92..809525d 100644 --- a/iocs/pigcs2IOC/pigcs2App/Db/Makefile +++ b/iocs/pigcs2IOC/pigcs2App/Db/Makefile @@ -9,11 +9,15 @@ include $(TOP)/configure/CONFIG ifdef MOTOR_PIGCS2 ### this module was built outside motor +DB_INSTALLS += $(MOTOR_PIGCS2)/db/PI_SupportError.db DB_INSTALLS += $(MOTOR_PIGCS2)/db/PI_SupportCtrl.db +DB_INSTALLS += $(MOTOR_PIGCS2)/db/PI_SupportCL.db DB_INSTALLS += $(MOTOR_PIGCS2)/db/PI_Support.db else ### this module was built inside motor/modules +DB_INSTALLS += $(MOTOR)/db/PI_SupportError.db DB_INSTALLS += $(MOTOR)/db/PI_SupportCtrl.db +DB_INSTALLS += $(MOTOR)/db/PI_SupportCL.db DB_INSTALLS += $(MOTOR)/db/PI_Support.db endif diff --git a/pigcs2App/Db/Makefile b/pigcs2App/Db/Makefile index 3320391..f059278 100644 --- a/pigcs2App/Db/Makefile +++ b/pigcs2App/Db/Makefile @@ -13,6 +13,7 @@ include $(TOP)/configure/CONFIG #DB += xxx.db DB += PI_SupportCtrl.db +DB += PI_SupportError.db DB += PI_Support.db DB += PI_SupportCL.db diff --git a/pigcs2App/Db/PI_Support.db b/pigcs2App/Db/PI_Support.db index 78ebc64..3ad1d4d 100644 --- a/pigcs2App/Db/PI_Support.db +++ b/pigcs2App/Db/PI_Support.db @@ -1,24 +1,33 @@ -record(ai, "$(P)$(R)POSITION") +record(ai, "$(P)$(M)POSITION") { - field(PINI, "1") field(DTYP, "asynFloat64") field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_POSITION") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ao, "$(P)$(R)TARGET") +record(ao, "$(P)$(M)TARGET") { - field(PINI, "1") field(DTYP, "asynFloat64") field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_TARGET") field(PREC, "5") } -record(bi, "$(P)$(R)SERVO") +record(bo, "$(P)$(M)SERVO") +{ + field(DESC, "Set status Servo") + field(DTYP, "asynInt32") + field(ZNAM, "Disable") + field(ONAM, "Enable") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_SERVO") + +} + +record(bi, "$(P)$(M)RBSERVO") { - field(PINI, "1") field(DTYP, "asynInt32") + field(ZNAM, "Disable") + field(ONAM, "Enable") field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_SERVO") field(SCAN, "I/O Intr") } diff --git a/pigcs2App/Db/PI_SupportCL.db b/pigcs2App/Db/PI_SupportCL.db index 2985b1e..30d8f55 100644 --- a/pigcs2App/Db/PI_SupportCL.db +++ b/pigcs2App/Db/PI_SupportCL.db @@ -1,411 +1,167 @@ -record(ao, "$(P)KP_X") +record(ao, "$(P)$(M)KP") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KP_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KP_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)KI_X") +record(ao, "$(P)$(M)KI") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KI_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KI_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)KFF_X") +record(ao, "$(P)$(M)KFF") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KFF_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KFF_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHFR1_X") +record(ao, "$(P)$(M)NTCHFR1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR1_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR1_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHFR2_X") +record(ao, "$(P)$(M)NTCHFR2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR2_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR2_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHRJT1_X") +record(ao, "$(P)$(M)NTCHRJT1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT1_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT1_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHRJT2_X") +record(ao, "$(P)$(M)NTCHRJT2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT2_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT2_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHBDWDT1_X") +record(ao, "$(P)$(M)NTCHBDWDT1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT1_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT1_$(ADDR)") field(PREC, "5") } -record(ao, "$(P)NTCHBDWDT2_X") +record(ao, "$(P)$(M)NTCHBDWDT2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT2_1") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT2_$(ADDR)") field(PREC, "5") } -record(ai, "$(P)RBKP_X") -{ - field(PINI, "1") - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKP_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBKI_X") -{ - field(PINI, "1") - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKI_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBKFF_X") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKFF_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHFR1_X") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR1_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHFR2_X") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR2_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHRJT1_X") +record(ao, "$(P)$(M)ANALOGINPUT") { + field(DESC,"Set Analog Target Input") + field(ASG,"Reserved") field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT1_1") - field(PREC, "5") - field(SCAN, "I/O Intr") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_ANALOGTARGET_$(ADDR)") } -record(ai, "$(P)RBNTCHRJT2_X") +record(ai, "$(P)$(M)RBKP") { - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT2_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHBDWDT1_X") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT1_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHBDWDT2_X") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT2_1") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ao, "$(P)KP_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KP_2") - field(PREC, "5") -} - -record(ao, "$(P)KI_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KI_2") - field(PREC, "5") -} - -record(ao, "$(P)KFF_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KFF_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHFR1_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR1_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHFR2_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR2_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHRJT1_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT1_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHRJT2_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT2_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHBDWDT1_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT1_2") - field(PREC, "5") -} - -record(ao, "$(P)NTCHBDWDT2_Y") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT2_2") - field(PREC, "5") -} - -record(ai, "$(P)RBKP_Y") -{ - field(PINI, "1") field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKP_2") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKP_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBKI_Y") +record(ai, "$(P)$(M)RBKI") { - field(PINI, "1") field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKI_2") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKI_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBKFF_Y") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKFF_2") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHFR1_Y") +record(ai, "$(P)$(M)RBKFF") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR1_2") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKFF_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHFR2_Y") +record(ai, "$(P)$(M)RBNTCHFR1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR2_2") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR1_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHRJT1_Y") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT1_2") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHRJT2_Y") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT2_2") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHBDWDT1_Y") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT1_2") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBNTCHBDWDT2_Y") -{ - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT2_2") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - - -record(ao, "$(P)KP_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KP_3") - field(PREC, "5") -} - -record(ao, "$(P)KI_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KI_3") - field(PREC, "5") -} - -record(ao, "$(P)KFF_Z") +record(ai, "$(P)$(M)RBNTCHFR2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_KFF_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR2_$(ADDR)") field(PREC, "5") -} - -record(ao, "$(P)NTCHFR1_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR1_3") - field(PREC, "5") -} - -record(ao, "$(P)NTCHFR2_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHFR2_3") - field(PREC, "5") -} - -record(ao, "$(P)NTCHRJT1_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT1_3") - field(PREC, "5") -} - -record(ao, "$(P)NTCHRJT2_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHRJT2_3") - field(PREC, "5") -} - -record(ao, "$(P)NTCHBDWDT1_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT1_3") - field(PREC, "5") -} - -record(ao, "$(P)NTCHBDWDT2_Z") -{ - field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),0,0)PI_SUP_NTCHBDWDT2_3") - field(PREC, "5") -} - -record(ai, "$(P)RBKP_Z") -{ - field(PINI, "1") - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKP_3") - field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBKI_Z") -{ - field(PINI, "1") - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKI_3") - field(PREC, "5") - field(SCAN, "I/O Intr") -} - -record(ai, "$(P)RBKFF_Z") +record(ai, "$(P)$(M)RBNTCHRJT1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBKFF_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT1_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHFR1_Z") +record(ai, "$(P)$(M)RBNTCHRJT2") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR1_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT2_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHFR2_Z") +record(ai, "$(P)$(M)RBNTCHBDWDT1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHFR2_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT1_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHRJT1_Z") +record(ai, "$(P)$(M)RBNTCHBDWDT2") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT1_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT2_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHRJT2_Z") +record(ai, "$(P)$(M)RBANALOGINPUT") { + field(DESC,"Read Analog Target Input") field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHRJT2_3") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBANALOGTARGET_$(ADDR)") field(PREC, "5") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHBDWDT1_Z") +record(bi, "$(P)$(M)RBONT") { - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT1_3") - field(PREC, "5") + field(DESC,"Read On-Target") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBONT_$(ADDR)") field(SCAN, "I/O Intr") } -record(ai, "$(P)RBNTCHBDWDT2_Z") +record(bi, "$(P)$(M)RBOVF") { - field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),0,0)PI_SUP_RBNTCHBDWDT2_3") - field(PREC, "5") + field(DESC,"Read Over Flow") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBOVF_$(ADDR)") field(SCAN, "I/O Intr") } diff --git a/pigcs2App/Db/PI_SupportCtrl.db b/pigcs2App/Db/PI_SupportCtrl.db index 78e1ba9..53fe3e4 100644 --- a/pigcs2App/Db/PI_SupportCtrl.db +++ b/pigcs2App/Db/PI_SupportCtrl.db @@ -1,10 +1,3 @@ -record(ai, "$(P)LAST_ERR") -{ - field(DTYP, "asynInt32") - field(INP, "@asyn($(PORT),0,0)PI_SUP_LAST_ERR") - field(SCAN, "I/O Intr") -} - record(bo, "$(P)DEFER") { field(DTYP, "asynInt32") field(OUT, "@asynMask($(PORT),0,0)MOTOR_DEFER_MOVES") diff --git a/pigcs2App/Db/PI_SupportError.db b/pigcs2App/Db/PI_SupportError.db new file mode 100644 index 0000000..28e4ab9 --- /dev/null +++ b/pigcs2App/Db/PI_SupportError.db @@ -0,0 +1,13 @@ +record(longin, "$(P)LAST_ERR") +{ + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),0,0)PI_SUP_LAST_ERR") + field(SCAN, "I/O Intr") +} + +record(bo, "$(P)CLEAR_ERR") +{ + field(DESC, "Clean message error") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),0,0)PI_SUP_CLEAR_ERR") +} diff --git a/pigcs2App/src/PIE727Controller.cpp b/pigcs2App/src/PIE727Controller.cpp index 4b67552..e47f504 100644 --- a/pigcs2App/src/PIE727Controller.cpp +++ b/pigcs2App/src/PIE727Controller.cpp @@ -103,3 +103,47 @@ double PIE727Controller::getCLAxisParam( PIasynAxis* pAxis , unsigned int paramI return pValue; } + +// get axis target status on the controller E727 + +asynStatus PIE727Controller::getAxisOnt(PIasynAxis* pAxis,int& value) +{ + char cmd[100]; + char buf[255]; + + sprintf(cmd, "ONT? %s", pAxis->m_szAxisName); + + asynStatus status = m_pInterface->sendAndReceive(cmd, buf, 99); + + if (status != asynSuccess) + { + return status; + } + + if (!getValue(buf, value)) + { + return asynError; + } + return status; +} + +asynStatus PIE727Controller::getAxisOvf(PIasynAxis* pAxis,int& value) +{ + char cmd[100]; + char buf[255]; + + sprintf(cmd, "OVF? %s", pAxis->m_szAxisName); + + asynStatus status = m_pInterface->sendAndReceive(cmd, buf, 99); + + if (status != asynSuccess) + { + return status; + } + + if (!getValue(buf, value)) + { + return asynError; + } + return status; +} \ No newline at end of file diff --git a/pigcs2App/src/PIE727Controller.h b/pigcs2App/src/PIE727Controller.h index a71d741..f9cae34 100644 --- a/pigcs2App/src/PIE727Controller.h +++ b/pigcs2App/src/PIE727Controller.h @@ -39,6 +39,9 @@ class PIE727Controller : public PIGCSPiezoController virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double wantedValue ); virtual double getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID); + + virtual asynStatus getAxisOnt(PIasynAxis* pAxis, int& value); + virtual asynStatus getAxisOvf(PIasynAxis* pAxis, int& value); private: diff --git a/pigcs2App/src/PIGCS2PiezoCL.h b/pigcs2App/src/PIGCS2PiezoCL.h index 4559b07..e0a1f20 100644 --- a/pigcs2App/src/PIGCS2PiezoCL.h +++ b/pigcs2App/src/PIGCS2PiezoCL.h @@ -8,8 +8,8 @@ FILENAME... PIGCS2PiezoCL.h ************************************************************************* -Augusto Horita -August 03, 2022 +Augusto Horita and Guilherme Rodrigues de Lima +Mar 01, 2024 */ @@ -28,25 +28,30 @@ August 03, 2022 // ------------- X Axis Closed loop Parameters ------------- -#define KP_String std::string("PI_SUP_KP_") -#define KI_String std::string("PI_SUP_KI_") // I-term Gain -#define KFF_String std::string("PI_SUP_KFF_") // Feed Foward Gain -#define NTCHFR1_String std::string("PI_SUP_NTCHFR1_") // Notch frequncy 1 -#define NTCHFR2_String std::string("PI_SUP_NTCHFR2_") // Notch frequncy 2 -#define NTCHRJT1_String std::string("PI_SUP_NTCHRJT1_") // Notch reject 1 -#define NTCHRJT2_String std::string("PI_SUP_NTCHRJT2_") // Notch reject 2 -#define NTCHBDWDT1_String std::string("PI_SUP_NTCHBDWDT1_") // Notch bandwidth 1 -#define NTCHBDWDT2_String std::string("PI_SUP_NTCHBDWDT2_") // Notch bandwidth 2 -#define RBKP_String std::string("PI_SUP_RBKP_") -#define RBKI_String std::string("PI_SUP_RBKI_") -#define RBKFF_String std::string("PI_SUP_RBKFF_") -#define RBNTCHFR1_String std::string("PI_SUP_RBNTCHFR1_") -#define RBNTCHFR2_String std::string("PI_SUP_RBNTCHFR2_") -#define RBNTCHRJT1_String std::string("PI_SUP_RBNTCHRJT1_") -#define RBNTCHRJT2_String std::string("PI_SUP_RBNTCHRJT2_") -#define RBNTCHBDWDT1_String std::string("PI_SUP_RBNTCHBDWDT1_") -#define RBNTCHBDWDT2_String std::string("PI_SUP_RBNTCHBDWDT2_") +#define KP_String std::string("PI_SUP_KP_") +#define KI_String std::string("PI_SUP_KI_") // I-term Gain +#define KFF_String std::string("PI_SUP_KFF_") // Feed Foward Gain +#define NTCHFR1_String std::string("PI_SUP_NTCHFR1_") // Notch frequncy 1 +#define NTCHFR2_String std::string("PI_SUP_NTCHFR2_") // Notch frequncy 2 +#define NTCHRJT1_String std::string("PI_SUP_NTCHRJT1_") // Notch reject 1 +#define NTCHRJT2_String std::string("PI_SUP_NTCHRJT2_") // Notch reject 2 +#define NTCHBDWDT1_String std::string("PI_SUP_NTCHBDWDT1_") // Notch bandwidth 1 +#define NTCHBDWDT2_String std::string("PI_SUP_NTCHBDWDT2_") // Notch bandwidth 2 +#define RBKP_String std::string("PI_SUP_RBKP_") +#define RBKI_String std::string("PI_SUP_RBKI_") +#define RBKFF_String std::string("PI_SUP_RBKFF_") +#define RBNTCHFR1_String std::string("PI_SUP_RBNTCHFR1_") +#define RBNTCHFR2_String std::string("PI_SUP_RBNTCHFR2_") +#define RBNTCHRJT1_String std::string("PI_SUP_RBNTCHRJT1_") +#define RBNTCHRJT2_String std::string("PI_SUP_RBNTCHRJT2_") +#define RBNTCHBDWDT1_String std::string("PI_SUP_RBNTCHBDWDT1_") +#define RBNTCHBDWDT2_String std::string("PI_SUP_RBNTCHBDWDT2_") +#define RBONT_String std::string("PI_SUP_RBONT_") +#define RBOVF_String std::string("PI_SUP_RBOVF_") +#define ANALOGTARGET_String std::string("PI_SUP_ANALOGTARGET_") +#define RBANALOGTARGET_String std::string("PI_SUP_RBANALOGTARGET_") +// ------------- X Axis Closed loop Parameters ------------- #define PI_SUP_KP_X_String "PI_SUP_KP_X" // P-term Gain #define PI_SUP_KI_X_String "PI_SUP_KI_X" // I-term Gain #define PI_SUP_KFF_X_String "PI_SUP_KFF_X" // Feed Foward Gain @@ -57,8 +62,8 @@ August 03, 2022 #define PI_SUP_NTCHRJT2_X_String "PI_SUP_NTCHRJT2_X" // Notch reject 2 #define PI_SUP_NTCHBDWDT1_X_String "PI_SUP_NTCHBDWDT1_X" // Notch bandwidth 1 #define PI_SUP_NTCHBDWDT2_X_String "PI_SUP_NTCHBDWDT2_X" // Notch bandwidth 2 +#define PI_SUP_ANALOGTARGET_X_String "PI_SUP_ANALOGTARGET_X" -// Readback variables #define PI_SUP_RBKP_X_String "PI_SUP_RBKP_X" #define PI_SUP_RBKI_X_String "PI_SUP_RBKI_X" #define PI_SUP_RBKFF_X_String "PI_SUP_RBKFF_X" @@ -69,6 +74,7 @@ August 03, 2022 #define PI_SUP_RBNTCHRJT2_X_String "PI_SUP_RBNTCHRJT2_X" #define PI_SUP_RBNTCHBDWDT1_X_String "PI_SUP_RBNTCHBDWDT1_X" #define PI_SUP_RBNTCHBDWDT2_X_String "PI_SUP_RBNTCHBDWDT2_X" +#define PI_SUP_RBANALOGTARGET_X_String "PI_SUP_RBANALOGTARGET_X" // ------------- Y Axis Closed loop Parameters ------------- #define PI_SUP_KP_Y_String "PI_SUP_KP_Y" @@ -81,6 +87,7 @@ August 03, 2022 #define PI_SUP_NTCHRJT2_Y_String "PI_SUP_NTCHRJT2_Y" #define PI_SUP_NTCHBDWDT1_Y_String "PI_SUP_NTCHBDWDT1_Y" #define PI_SUP_NTCHBDWDT2_Y_String "PI_SUP_NTCHBDWDT2_Y" +#define PI_SUP_ANALOGTARGET_Y_String "PI_SUP_ANALOGTARGET_Y" #define PI_SUP_RBKP_Y_String "PI_SUP_RBKP_Y" #define PI_SUP_RBKI_Y_String "PI_SUP_RBKI_Y" @@ -92,6 +99,7 @@ August 03, 2022 #define PI_SUP_RBNTCHRJT2_Y_String "PI_SUP_RBNTCHRJT2_Y" #define PI_SUP_RBNTCHBDWDT1_Y_String "PI_SUP_RBNTCHBDWDT1_Y" #define PI_SUP_RBNTCHBDWDT2_Y_String "PI_SUP_RBNTCHBDWDT2_Y" +#define PI_SUP_RBANALOGTARGET_Y_String "PI_SUP_RBANALOGTARGET_Y" // ------------- Z Axis Closed loop Parameters ------------- @@ -105,6 +113,7 @@ August 03, 2022 #define PI_SUP_NTCHRJT2_Z_String "PI_SUP_NTCHRJT2_Z" #define PI_SUP_NTCHBDWDT1_Z_String "PI_SUP_NTCHBDWDT1_Z" #define PI_SUP_NTCHBDWDT2_Z_String "PI_SUP_NTCHBDWDT2_Z" +#define PI_SUP_ANALOGTARGET_Z_String "PI_SUP_ANALOGTARGET_Z" #define PI_SUP_RBKP_Z_String "PI_SUP_RBKP_Z" #define PI_SUP_RBKI_Z_String "PI_SUP_RBKI_Z" @@ -116,7 +125,14 @@ August 03, 2022 #define PI_SUP_RBNTCHRJT2_Z_String "PI_SUP_RBNTCHRJT2_Z" #define PI_SUP_RBNTCHBDWDT1_Z_String "PI_SUP_RBNTCHBDWDT1_Z" #define PI_SUP_RBNTCHBDWDT2_Z_String "PI_SUP_RBNTCHBDWDT2_Z" +#define PI_SUP_RBANALOGTARGET_Z_String "PI_SUP_RBANALOGTARGET_Z" + +typedef struct PIGCS2PiezoCLValues{ + + int PI_SUP_RBONT; + int PI_SUP_RBOVF; +}PIGCS2PiezoCLValues; typedef struct PIGCS2PiezoCLParams{ int PI_SUP_KP; @@ -128,6 +144,7 @@ typedef struct PIGCS2PiezoCLParams{ int PI_SUP_NTCHRJT2; int PI_SUP_NTCHBDWDT1; int PI_SUP_NTCHBDWDT2; + int PI_SUP_ANALOGTARGET; int PI_SUP_RBKP; int PI_SUP_RBKI; int PI_SUP_RBKFF; @@ -137,6 +154,7 @@ typedef struct PIGCS2PiezoCLParams{ int PI_SUP_RBNTCHRJT2; int PI_SUP_RBNTCHBDWDT1; int PI_SUP_RBNTCHBDWDT2; + int PI_SUP_RBANALOGTARGET; }PIGCS2PiezoCLParams; @@ -160,10 +178,11 @@ namespace PI727_CL_PARAM_ADDR NOTCHREJEC2 = 0x07000201UL, NOTCHBDWDT1 = 0x08000300UL, NOTCHBDWDT2 = 0x08000301UL, + ANALOGCHANNEL = 0x06000500, }; static const CL_PARAM All[] = { KP , KI , KFF , NOTCHFREQ1 , NOTCHFREQ2 , \ - NOTCHREJEC1 , NOTCHREJEC2 , NOTCHBDWDT1 , NOTCHBDWDT2 }; + NOTCHREJEC1 , NOTCHREJEC2 , NOTCHBDWDT1 , NOTCHBDWDT2, ANALOGCHANNEL }; } diff --git a/pigcs2App/src/PIGCSController.cpp b/pigcs2App/src/PIGCSController.cpp index 9e19f6c..06bfcf5 100644 --- a/pigcs2App/src/PIGCSController.cpp +++ b/pigcs2App/src/PIGCSController.cpp @@ -490,6 +490,27 @@ asynStatus PIGCSController::getAxisPositionCts(PIasynAxis* pAxis) //void PIGCSController::calcAxisPositionCts(); +asynStatus PIGCSController::getServo(PIasynAxis* pAxis,int& servoState) +{ + char cmd[100]; + char buf[255]; + + sprintf(cmd, "SVO? %s", pAxis->m_szAxisName); + + asynStatus status = m_pInterface->sendAndReceive(cmd, buf, 99); + + if (status != asynSuccess) + { + return status; + } + + if (!getValue(buf, servoState)) + { + return asynError; + } + return status; +} + asynStatus PIGCSController::setServo(PIasynAxis* pAxis, int servoState) { char cmd[100]; diff --git a/pigcs2App/src/PIGCSController.h b/pigcs2App/src/PIGCSController.h index 0412272..b56635b 100644 --- a/pigcs2App/src/PIGCSController.h +++ b/pigcs2App/src/PIGCSController.h @@ -62,6 +62,7 @@ class PIGCSController virtual asynStatus getAxisPosition(PIasynAxis* pAxis, double& position); virtual asynStatus getAxisVelocity(PIasynAxis* pAxis); virtual asynStatus getAxisPositionCts(PIasynAxis* pAxis); + virtual asynStatus getServo(PIasynAxis* pAxis,int& servoState); virtual asynStatus setServo(PIasynAxis* pAxis, int servoState); virtual asynStatus resetControlMode(PIasynAxis* pAxis){return asynSuccess;} virtual asynStatus getResolution(PIasynAxis* pAxis, double& resolution ); @@ -88,6 +89,9 @@ class PIGCSController virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double wantedValue ){return asynSuccess;} virtual double getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID){return 0.0;} + virtual asynStatus getAxisOnt(PIasynAxis* pAxis, int& value){return asynSuccess;} + virtual asynStatus getAxisOvf(PIasynAxis* pAxis, int& value){return asynSuccess;} + virtual bool AcceptsNewTarget() { return true; } virtual bool CanCommunicateWhileHoming() { return true; } @@ -104,6 +108,7 @@ class PIGCSController PIInterface* m_pInterface; static const size_t MAX_NR_AXES = 64; bool m_bAnyAxisMoving; + int m_LastError; static void getStatusFromBitMask(long mask, int& homing, int& moving, int& negLimit, int& posLimit, int& servoControl); @@ -120,7 +125,6 @@ class PIGCSController char* m_axesIDs[MAX_NR_AXES]; size_t m_nrFoundAxes; char m_allAxesIDs[255]; - int m_LastError; bool m_KnowsVELcommand; bool m_IsGCS2; diff --git a/pigcs2App/src/PIasynAxis.cpp b/pigcs2App/src/PIasynAxis.cpp index ac6746d..79ce6a2 100644 --- a/pigcs2App/src/PIasynAxis.cpp +++ b/pigcs2App/src/PIasynAxis.cpp @@ -112,30 +112,35 @@ PIasynAxis::~PIasynAxis() } } -void PIasynAxis::createCLParams(const char* axisName) -{ - pController_->createParam( (KP_String + axisName).c_str() , asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KP); - - +void PIasynAxis::createCLParams(const int axis) +{ + char axisName[2]; + sprintf(axisName,"%d",axis); // printf("------------------- createCLParams() axis %s %s ------------------- \r\n",KP_String,axisName ); - - pController_->createParam( (KI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KI); - pController_->createParam( (KFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KFF); - pController_->createParam( (NTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR1); - pController_->createParam( (NTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR2); - pController_->createParam( (NTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT1); - pController_->createParam( (NTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT2); - pController_->createParam( (NTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT1); - pController_->createParam( (NTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT2); - pController_->createParam( (RBKP_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKP); - pController_->createParam( (RBKI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKI); - pController_->createParam( (RBKFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKFF); - pController_->createParam( (RBNTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR1); - pController_->createParam( (RBNTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR2); - pController_->createParam( (RBNTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT1); - pController_->createParam( (RBNTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT2); - pController_->createParam( (RBNTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT1); - pController_->createParam( (RBNTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT2); + + pController_->createParam( (KP_String + axisName).c_str() , asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KP); + pController_->createParam( (KI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KI); + pController_->createParam( (KFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KFF); + pController_->createParam( (NTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR1); + pController_->createParam( (NTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR2); + pController_->createParam( (NTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT1); + pController_->createParam( (NTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT2); + pController_->createParam( (NTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT1); + pController_->createParam( (NTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT2); + pController_->createParam( (ANALOGTARGET_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_ANALOGTARGET); + pController_->createParam( (RBKP_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKP); + pController_->createParam( (RBKI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKI); + pController_->createParam( (RBKFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKFF); + pController_->createParam( (RBNTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR1); + pController_->createParam( (RBNTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR2); + pController_->createParam( (RBNTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT1); + pController_->createParam( (RBNTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT2); + pController_->createParam( (RBNTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT1); + pController_->createParam( (RBNTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT2); + pController_->createParam( (RBANALOGTARGET_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBANALOGTARGET); + + pController_->createParam( (RBONT_String + axisName).c_str(), asynParamInt32, &m_CloseLoopValue.PI_SUP_RBONT); + pController_->createParam( (RBOVF_String + axisName).c_str(), asynParamInt32, &m_CloseLoopValue.PI_SUP_RBOVF); } asynStatus PIasynAxis::poll(bool *returnMoving) @@ -145,6 +150,7 @@ asynStatus PIasynAxis::poll(bool *returnMoving) int moving, negLimit, posLimit, servoControl; int oldHoming = m_isHoming; m_pGCSController->getStatus(this, m_isHoming, moving, negLimit, posLimit, servoControl); + m_pGCSController->getServo(this, servoControl); if (moving == 0 && m_isHoming == 0) done = 1; @@ -189,7 +195,23 @@ asynStatus PIasynAxis::poll(bool *returnMoving) double realPosition; m_pGCSController->getAxisPosition(this, realPosition); setDoubleParam(pController_->PI_SUP_POSITION, realPosition ); + + int axisont; + m_pGCSController->getAxisOnt(this, axisont); + setIntegerParam(m_CloseLoopValue.PI_SUP_RBONT,axisont); + + int axisovf = 0; + m_pGCSController->getAxisOvf(this, axisovf); + setIntegerParam(m_CloseLoopValue.PI_SUP_RBOVF,axisovf); + + for(unsigned int param=0 ; paramgetCLAxisParam(this,PI727_CL_PARAM_ADDR::All[param]); + setDoubleParam(m_CloseLoopParam.CLParams_arr[param+PIGCS2_CL_PARAM_QTT],ValueAxisParam); + } } + } if (m_isHoming) { diff --git a/pigcs2App/src/PIasynAxis.h b/pigcs2App/src/PIasynAxis.h index 9ab481b..3e317c7 100644 --- a/pigcs2App/src/PIasynAxis.h +++ b/pigcs2App/src/PIasynAxis.h @@ -42,7 +42,7 @@ class PIasynAxis : public asynMotorAxis virtual asynStatus setPosition(double position); - void createCLParams(const char* axisName); + void createCLParams(const int axis); char* m_szAxisName; ///< GCS name @@ -72,7 +72,9 @@ class PIasynAxis : public asynMotorAxis bool m_bEnableAxisAfterHoming; bool m_bSetServoAfterHoming; int m_movingStateMask; + u_PIGCS2PiezoCLParams m_CloseLoopParam; + PIGCS2PiezoCLValues m_CloseLoopValue; friend class PIasynController; private: diff --git a/pigcs2App/src/PIasynController.cpp b/pigcs2App/src/PIasynController.cpp index 8b34c31..f8354be 100644 --- a/pigcs2App/src/PIasynController.cpp +++ b/pigcs2App/src/PIasynController.cpp @@ -65,6 +65,7 @@ PIasynController::PIasynController(const char *portName, const char* asynPort, i createParam(PI_SUP_TARGET_String, asynParamFloat64, &PI_SUP_TARGET); createParam(PI_SUP_SERVO_String, asynParamInt32, &PI_SUP_SERVO); createParam(PI_SUP_LAST_ERR_String, asynParamInt32, &PI_SUP_LAST_ERR); + createParam(PI_SUP_CLEAR_ERR_String, asynParamInt32, &PI_SUP_CLEAR_ERR); createParam(PI_SUP_PIVOT_X_String, asynParamFloat64, &PI_SUP_PIVOT_X); createParam(PI_SUP_PIVOT_Y_String, asynParamFloat64, &PI_SUP_PIVOT_Y); createParam(PI_SUP_PIVOT_Z_String, asynParamFloat64, &PI_SUP_PIVOT_Z); @@ -156,7 +157,7 @@ PIasynController::PIasynController(const char *portName, const char* asynPort, i pAxis = new PIasynAxis(this, m_pGCSController, axis, m_pGCSController->getAxesID(axis)); pAxis->Init(portName); - pAxis->createCLParams(m_pGCSController->getAxesID(axis)); + pAxis->createCLParams(axis); } startPoller(double(movingPollPeriod)/1000, double(idlePollPeriod)/1000, 10); @@ -261,7 +262,7 @@ asynStatus PIasynController::writeInt32(asynUser *pasynUser, epicsInt32 value) * status at the end, but that's OK */ status = pAxis->setIntegerParam(function, value); - if (function == motorClosedLoop_) + if (function == motorClosedLoop_ || function == PI_SUP_SERVO) { asynPrint(pasynUser, ASYN_TRACE_FLOW, "%s:%s: %sing Closed-Loop Control flag on driver %s\n", @@ -281,7 +282,13 @@ asynStatus PIasynController::writeInt32(asynUser *pasynUser, epicsInt32 value) processDeferredMoves(); } this->movesDeferred = value; - } else { + } + else if (function == PI_SUP_CLEAR_ERR) + { + m_pGCSController->m_LastError = 0; + setIntegerParam(0, PI_SUP_LAST_ERR, m_pGCSController->GetLastError() ); + } + else { /* Call base class call its method (if we have our parameters check this here) */ status = asynMotorController::writeInt32(pasynUser, value); } @@ -332,8 +339,9 @@ asynStatus PIasynController::writeFloat64(asynUser *pasynUser, epicsFloat64 valu if (cl_iter >= PIGCS2_CL_PARAM_QTT) { if (function == PI_SUP_TARGET) - { - printf("PI_SUP_TargetAO: %f for axis %d\n", value, pAxis->axisNo_); + { + status = m_pGCSController->move(pAxis, value); + //printf("PI_SUP_TargetAO: %f for axis %d\n", value, pAxis->axisNo_); } else if (function == PI_SUP_PIVOT_X) { diff --git a/pigcs2App/src/PIasynController.h b/pigcs2App/src/PIasynController.h index a6961b9..c4cc8a6 100644 --- a/pigcs2App/src/PIasynController.h +++ b/pigcs2App/src/PIasynController.h @@ -55,6 +55,7 @@ class PIasynController : asynMotorController { int PI_SUP_TARGET; int PI_SUP_SERVO; int PI_SUP_LAST_ERR; + int PI_SUP_CLEAR_ERR; int PI_SUP_PIVOT_X; int PI_SUP_PIVOT_Y; int PI_SUP_PIVOT_Z; @@ -69,6 +70,7 @@ class PIasynController : asynMotorController { #define PI_SUP_TARGET_String "PI_SUP_TARGET" #define PI_SUP_SERVO_String "PI_SUP_SERVO" #define PI_SUP_LAST_ERR_String "PI_SUP_LAST_ERR" +#define PI_SUP_CLEAR_ERR_String "PI_SUP_CLEAR_ERR" #define PI_SUP_PIVOT_X_String "PI_SUP_PIVOT_X" #define PI_SUP_PIVOT_Y_String "PI_SUP_PIVOT_Y" #define PI_SUP_PIVOT_Z_String "PI_SUP_PIVOT_Z" From f52ebb323e1b9d7b424641e7cf1d0e0baf9bc73c Mon Sep 17 00:00:00 2001 From: Guilherme Rodrigues de Lima Date: Tue, 5 Mar 2024 14:21:49 -0300 Subject: [PATCH 2/2] Code optimization - Function PIasynAxis::createCLParams() was removed, now the address (ADDR) is passed in the PI_SupportCL.db file, now the parameters are instantiated once at controller initialization, following the asyn module pattern. --- pigcs2App/Db/PI_SupportCL.db | 44 ++++----- pigcs2App/src/PIE727Controller.cpp | 13 +-- pigcs2App/src/PIE727Controller.h | 4 +- pigcs2App/src/PIGCS2PiezoCL.h | 120 +++++-------------------- pigcs2App/src/PIGCSController.h | 4 +- pigcs2App/src/PIGCSPiezoController.cpp | 5 +- pigcs2App/src/PIasynAxis.cpp | 58 +++--------- pigcs2App/src/PIasynAxis.h | 8 +- pigcs2App/src/PIasynController.cpp | 50 ++++++++--- pigcs2App/src/PIasynController.h | 5 +- 10 files changed, 112 insertions(+), 199 deletions(-) diff --git a/pigcs2App/Db/PI_SupportCL.db b/pigcs2App/Db/PI_SupportCL.db index 30d8f55..4fb6790 100644 --- a/pigcs2App/Db/PI_SupportCL.db +++ b/pigcs2App/Db/PI_SupportCL.db @@ -1,63 +1,63 @@ record(ao, "$(P)$(M)KP") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KP_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KP") field(PREC, "5") } record(ao, "$(P)$(M)KI") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KI_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KI") field(PREC, "5") } record(ao, "$(P)$(M)KFF") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KFF_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_KFF") field(PREC, "5") } record(ao, "$(P)$(M)NTCHFR1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR1_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR1") field(PREC, "5") } record(ao, "$(P)$(M)NTCHFR2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR2_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHFR2") field(PREC, "5") } record(ao, "$(P)$(M)NTCHRJT1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT1_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT1") field(PREC, "5") } record(ao, "$(P)$(M)NTCHRJT2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT2_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHRJT2") field(PREC, "5") } record(ao, "$(P)$(M)NTCHBDWDT1") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT1_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT1") field(PREC, "5") } record(ao, "$(P)$(M)NTCHBDWDT2") { field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT2_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_NTCHBDWDT2") field(PREC, "5") } @@ -66,13 +66,13 @@ record(ao, "$(P)$(M)ANALOGINPUT") field(DESC,"Set Analog Target Input") field(ASG,"Reserved") field(DTYP, "asynFloat64") - field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_ANALOGTARGET_$(ADDR)") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_ANALOGTARGET") } record(ai, "$(P)$(M)RBKP") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKP_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKP") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -80,7 +80,7 @@ record(ai, "$(P)$(M)RBKP") record(ai, "$(P)$(M)RBKI") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKI_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKI") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -88,7 +88,7 @@ record(ai, "$(P)$(M)RBKI") record(ai, "$(P)$(M)RBKFF") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKFF_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBKFF") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -96,7 +96,7 @@ record(ai, "$(P)$(M)RBKFF") record(ai, "$(P)$(M)RBNTCHFR1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR1_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR1") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -104,7 +104,7 @@ record(ai, "$(P)$(M)RBNTCHFR1") record(ai, "$(P)$(M)RBNTCHFR2") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR2_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHFR2") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -112,7 +112,7 @@ record(ai, "$(P)$(M)RBNTCHFR2") record(ai, "$(P)$(M)RBNTCHRJT1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT1_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT1") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -120,7 +120,7 @@ record(ai, "$(P)$(M)RBNTCHRJT1") record(ai, "$(P)$(M)RBNTCHRJT2") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT2_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHRJT2") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -128,7 +128,7 @@ record(ai, "$(P)$(M)RBNTCHRJT2") record(ai, "$(P)$(M)RBNTCHBDWDT1") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT1_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT1") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -136,7 +136,7 @@ record(ai, "$(P)$(M)RBNTCHBDWDT1") record(ai, "$(P)$(M)RBNTCHBDWDT2") { field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT2_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBNTCHBDWDT2") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -145,7 +145,7 @@ record(ai, "$(P)$(M)RBANALOGINPUT") { field(DESC,"Read Analog Target Input") field(DTYP, "asynFloat64") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBANALOGTARGET_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBANALOGTARGET") field(PREC, "5") field(SCAN, "I/O Intr") } @@ -154,7 +154,7 @@ record(bi, "$(P)$(M)RBONT") { field(DESC,"Read On-Target") field(DTYP, "asynInt32") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBONT_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBONT") field(SCAN, "I/O Intr") } @@ -162,6 +162,6 @@ record(bi, "$(P)$(M)RBOVF") { field(DESC,"Read Over Flow") field(DTYP, "asynInt32") - field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBOVF_$(ADDR)") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PI_SUP_RBOVF") field(SCAN, "I/O Intr") } diff --git a/pigcs2App/src/PIE727Controller.cpp b/pigcs2App/src/PIE727Controller.cpp index e47f504..7101eae 100644 --- a/pigcs2App/src/PIE727Controller.cpp +++ b/pigcs2App/src/PIE727Controller.cpp @@ -90,21 +90,21 @@ asynStatus PIE727Controller::setCLAxisParam( PIasynAxis* pAxis, unsigned int par return status; } -double PIE727Controller::getCLAxisParam( PIasynAxis* pAxis , unsigned int paramID) -{ - double pValue=0; +asynStatus PIE727Controller::getCLAxisParam( PIasynAxis* pAxis , unsigned int paramID, double& value) +{ + asynStatus status = asynSuccess; if (pAxis != NULL) { - getGCSParameter(pAxis, paramID , pValue); + status = getGCSParameter(pAxis, paramID , value); } // printf("getCLAxisParam() axis %d, param: 0x%.8x = %f\r\n",pAxis->getAxisNo(), paramID, pValue); - return pValue; + return status; } -// get axis target status on the controller E727 +// get axis On-target status on the controller E727 asynStatus PIE727Controller::getAxisOnt(PIasynAxis* pAxis,int& value) { @@ -127,6 +127,7 @@ asynStatus PIE727Controller::getAxisOnt(PIasynAxis* pAxis,int& value) return status; } +// get axis Over Flow status on the controller E727 asynStatus PIE727Controller::getAxisOvf(PIasynAxis* pAxis,int& value) { char cmd[100]; diff --git a/pigcs2App/src/PIE727Controller.h b/pigcs2App/src/PIE727Controller.h index f9cae34..6d0f87e 100644 --- a/pigcs2App/src/PIE727Controller.h +++ b/pigcs2App/src/PIE727Controller.h @@ -37,8 +37,8 @@ class PIE727Controller : public PIGCSPiezoController // virtual asynStatus getStatus(PIasynAxis* pAxis, int& homing, int& moving, int& negLimit, int& posLimit, int& servoControl){return asynSuccess;} - virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double wantedValue ); - virtual double getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID); + virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double value ); + virtual asynStatus getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double& value); virtual asynStatus getAxisOnt(PIasynAxis* pAxis, int& value); virtual asynStatus getAxisOvf(PIasynAxis* pAxis, int& value); diff --git a/pigcs2App/src/PIGCS2PiezoCL.h b/pigcs2App/src/PIGCS2PiezoCL.h index e0a1f20..ad5a138 100644 --- a/pigcs2App/src/PIGCS2PiezoCL.h +++ b/pigcs2App/src/PIGCS2PiezoCL.h @@ -28,104 +28,28 @@ Mar 01, 2024 // ------------- X Axis Closed loop Parameters ------------- -#define KP_String std::string("PI_SUP_KP_") -#define KI_String std::string("PI_SUP_KI_") // I-term Gain -#define KFF_String std::string("PI_SUP_KFF_") // Feed Foward Gain -#define NTCHFR1_String std::string("PI_SUP_NTCHFR1_") // Notch frequncy 1 -#define NTCHFR2_String std::string("PI_SUP_NTCHFR2_") // Notch frequncy 2 -#define NTCHRJT1_String std::string("PI_SUP_NTCHRJT1_") // Notch reject 1 -#define NTCHRJT2_String std::string("PI_SUP_NTCHRJT2_") // Notch reject 2 -#define NTCHBDWDT1_String std::string("PI_SUP_NTCHBDWDT1_") // Notch bandwidth 1 -#define NTCHBDWDT2_String std::string("PI_SUP_NTCHBDWDT2_") // Notch bandwidth 2 -#define RBKP_String std::string("PI_SUP_RBKP_") -#define RBKI_String std::string("PI_SUP_RBKI_") -#define RBKFF_String std::string("PI_SUP_RBKFF_") -#define RBNTCHFR1_String std::string("PI_SUP_RBNTCHFR1_") -#define RBNTCHFR2_String std::string("PI_SUP_RBNTCHFR2_") -#define RBNTCHRJT1_String std::string("PI_SUP_RBNTCHRJT1_") -#define RBNTCHRJT2_String std::string("PI_SUP_RBNTCHRJT2_") -#define RBNTCHBDWDT1_String std::string("PI_SUP_RBNTCHBDWDT1_") -#define RBNTCHBDWDT2_String std::string("PI_SUP_RBNTCHBDWDT2_") -#define RBONT_String std::string("PI_SUP_RBONT_") -#define RBOVF_String std::string("PI_SUP_RBOVF_") -#define ANALOGTARGET_String std::string("PI_SUP_ANALOGTARGET_") -#define RBANALOGTARGET_String std::string("PI_SUP_RBANALOGTARGET_") - -// ------------- X Axis Closed loop Parameters ------------- -#define PI_SUP_KP_X_String "PI_SUP_KP_X" // P-term Gain -#define PI_SUP_KI_X_String "PI_SUP_KI_X" // I-term Gain -#define PI_SUP_KFF_X_String "PI_SUP_KFF_X" // Feed Foward Gain - -#define PI_SUP_NTCHFR1_X_String "PI_SUP_NTCHFR1_X" // Notch frequncy 1 -#define PI_SUP_NTCHFR2_X_String "PI_SUP_NTCHFR2_X" // Notch frequncy 2 -#define PI_SUP_NTCHRJT1_X_String "PI_SUP_NTCHRJT1_X" // Notch reject 1 -#define PI_SUP_NTCHRJT2_X_String "PI_SUP_NTCHRJT2_X" // Notch reject 2 -#define PI_SUP_NTCHBDWDT1_X_String "PI_SUP_NTCHBDWDT1_X" // Notch bandwidth 1 -#define PI_SUP_NTCHBDWDT2_X_String "PI_SUP_NTCHBDWDT2_X" // Notch bandwidth 2 -#define PI_SUP_ANALOGTARGET_X_String "PI_SUP_ANALOGTARGET_X" - -#define PI_SUP_RBKP_X_String "PI_SUP_RBKP_X" -#define PI_SUP_RBKI_X_String "PI_SUP_RBKI_X" -#define PI_SUP_RBKFF_X_String "PI_SUP_RBKFF_X" - -#define PI_SUP_RBNTCHFR1_X_String "PI_SUP_RBNTCHFR1_X" -#define PI_SUP_RBNTCHFR2_X_String "PI_SUP_RBNTCHFR2_X" -#define PI_SUP_RBNTCHRJT1_X_String "PI_SUP_RBNTCHRJT1_X" -#define PI_SUP_RBNTCHRJT2_X_String "PI_SUP_RBNTCHRJT2_X" -#define PI_SUP_RBNTCHBDWDT1_X_String "PI_SUP_RBNTCHBDWDT1_X" -#define PI_SUP_RBNTCHBDWDT2_X_String "PI_SUP_RBNTCHBDWDT2_X" -#define PI_SUP_RBANALOGTARGET_X_String "PI_SUP_RBANALOGTARGET_X" - -// ------------- Y Axis Closed loop Parameters ------------- -#define PI_SUP_KP_Y_String "PI_SUP_KP_Y" -#define PI_SUP_KI_Y_String "PI_SUP_KI_Y" -#define PI_SUP_KFF_Y_String "PI_SUP_KFF_Y" - -#define PI_SUP_NTCHFR1_Y_String "PI_SUP_NTCHFR1_Y" -#define PI_SUP_NTCHFR2_Y_String "PI_SUP_NTCHFR2_Y" -#define PI_SUP_NTCHRJT1_Y_String "PI_SUP_NTCHRJT1_Y" -#define PI_SUP_NTCHRJT2_Y_String "PI_SUP_NTCHRJT2_Y" -#define PI_SUP_NTCHBDWDT1_Y_String "PI_SUP_NTCHBDWDT1_Y" -#define PI_SUP_NTCHBDWDT2_Y_String "PI_SUP_NTCHBDWDT2_Y" -#define PI_SUP_ANALOGTARGET_Y_String "PI_SUP_ANALOGTARGET_Y" - -#define PI_SUP_RBKP_Y_String "PI_SUP_RBKP_Y" -#define PI_SUP_RBKI_Y_String "PI_SUP_RBKI_Y" -#define PI_SUP_RBKFF_Y_String "PI_SUP_RBKFF_Y" - -#define PI_SUP_RBNTCHFR1_Y_String "PI_SUP_RBNTCHFR1_Y" -#define PI_SUP_RBNTCHFR2_Y_String "PI_SUP_RBNTCHFR2_Y" -#define PI_SUP_RBNTCHRJT1_Y_String "PI_SUP_RBNTCHRJT1_Y" -#define PI_SUP_RBNTCHRJT2_Y_String "PI_SUP_RBNTCHRJT2_Y" -#define PI_SUP_RBNTCHBDWDT1_Y_String "PI_SUP_RBNTCHBDWDT1_Y" -#define PI_SUP_RBNTCHBDWDT2_Y_String "PI_SUP_RBNTCHBDWDT2_Y" -#define PI_SUP_RBANALOGTARGET_Y_String "PI_SUP_RBANALOGTARGET_Y" - - -// ------------- Z Axis Closed loop Parameters ------------- -#define PI_SUP_KP_Z_String "PI_SUP_KP_Z" -#define PI_SUP_KI_Z_String "PI_SUP_KI_Z" -#define PI_SUP_KFF_Z_String "PI_SUP_KFF_Z" - -#define PI_SUP_NTCHFR1_Z_String "PI_SUP_NTCHFR1_Z" -#define PI_SUP_NTCHFR2_Z_String "PI_SUP_NTCHFR2_Z" -#define PI_SUP_NTCHRJT1_Z_String "PI_SUP_NTCHRJT1_Z" -#define PI_SUP_NTCHRJT2_Z_String "PI_SUP_NTCHRJT2_Z" -#define PI_SUP_NTCHBDWDT1_Z_String "PI_SUP_NTCHBDWDT1_Z" -#define PI_SUP_NTCHBDWDT2_Z_String "PI_SUP_NTCHBDWDT2_Z" -#define PI_SUP_ANALOGTARGET_Z_String "PI_SUP_ANALOGTARGET_Z" - -#define PI_SUP_RBKP_Z_String "PI_SUP_RBKP_Z" -#define PI_SUP_RBKI_Z_String "PI_SUP_RBKI_Z" -#define PI_SUP_RBKFF_Z_String "PI_SUP_RBKFF_Z" - -#define PI_SUP_RBNTCHFR1_Z_String "PI_SUP_RBNTCHFR1_Z" -#define PI_SUP_RBNTCHFR2_Z_String "PI_SUP_RBNTCHFR2_Z" -#define PI_SUP_RBNTCHRJT1_Z_String "PI_SUP_RBNTCHRJT1_Z" -#define PI_SUP_RBNTCHRJT2_Z_String "PI_SUP_RBNTCHRJT2_Z" -#define PI_SUP_RBNTCHBDWDT1_Z_String "PI_SUP_RBNTCHBDWDT1_Z" -#define PI_SUP_RBNTCHBDWDT2_Z_String "PI_SUP_RBNTCHBDWDT2_Z" -#define PI_SUP_RBANALOGTARGET_Z_String "PI_SUP_RBANALOGTARGET_Z" +#define KP_String "PI_SUP_KP" +#define KI_String "PI_SUP_KI" // I-term Gain +#define KFF_String "PI_SUP_KFF" // Feed Foward Gain +#define NTCHFR1_String "PI_SUP_NTCHFR1" // Notch frequncy 1 +#define NTCHFR2_String "PI_SUP_NTCHFR2" // Notch frequncy 2 +#define NTCHRJT1_String "PI_SUP_NTCHRJT1" // Notch reject 1 +#define NTCHRJT2_String "PI_SUP_NTCHRJT2" // Notch reject 2 +#define NTCHBDWDT1_String "PI_SUP_NTCHBDWDT1" // Notch bandwidth 1 +#define NTCHBDWDT2_String "PI_SUP_NTCHBDWDT2" // Notch bandwidth 2 +#define RBKP_String "PI_SUP_RBKP" +#define RBKI_String "PI_SUP_RBKI" +#define RBKFF_String "PI_SUP_RBKFF" +#define RBNTCHFR1_String "PI_SUP_RBNTCHFR1" +#define RBNTCHFR2_String "PI_SUP_RBNTCHFR2" +#define RBNTCHRJT1_String "PI_SUP_RBNTCHRJT1" +#define RBNTCHRJT2_String "PI_SUP_RBNTCHRJT2" +#define RBNTCHBDWDT1_String "PI_SUP_RBNTCHBDWDT1" +#define RBNTCHBDWDT2_String "PI_SUP_RBNTCHBDWDT2" +#define RBONT_String "PI_SUP_RBONT" +#define RBOVF_String "PI_SUP_RBOVF" +#define ANALOGTARGET_String "PI_SUP_ANALOGTARGET" +#define RBANALOGTARGET_String "PI_SUP_RBANALOGTARGET" typedef struct PIGCS2PiezoCLValues{ diff --git a/pigcs2App/src/PIGCSController.h b/pigcs2App/src/PIGCSController.h index b56635b..dd0f7ce 100644 --- a/pigcs2App/src/PIGCSController.h +++ b/pigcs2App/src/PIGCSController.h @@ -86,8 +86,8 @@ class PIGCSController virtual double GetPivotZ() { return 0.0; } // Closed loop parameters - virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double wantedValue ){return asynSuccess;} - virtual double getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID){return 0.0;} + virtual asynStatus setCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double value ){return asynSuccess;} + virtual asynStatus getCLAxisParam( PIasynAxis* pAxis, unsigned int paramID, double& value ){value=0.0; return asynSuccess;} virtual asynStatus getAxisOnt(PIasynAxis* pAxis, int& value){return asynSuccess;} virtual asynStatus getAxisOvf(PIasynAxis* pAxis, int& value){return asynSuccess;} diff --git a/pigcs2App/src/PIGCSPiezoController.cpp b/pigcs2App/src/PIGCSPiezoController.cpp index 4d055ee..7ff5eed 100644 --- a/pigcs2App/src/PIGCSPiezoController.cpp +++ b/pigcs2App/src/PIGCSPiezoController.cpp @@ -66,13 +66,12 @@ asynStatus PIGCSPiezoController::getStatus(PIasynAxis* pAxis, int& homing, int& negLimit = 0; posLimit = 0; - sprintf(cmd, "SVO? %s", pAxis->m_szAxisName); - status = m_pInterface->sendAndReceive(cmd, buf, 99); + status = getServo(pAxis, servoControl); if (status != asynSuccess) { return status; } - getValue(buf, servoControl); + } return status; diff --git a/pigcs2App/src/PIasynAxis.cpp b/pigcs2App/src/PIasynAxis.cpp index 79ce6a2..c64b066 100644 --- a/pigcs2App/src/PIasynAxis.cpp +++ b/pigcs2App/src/PIasynAxis.cpp @@ -112,37 +112,6 @@ PIasynAxis::~PIasynAxis() } } -void PIasynAxis::createCLParams(const int axis) -{ - char axisName[2]; - sprintf(axisName,"%d",axis); - // printf("------------------- createCLParams() axis %s %s ------------------- \r\n",KP_String,axisName ); - - pController_->createParam( (KP_String + axisName).c_str() , asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KP); - pController_->createParam( (KI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KI); - pController_->createParam( (KFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KFF); - pController_->createParam( (NTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR1); - pController_->createParam( (NTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR2); - pController_->createParam( (NTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT1); - pController_->createParam( (NTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT2); - pController_->createParam( (NTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT1); - pController_->createParam( (NTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT2); - pController_->createParam( (ANALOGTARGET_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_ANALOGTARGET); - pController_->createParam( (RBKP_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKP); - pController_->createParam( (RBKI_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKI); - pController_->createParam( (RBKFF_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKFF); - pController_->createParam( (RBNTCHFR1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR1); - pController_->createParam( (RBNTCHFR2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR2); - pController_->createParam( (RBNTCHRJT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT1); - pController_->createParam( (RBNTCHRJT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT2); - pController_->createParam( (RBNTCHBDWDT1_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT1); - pController_->createParam( (RBNTCHBDWDT2_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT2); - pController_->createParam( (RBANALOGTARGET_String + axisName).c_str(), asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBANALOGTARGET); - - pController_->createParam( (RBONT_String + axisName).c_str(), asynParamInt32, &m_CloseLoopValue.PI_SUP_RBONT); - pController_->createParam( (RBOVF_String + axisName).c_str(), asynParamInt32, &m_CloseLoopValue.PI_SUP_RBOVF); -} - asynStatus PIasynAxis::poll(bool *returnMoving) { int done = 0; @@ -150,7 +119,6 @@ asynStatus PIasynAxis::poll(bool *returnMoving) int moving, negLimit, posLimit, servoControl; int oldHoming = m_isHoming; m_pGCSController->getStatus(this, m_isHoming, moving, negLimit, posLimit, servoControl); - m_pGCSController->getServo(this, servoControl); if (moving == 0 && m_isHoming == 0) done = 1; @@ -198,17 +166,17 @@ asynStatus PIasynAxis::poll(bool *returnMoving) int axisont; m_pGCSController->getAxisOnt(this, axisont); - setIntegerParam(m_CloseLoopValue.PI_SUP_RBONT,axisont); + setIntegerParam(pController_->m_CloseLoopValue.PI_SUP_RBONT,axisont); int axisovf = 0; m_pGCSController->getAxisOvf(this, axisovf); - setIntegerParam(m_CloseLoopValue.PI_SUP_RBOVF,axisovf); + setIntegerParam(pController_->m_CloseLoopValue.PI_SUP_RBOVF,axisovf); for(unsigned int param=0 ; paramgetCLAxisParam(this,PI727_CL_PARAM_ADDR::All[param]); - setDoubleParam(m_CloseLoopParam.CLParams_arr[param+PIGCS2_CL_PARAM_QTT],ValueAxisParam); + m_pGCSController->getCLAxisParam(this,PI727_CL_PARAM_ADDR::All[param], ValueAxisParam); + setDoubleParam(pController_->m_CloseLoopParam.CLParams_arr[param+PIGCS2_CL_PARAM_QTT],ValueAxisParam); } } @@ -218,18 +186,18 @@ asynStatus PIasynAxis::poll(bool *returnMoving) asynPrint(pasynUser_, ASYN_TRACE_FLOW, "PIasynAxis::poll() axis %d referencing ...\n", axisNo_ ); } - setDoubleParam(pController_->motorPosition_, m_positionCts ); - setDoubleParam(pController_->motorEncoderPosition_, m_positionCts); - setIntegerParam(pController_->motorStatusDirection_, m_lastDirection); - setIntegerParam(pController_->motorStatusDone_, done ); - setIntegerParam(pController_->motorStatusHighLimit_, posLimit); - setIntegerParam(pController_->motorStatusHomed_, m_homed ); - setIntegerParam(pController_->motorStatusMoving_, !done ); - setIntegerParam(pController_->motorStatusLowLimit_, negLimit); + setDoubleParam(pController_->motorPosition_, m_positionCts ); + setDoubleParam(pController_->motorEncoderPosition_, m_positionCts); + setIntegerParam(pController_->motorStatusDirection_, m_lastDirection); + setIntegerParam(pController_->motorStatusDone_, done ); + setIntegerParam(pController_->motorStatusHighLimit_, posLimit); + setIntegerParam(pController_->motorStatusHomed_, m_homed ); + setIntegerParam(pController_->motorStatusMoving_, !done ); + setIntegerParam(pController_->motorStatusLowLimit_, negLimit); setIntegerParam(pController_->motorStatusGainSupport_, true); setIntegerParam(pController_->motorStatusProblem_, m_bProblem); setIntegerParam(pController_->motorStatusPowerOn_, m_bServoControl); - setIntegerParam(pController_->PI_SUP_SERVO, m_bServoControl ); + setIntegerParam(pController_->PI_SUP_SERVO, m_bServoControl ); callParamCallbacks(); diff --git a/pigcs2App/src/PIasynAxis.h b/pigcs2App/src/PIasynAxis.h index 3e317c7..f772765 100644 --- a/pigcs2App/src/PIasynAxis.h +++ b/pigcs2App/src/PIasynAxis.h @@ -18,7 +18,7 @@ Based on drvMotorSim.c, Mark Rivers, December 13, 2009 #include // for asynStatus #include -#include "PIGCS2PiezoCL.h" +//#include "PIGCS2PiezoCL.h" class PIasynController; class PIGCSController; @@ -41,9 +41,6 @@ class PIasynAxis : public asynMotorAxis virtual asynStatus stop(double acceleration); virtual asynStatus setPosition(double position); - - void createCLParams(const int axis); - char* m_szAxisName; ///< GCS name int m_isHoming; ///< if \b TRUE indicating that axis is currently homing/referencing @@ -73,9 +70,6 @@ class PIasynAxis : public asynMotorAxis bool m_bSetServoAfterHoming; int m_movingStateMask; - u_PIGCS2PiezoCLParams m_CloseLoopParam; - PIGCS2PiezoCLValues m_CloseLoopValue; - friend class PIasynController; private: diff --git a/pigcs2App/src/PIasynController.cpp b/pigcs2App/src/PIasynController.cpp index f8354be..08bff4e 100644 --- a/pigcs2App/src/PIasynController.cpp +++ b/pigcs2App/src/PIasynController.cpp @@ -61,6 +61,10 @@ PIasynController::PIasynController(const char *portName, const char* asynPort, i , movesDeferred( 0 ) , m_pGCSController( NULL ) { + int axis; + PIasynAxis *pAxis; + PIasynControllerNode *pNode; + createParam(PI_SUP_POSITION_String, asynParamFloat64, &PI_SUP_POSITION); createParam(PI_SUP_TARGET_String, asynParamFloat64, &PI_SUP_TARGET); createParam(PI_SUP_SERVO_String, asynParamInt32, &PI_SUP_SERVO); @@ -73,9 +77,28 @@ PIasynController::PIasynController(const char *portName, const char* asynPort, i createParam(PI_SUP_RBPIVOT_Y_String, asynParamFloat64, &PI_SUP_RBPIVOT_Y); createParam(PI_SUP_RBPIVOT_Z_String, asynParamFloat64, &PI_SUP_RBPIVOT_Z); - int axis; - PIasynAxis *pAxis; - PIasynControllerNode *pNode; + createParam(KP_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KP); + createParam(KI_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KI); + createParam(KFF_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_KFF); + createParam(NTCHFR1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR1); + createParam(NTCHFR2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHFR2); + createParam(NTCHRJT1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT1); + createParam(NTCHRJT2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHRJT2); + createParam(NTCHBDWDT1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT1); + createParam(NTCHBDWDT2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_NTCHBDWDT2); + createParam(ANALOGTARGET_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_ANALOGTARGET); + createParam(RBKP_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKP); + createParam(RBKI_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKI); + createParam(RBKFF_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBKFF); + createParam(RBNTCHFR1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR1); + createParam(RBNTCHFR2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHFR2); + createParam(RBNTCHRJT1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT1); + createParam(RBNTCHRJT2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHRJT2); + createParam(RBNTCHBDWDT1_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT1); + createParam(RBNTCHBDWDT2_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBNTCHBDWDT2); + createParam(RBANALOGTARGET_String, asynParamFloat64, &m_CloseLoopParam.CLParams_str.PI_SUP_RBANALOGTARGET); + createParam(RBONT_String, asynParamInt32, &m_CloseLoopValue.PI_SUP_RBONT); + createParam(RBOVF_String, asynParamInt32, &m_CloseLoopValue.PI_SUP_RBOVF); if (!PIasynControllerListInitialized) { @@ -156,8 +179,6 @@ PIasynController::PIasynController(const char *portName, const char* asynPort, i { pAxis = new PIasynAxis(this, m_pGCSController, axis, m_pGCSController->getAxesID(axis)); pAxis->Init(portName); - - pAxis->createCLParams(axis); } startPoller(double(movingPollPeriod)/1000, double(idlePollPeriod)/1000, 10); @@ -330,7 +351,7 @@ asynStatus PIasynController::writeFloat64(asynUser *pasynUser, epicsFloat64 valu for(cl_iter = 0; cl_iter < PIGCS2_CL_PARAM_QTT; cl_iter++) { - if ( (function == pAxis->m_CloseLoopParam.CLParams_arr[cl_iter]) ) + if ( (function == m_CloseLoopParam.CLParams_arr[cl_iter]) ) { status = m_pGCSController->setCLAxisParam( pAxis, PI727_CL_PARAM_ADDR::All[cl_iter], value ); break; @@ -507,25 +528,28 @@ asynStatus PIasynController::configAxis(PIasynAxis *pAxis) asynStatus PIasynController::poll() { - PIasynAxis *pAxis; - m_pGCSController->getGlobalState(pAxes_, numAxes_); - setDoubleParam( 0, PI_SUP_RBPIVOT_X, m_pGCSController->GetPivotX()); - setDoubleParam( 0, PI_SUP_RBPIVOT_Y, m_pGCSController->GetPivotY()); - setDoubleParam( 0, PI_SUP_RBPIVOT_Z, m_pGCSController->GetPivotZ()); + setDoubleParam(0, PI_SUP_RBPIVOT_X, m_pGCSController->GetPivotX()); + setDoubleParam(0, PI_SUP_RBPIVOT_Y, m_pGCSController->GetPivotY()); + setDoubleParam(0, PI_SUP_RBPIVOT_Z, m_pGCSController->GetPivotZ()); + /* + PIasynAxis *pAxis; for (int axis=0; axis < this->numAxes_; axis++) { pAxis = getPIAxis(axis); for(unsigned int param=0 ; paramm_CloseLoopParam.CLParams_arr[param+PIGCS2_CL_PARAM_QTT], m_pGCSController->getCLAxisParam(pAxis,PI727_CL_PARAM_ADDR::All[param])); + double ValueAxisParam=0; + m_pGCSController->getCLAxisParam(pAxis,PI727_CL_PARAM_ADDR::All[param], ValueAxisParam) + pAxis->setDoubleParam(m_CloseLoopParam.CLParams_arr[param+PIGCS2_CL_PARAM_QTT], ValueAxisParam); } } + */ - setIntegerParam( 0, PI_SUP_LAST_ERR, m_pGCSController->GetLastError() ); + setIntegerParam(0, PI_SUP_LAST_ERR, m_pGCSController->GetLastError() ); callParamCallbacks(); return asynSuccess; diff --git a/pigcs2App/src/PIasynController.h b/pigcs2App/src/PIasynController.h index c4cc8a6..af02c11 100644 --- a/pigcs2App/src/PIasynController.h +++ b/pigcs2App/src/PIasynController.h @@ -20,6 +20,7 @@ December 13, 2009 #include "asynMotorController.h" #include "asynMotorAxis.h" +#include "PIGCS2PiezoCL.h" class PIasynAxis; class PIGCSController; @@ -39,6 +40,9 @@ class PIasynController : asynMotorController { virtual asynStatus poll(); + u_PIGCS2PiezoCLParams m_CloseLoopParam; + PIGCS2PiezoCLValues m_CloseLoopValue; + friend class PIasynAxis; private: @@ -65,7 +69,6 @@ class PIasynController : asynMotorController { }; - #define PI_SUP_POSITION_String "PI_SUP_POSITION" #define PI_SUP_TARGET_String "PI_SUP_TARGET" #define PI_SUP_SERVO_String "PI_SUP_SERVO"