Loading Common/Errors/ComponentErrors/idl/ComponentErrors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -102,4 +102,8 @@ <ErrorCode name="ComponentNotActive" shortDescription="Component not active" description="" /> <ErrorCode name="CanNotStartThread" shortDescription="An internal thread could not be started" description=""> <Member name="ThreadName" type="string" description="Name of the thread" /> </ErrorCode> </Type> Noto/Configuration/CDB/MACI/Components/MINORSERVO/Boss/Boss.xml +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="Boss" Code="MinorServo.MinorServoImpl" Code="NotoMinorServoBoss.MinorServoImpl" Type="IDL:alma/MinorServo/MinorServoBoss:1.0" Container="NotoMinorServoContainer" ImplLang="py" Loading Noto/Servers/NotoPyMinorServo/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ PY_SCRIPTS_L = PY_MODULES = PY_MODULES_L = PY_PACKAGES = MinorServo PY_PACKAGES = NotoMinorServoBoss PY_PACKAGES_L = pppppp_MODULES = Loading Noto/Servers/NotoPyMinorServo/src/MinorServo/MinorServoImpl.py→Noto/Servers/NotoPyMinorServo/src/NotoMinorServoBoss/MinorServoImpl.py +52 −46 Original line number Diff line number Diff line Loading @@ -22,9 +22,8 @@ import ManagementErrorsImpl import ManagementErrors import socket from MinorServo.servo import Servo from MinorServo.devios import stringDevIO from NotoMinorServoBoss.servo import Servo from NotoMinorServoBoss.devios import stringDevIO from IRAPy import logger Loading Loading @@ -69,15 +68,8 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): services.__init__(self) self.minorServo = Servo(services()) self.control = Control() """ ************************************************************ comment in in order to perform connection to SCU self.minorServo.connect() """ #self._setDefaultSetup() try: self.workingThread=services().getThread(name='Worker',target=MinorServoImpl.worker,args=(self.minorServo,self.control)) self.workingThread.start() Loading @@ -86,31 +78,19 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx """ #self.control = Control() #try: # self.supplier = Supplier(Receivers.DEWAR_POSITIONER_DATA_CHANNEL) #except CORBAProblemExImpl, ex: # logger.logError('cannot create the dewar positioner data channel') # logger.logDebug('cannot create the data channel: %s' %ex.message) #except Exception, ex: # reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message # logger.logError(reason) #try: # self.statusThread = services().getThread( # name='Publisher', # target=DewarPositionerImpl.publisher, # args=(self.positioner, self.supplier, self.control) # ) # self.statusThread.start() #except AttributeError, ex: # logger.logWarning('supplier not available') # logger.logDebug('supplier not available: %s' %ex.message) #except Exception, ex: # logger.logError('cannot create the status thread: %s' %ex.message) """ try: self.supplier=Supplier(MinorServo.MINORSERVO_DATA_CHANNEL) except CORBAProblemExImpl, ex: newEx=ComponentErrorsImpl.NotificationChannelErrorExImpl(exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx try: self.publisherThread=services().getThread(name='Publisher',target=MinorServoImpl.publisher,args=(self.minorServo, self.supplier, self.control)) self.publisherThread.start() except Exception, ex: newEx=ComponentErrorsImpl.CanNotStartThreadExImpl( exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx def initialize(self): addProperty(self,'actualSetup',devio_ref=stringDevIO(self.minorServo),prop_type="ROstring") Loading @@ -136,11 +116,13 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): self.workingThread.join(timeout=5) if self.statusThread.isAlive(): services().getLogger().logWarnig('working thread still alive and properly closed') self.supplier.disconnect() except Exception,ex: pass finally: self.control.stop=False """ Set the elevation tracking flag to "ON" or "OFF" :param value "ON" or "OFF" Loading Loading @@ -381,6 +363,7 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): def setup(self, code): try: self.minorServo.setup(code) logger.logNotice('minor servo being configured: %s' %code) except ManagementErrorsImpl.ConfigurationErrorExImpl,ex: raise ex Loading Loading @@ -1023,16 +1006,39 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): def worker(servo, control, sleep_time=1): while True: try: print 'working' servo.updatePosition() except Exception, ex: newEx=ComponentErrorsImpl.OperationErrorExImpl(exception=ex,create=1) newEx.log(services().getLogger(),ACSLog.ACS_LOG_ERROR) finally: time.sleep(sleep_time) """ The contenet of the event structure is: ACS::Time timeMark; boolean tracking; boolean starting; boolean parking; boolean parked; Management::TSystemStatus status; Presently I have to apply static values, i.e. tracking=TRUE, starting=TRUE, parking=False, Parked=False, status=Management.MNG_OK """ @staticmethod def publisher(servo, supplier, control, sleep_time=1): while True: if control.stop: break else: try: event=MinorServo.MinorServoDataBlock(getTimeStamp().value,True,True,False,False,Management.MNG_OK) supplier.publishEvent(simple_data=event) except Exception, ex: newEx=ComponentErrorsImpl.NotificationChannelErrorExImpl(exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_WARNING) finally: time.sleep(sleep_time) class Control(object): def __init__(self): self.stop = False self.mngStatus = Management.MNG_WARNING Noto/Servers/NotoPyMinorServo/src/MinorServo/__init__.py→Noto/Servers/NotoPyMinorServo/src/NotoMinorServoBoss/__init__.py +0 −0 File moved. Loading
Common/Errors/ComponentErrors/idl/ComponentErrors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -102,4 +102,8 @@ <ErrorCode name="ComponentNotActive" shortDescription="Component not active" description="" /> <ErrorCode name="CanNotStartThread" shortDescription="An internal thread could not be started" description=""> <Member name="ThreadName" type="string" description="Name of the thread" /> </ErrorCode> </Type>
Noto/Configuration/CDB/MACI/Components/MINORSERVO/Boss/Boss.xml +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="Boss" Code="MinorServo.MinorServoImpl" Code="NotoMinorServoBoss.MinorServoImpl" Type="IDL:alma/MinorServo/MinorServoBoss:1.0" Container="NotoMinorServoContainer" ImplLang="py" Loading
Noto/Servers/NotoPyMinorServo/src/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ PY_SCRIPTS_L = PY_MODULES = PY_MODULES_L = PY_PACKAGES = MinorServo PY_PACKAGES = NotoMinorServoBoss PY_PACKAGES_L = pppppp_MODULES = Loading
Noto/Servers/NotoPyMinorServo/src/MinorServo/MinorServoImpl.py→Noto/Servers/NotoPyMinorServo/src/NotoMinorServoBoss/MinorServoImpl.py +52 −46 Original line number Diff line number Diff line Loading @@ -22,9 +22,8 @@ import ManagementErrorsImpl import ManagementErrors import socket from MinorServo.servo import Servo from MinorServo.devios import stringDevIO from NotoMinorServoBoss.servo import Servo from NotoMinorServoBoss.devios import stringDevIO from IRAPy import logger Loading Loading @@ -69,15 +68,8 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): services.__init__(self) self.minorServo = Servo(services()) self.control = Control() """ ************************************************************ comment in in order to perform connection to SCU self.minorServo.connect() """ #self._setDefaultSetup() try: self.workingThread=services().getThread(name='Worker',target=MinorServoImpl.worker,args=(self.minorServo,self.control)) self.workingThread.start() Loading @@ -86,31 +78,19 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx """ #self.control = Control() #try: # self.supplier = Supplier(Receivers.DEWAR_POSITIONER_DATA_CHANNEL) #except CORBAProblemExImpl, ex: # logger.logError('cannot create the dewar positioner data channel') # logger.logDebug('cannot create the data channel: %s' %ex.message) #except Exception, ex: # reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message # logger.logError(reason) #try: # self.statusThread = services().getThread( # name='Publisher', # target=DewarPositionerImpl.publisher, # args=(self.positioner, self.supplier, self.control) # ) # self.statusThread.start() #except AttributeError, ex: # logger.logWarning('supplier not available') # logger.logDebug('supplier not available: %s' %ex.message) #except Exception, ex: # logger.logError('cannot create the status thread: %s' %ex.message) """ try: self.supplier=Supplier(MinorServo.MINORSERVO_DATA_CHANNEL) except CORBAProblemExImpl, ex: newEx=ComponentErrorsImpl.NotificationChannelErrorExImpl(exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx try: self.publisherThread=services().getThread(name='Publisher',target=MinorServoImpl.publisher,args=(self.minorServo, self.supplier, self.control)) self.publisherThread.start() except Exception, ex: newEx=ComponentErrorsImpl.CanNotStartThreadExImpl( exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_DEBUG) raise newEx def initialize(self): addProperty(self,'actualSetup',devio_ref=stringDevIO(self.minorServo),prop_type="ROstring") Loading @@ -136,11 +116,13 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): self.workingThread.join(timeout=5) if self.statusThread.isAlive(): services().getLogger().logWarnig('working thread still alive and properly closed') self.supplier.disconnect() except Exception,ex: pass finally: self.control.stop=False """ Set the elevation tracking flag to "ON" or "OFF" :param value "ON" or "OFF" Loading Loading @@ -381,6 +363,7 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): def setup(self, code): try: self.minorServo.setup(code) logger.logNotice('minor servo being configured: %s' %code) except ManagementErrorsImpl.ConfigurationErrorExImpl,ex: raise ex Loading Loading @@ -1023,16 +1006,39 @@ class MinorServoImpl(POA, charcomponent, services, lcycle): def worker(servo, control, sleep_time=1): while True: try: print 'working' servo.updatePosition() except Exception, ex: newEx=ComponentErrorsImpl.OperationErrorExImpl(exception=ex,create=1) newEx.log(services().getLogger(),ACSLog.ACS_LOG_ERROR) finally: time.sleep(sleep_time) """ The contenet of the event structure is: ACS::Time timeMark; boolean tracking; boolean starting; boolean parking; boolean parked; Management::TSystemStatus status; Presently I have to apply static values, i.e. tracking=TRUE, starting=TRUE, parking=False, Parked=False, status=Management.MNG_OK """ @staticmethod def publisher(servo, supplier, control, sleep_time=1): while True: if control.stop: break else: try: event=MinorServo.MinorServoDataBlock(getTimeStamp().value,True,True,False,False,Management.MNG_OK) supplier.publishEvent(simple_data=event) except Exception, ex: newEx=ComponentErrorsImpl.NotificationChannelErrorExImpl(exception=ex, create=1 ) newEx.log(services().getLogger(),ACSLog.ACS_LOG_WARNING) finally: time.sleep(sleep_time) class Control(object): def __init__(self): self.stop = False self.mngStatus = Management.MNG_WARNING
Noto/Servers/NotoPyMinorServo/src/MinorServo/__init__.py→Noto/Servers/NotoPyMinorServo/src/NotoMinorServoBoss/__init__.py +0 −0 File moved.