diff --git a/Common/Interfaces/ReceiversInterface/idl/GenericDerotator.idl b/Common/Interfaces/ReceiversInterface/idl/GenericDerotator.idl index c336518c0378b6e0d0cf7e0f2afeca686a7b9414..4a2a2ab7085057031382ff818391f5fc61cd1c60 100644 --- a/Common/Interfaces/ReceiversInterface/idl/GenericDerotator.idl +++ b/Common/Interfaces/ReceiversInterface/idl/GenericDerotator.idl @@ -43,10 +43,7 @@ module Receivers { * <h3>Methods</h3>: * <ul> * <li>setup(): allow the derotator to be ready to move</li> - * <li>powerOff(): switch the power amplifier off </li> * <li>setPosition(): set the derotator position</li> - * <li>setSpeed(): set the derotator speed, in rpm</li> - * <li>getSpeed(): get the derotator speed, in rpm</li> * <li>getActPosition(): return the actPosition value</li> * <li>getCmdPosition(): return the cmdPosition value</li> * <li>getPositionFromHistory(t): return the the derotator position at @@ -61,7 +58,8 @@ module Receivers { * <li>isSlewing(): return true when the derotator is moving</li> * </ul> */ - interface GenericDerotator : ACS::CharacteristicComponent { + interface GenericDerotator + { /** * This property returns the sensor encoder position in the user @@ -125,14 +123,6 @@ module Receivers { ); - /** Switch the power amplifier off - * - * @throw CORBA::SystemException - * @throw ComponentErrors::ComponentErrorsEx - */ - void powerOff() raises (ComponentErrors::ComponentErrorsEx); - - /** * @return the actPosition property value * @@ -147,6 +137,17 @@ module Receivers { ); + /** + * This method loads a position that has to be tracked by the derotator + * @param point_time an ACS::Time object indicating the time associated with the coordinates to be tracked. + * Only the start time is sent to the derotator and the points after are always spaced by the same amount of time from one another. + * It is still necessary to fill this field in order to associate a time to the coordinates inside the component. + * @param position the position to track at the given time + * @param restart flag that says the given point is the first of a new trajectory + */ + void loadTrackingPoint(in ACS::Time point_time, in double position, in boolean restart) raises (DerotatorErrors::DerotatorErrorsEx); + + /** * @return the cmdPosition property value * @@ -178,32 +179,6 @@ module Receivers { double getPositionFromHistory(in ACS::Time t) raises (ComponentErrors::ComponentErrorsEx); - /** - * Set the derotator speed - * - * @arg speed speed in rpm - * @throw ComponentErrors::ComponentErrorsEx, - * @throw DerotatorErrors::DerotatorErrorsEx - */ - void setSpeed(in unsigned long speed) raises ( - ComponentErrors::ComponentErrorsEx, - DerotatorErrors::DerotatorErrorsEx - ); - - - /** - * Get the derotator speed - * - * @return the derotator speed in rpm - * @throw ComponentErrors::ComponentErrorsEx, - * @throw DerotatorErrors::DerotatorErrorsEx - */ - unsigned long getSpeed() raises ( - ComponentErrors::ComponentErrorsEx, - DerotatorErrors::DerotatorErrorsEx - ); - - /** * Return the maximum position value allowed. * @throw CORBA::SystemException diff --git a/Common/Servers/PyDewarPositioner/config/CDB/schemas/DewarPositioner.xsd b/Common/Servers/PyDewarPositioner/config/CDB/schemas/DewarPositioner.xsd index d9bb3de6496adc73f6f49714688337ba56cc49af..45d7b2f3928c6bbca1505b12df7617c0b6559f99 100644 --- a/Common/Servers/PyDewarPositioner/config/CDB/schemas/DewarPositioner.xsd +++ b/Common/Servers/PyDewarPositioner/config/CDB/schemas/DewarPositioner.xsd @@ -25,6 +25,7 @@ <!--xs:attribute name="actionThreadStackSize" type="xs:unsignedLong" use="optional" default="1024" /> <xs:attribute name="monitoringThreadStackSize" type="xs:unsignedLong" use="optional" default="2048" /--> <xs:attribute name="UpdatingTime" type="xs:double" use="required" /> + <xs:attribute name="TrackingLeadTime" type="xs:double" use="required" /> <xs:attribute name="RewindingSleepTime" type="xs:double" use="required" /> <xs:attribute name="RewindingTimeout" type="xs:double" use="required" /> <xs:attribute name="DefaultConfiguration" type="xs:string" use="required" /> diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py index f41d8a955daccedf796b2ad363e4dba49112d8b5..2d03721d2f71e7bdd4f95cc7beb0dcb72ab7468c 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/DewarPositionerImpl.py @@ -75,9 +75,9 @@ class DewarPositionerImpl(POA, cc, services, lcycle): self.supplier = Supplier(Receivers.DEWAR_POSITIONER_DATA_CHANNEL) except CORBAProblemExImpl as ex: logger.logError('cannot create the dewar positioner data channel') - logger.logDebug('cannot create the data channel: %s' %ex.message) + logger.logDebug('cannot create the data channel: %s' %ex) except Exception as ex: - reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message + reason = ex.getReason() if hasattr(ex, 'getReason') else ex logger.logError(reason) try: @@ -89,9 +89,9 @@ class DewarPositionerImpl(POA, cc, services, lcycle): self.statusThread.start() except AttributeError as ex: logger.logWarning('supplier not available') - logger.logDebug('supplier not available: %s' %ex.message) + logger.logDebug('supplier not available: %s' %ex) except Exception as ex: - logger.logError('cannot create the status thread: %s' %ex.message) + logger.logError('cannot create the status thread: %s' %ex) def initialize(self): addProperty(self, 'status', devio_ref=StatusDevIO(self.positioner)) @@ -104,9 +104,9 @@ class DewarPositionerImpl(POA, cc, services, lcycle): if self.statusThread.isAlive(): logger.logError('thread %s is alive' %self.statusThread.getName()) except AttributeError as ex: - logger.logDebug('self has no attribute `supplier`: %s' %ex.message) + logger.logDebug('self has no attribute `supplier`: %s' %ex) except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) finally: self.control.stop = False @@ -119,15 +119,15 @@ class DewarPositionerImpl(POA, cc, services, lcycle): deviceName = self.cdbconf.getAttribute('DerotatorName') device = self.client.getComponent(deviceName) except CannotGetComponentEx as ex: - reason = "cannot get the %s component: %s" %(deviceName, ex.message) + reason = "cannot get the %s component: %s" %(deviceName, ex) logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() try: @@ -137,7 +137,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): latitude_dec, compl = lat_obj.get_sync() latitude = radians(latitude_dec) except Exception as ex: - reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message + reason = ex.getReason() if hasattr(ex, 'getReason') else ex logger.logWarning('cannot get the site information: %s' %reason) latitude = radians(float(self.cdbconf.getAttribute('Latitude'))) logger.logWarning('setting the default latitude value: %.2f radians' %latitude) @@ -163,9 +163,9 @@ class DewarPositionerImpl(POA, cc, services, lcycle): self.actualSetup = self.commandedSetup logger.logNotice('derotator %s setup done' %self.commandedSetup) except PositionerError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.OperationErrorExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except ComponentErrors.ComponentErrorsEx as ex: data_list = ex.errorTrace.data # A list @@ -175,7 +175,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message + reason = ex.getReason() if hasattr(ex, 'getReason') else ex logger.logError(reason) exc = ComponentErrorsImpl.UnexpectedExImpl() exc.setData('Reason', reason) @@ -191,14 +191,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): logger.logWarning('positioner not ready: a setup() is required') self.positioner.park() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() finally: self._setDefaultSetup() @@ -209,19 +209,19 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.getPosition() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except (DerotatorErrors.CommunicationErrorEx, ComponentErrors.ComponentErrorsEx) as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason("Cannot get the derotator position") raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -229,14 +229,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.getMaxLimit() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -244,14 +244,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.getMinLimit() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -259,33 +259,33 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.getPositionFromHistory(t) except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except (DerotatorErrors.CommunicationErrorEx, ComponentErrors.ComponentErrorsEx) as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason("Cannot get the derotator position at the time %s" %s) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def getCmdPosition(self): try: return self.positioner.getCmdPosition() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -293,14 +293,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: self.positioner.setPosition(position) except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -355,19 +355,19 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: self.positioner.startUpdating(axis, sector, az, el, ra, dec) except PositionerError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.OperationErrorExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) - exc = ComponentErrorsImpl.UnexpectedExImpl(ex.message) - exc.setData('Reason', ex.message) + logger.logError(ex) + exc = ComponentErrorsImpl.UnexpectedExImpl(ex) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def stopUpdating(self): @@ -375,14 +375,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: self.positioner.stopUpdating() except PositionerError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.OperationErrorExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() logger.logNotice('derotator position updating stopped') @@ -391,9 +391,9 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: self.positioner.setAutoRewindingSteps(steps) except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() @@ -409,15 +409,15 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.rewind(steps) except (PositionerError, NotAllowedError) as ex: - reason = "cannot rewind the derotator: %s" %ex.message + reason = "cannot rewind the derotator: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -433,14 +433,14 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.getRewindingStep() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -454,45 +454,45 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: return self.positioner.isReady() except DerotatorErrors.CommunicationErrorEx as ex: - reason = "cannot known if the derotator is ready: %s" %ex.message + reason = "cannot known if the derotator is ready: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def isSlewing(self): try: return self.positioner.isSlewing() except DerotatorErrors.CommunicationErrorEx as ex: - reason = "cannot known if the derotator is slewing: %s" %ex.message + reason = "cannot known if the derotator is slewing: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def isTracking(self): try: return self.positioner.isTracking() except DerotatorErrors.CommunicationErrorEx as ex: - reason = "cannot known if the derotator is tracking: %s" %ex.message + reason = "cannot known if the derotator is tracking: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def isUpdating(self): @@ -502,40 +502,40 @@ class DewarPositionerImpl(POA, cc, services, lcycle): try: self.positioner.setOffset(offset) except (PositionerError, NotAllowedError) as ex: - reason = "cannot set the derotator offset: %s" %ex.message + reason = "cannot set the derotator offset: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() def clearOffset(self): try: self.positioner.clearOffset() except PositionerError as ex: - reason = "cannot set the derotator offset: %s" %ex.message + reason = "cannot set the derotator offset: %s" %ex logger.logError(reason) exc = ComponentErrorsImpl.OperationErrorExImpl() exc.setReason(reason) raise exc.getComponentErrorsEx() except NotAllowedError as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.NotAllowedExImpl() - exc.setReason(ex.message) + exc.setReason(ex) raise exc.getComponentErrorsEx() except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) exc = ComponentErrorsImpl.UnexpectedExImpl() - exc.setData('Reason', ex.message) + exc.setData('Reason', ex) raise exc.getComponentErrorsEx() @@ -556,7 +556,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): mode = mode.upper().strip() self.positioner.setRewindingMode(mode) except PositionerError as ex: - reason = 'cannot set the rewinding mode: %s' %ex.message + reason = 'cannot set the rewinding mode: %s' %ex logger.logError(reason) exc = ComponentErrorsImpl.ValidationErrorExImpl() exc.setReason(reason) @@ -584,7 +584,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): self.positioner.control.clearScanInfo() self.cdbconf.setConfiguration(confCode.upper()) except Exception as ex: - reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message + reason = ex.getReason() if hasattr(ex, 'getReason') else ex logger.logError(reason) exc = ComponentErrorsImpl.UnexpectedExImpl() exc.setData('Reason', reason) @@ -633,7 +633,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): supplier.publishEvent(simple_data=event) error = False except Exception as ex: - reason = ex.getReason() if hasattr(ex, 'getReason') else ex.message + reason = ex.getReason() if hasattr(ex, 'getReason') else ex if not error: logger.logError('cannot publish the status: %s' %reason) error = True @@ -658,7 +658,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): answer = 'Error - invalid command: maybe there are too many symbols of =' except Exception as ex: success = False - answer = ex.message + answer = ex else: success = True @@ -712,7 +712,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): except (ValueError, TypeError) as ex: success = False answer = 'Error - wrong parameter usage.\nType help(%s) for details' %command - logger.logError('%s\n%s' %(ex.message, answer)) + logger.logError('%s\n%s' %(ex, answer)) return (success, answer) except ComponentErrors.ComponentErrorsEx as ex: success = False @@ -723,7 +723,7 @@ class DewarPositionerImpl(POA, cc, services, lcycle): return (success, answer) except Exception as ex: success = False - msg = ex.message if ex.message else 'unexpected exception' + msg = ex if ex else 'unexpected exception' answer = 'Error - %s' %(ex.getReason() if hasattr(ex, 'getReason') else msg) logger.logError(answer) return (success, answer) diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py index e31369e9e86584e7d20a6b071cfb23a9306d7c7d..40b7a3b582b1a528de2e5b46c7610c598a92bcff 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/cdbconf.py @@ -11,6 +11,7 @@ class CDBConf(object): componentAttributes = ( 'UpdatingTime', + 'TrackingLeadTime', 'RewindingSleepTime', 'RewindingTimeout', 'DefaultConfiguration', diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/posgenerator.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/posgenerator.py index 935a1dc7478dc29f10728b57f2d15360414440c0..f6f6820e8c53d365d8b0e3307993f2f4abc9fb54 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/posgenerator.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/posgenerator.py @@ -1,124 +1,98 @@ -"""This module implements the position generators""" +"""This module implements the position calculation functions""" import datetime import time -from math import sin, cos, tan, atan2, degrees +from math import sin, cos, tan, atan2, degrees, isclose from IRAPy import logger from Acspy.Common.TimeHelper import getTimeStamp class PosGenerator(object): - def __init__(self, zdtimeout=5): - self.zdtimeout = zdtimeout # Timeout in case of zero division error + def __init__(self, updatingTime, trackingLeadTime): + self.updatingTime = updatingTime + self.trackingLeadTime = trackingLeadTime self.mapping = { 'parallactic': { - 'getAngleFunction': PosGenerator.getParallacticAngle, + 'getAngleFunction': PosGenerator.getParallacticAngle, 'coordinateFrame': 'horizontal' }, 'galacticParallactic': { - 'getAngleFunction': PosGenerator.getGalacticParallacticAngle, + 'getAngleFunction': PosGenerator.getGalacticParallacticAngle, 'coordinateFrame': 'equatorial' }, } - + def goto(self, iStaticPos): yield iStaticPos - # TODO: refactoring required, in order to put all the parallactic and - # galacticParallactic common code in one place - def parallactic(self, source, siteInfo): + def parallactic(self, source, siteInfo, t): """Return the parallactic angle""" + latitude = PosGenerator.getLatitude(siteInfo) + try: - latitude = siteInfo['latitude'] - except (KeyError, TypeError) as ex: - raise PosGeneratorError('cannot get the latitude: %s' %ex.message) + coordinates = source.getApparentCoordinates(t) # Values in radians + az, el = coordinates[:2] # The first two elements are (az, el) + position = PosGenerator.getParallacticAngle(latitude, az, el) + return position except Exception as ex: - raeson = 'unexpected exception getting the site latitude' - logger.logNotice(raeson) + raeson = 'cannot get the %s (az, el) values' %source._get_name() + logger.logNotice('%s: %s' %(raeson, ex)) raise PosGeneratorError(raeson) - last_zerodiv_time = datetime.datetime.now() - while True: - try: - t = getTimeStamp().value + 1*10*6 # 100 ms in the future - coordinates = source.getApparentCoordinates(t) # Values in radians - az, el = coordinates[:2] # The first two elements are (az, el) - position = PosGenerator.getParallacticAngle(latitude, az, el) - yield position - last_zerodiv_time = datetime.datetime.now() - except ZeroDivisionError: - logger.logWarning('zero division error computing the parallactic angle') - zerodiv_time = datetime.datetime.now() - last_zerodiv_time - if zerodiv_time.seconds >= self.zdtimeout: - raeson = 'zero division for more than %ds' %self.zdtimeout - logger.logError(raeson) - raise PosGeneratorError(raeson) - else: - time.sleep(0.5) - continue - except GeneratorExit: # Required in Python 2.5: - # http://www.algorithm.co.il/blogs/programming/generatorexit-another-reason-to-upgrade-to-python-2-6/ - raise - except Exception as ex: - raeson = 'cannot get the %s (az, el) values' %source._get_name() - logger.logNotice('%s: %s' %(raeson, ex.message)) - raise PosGeneratorError(raeson) - - def galacticParallactic(self, source, siteInfo): + def galacticParallactic(self, source, siteInfo, t): """Return the galactic parallactic angle""" + latitude = PosGenerator.getLatitude(siteInfo) + + try: + coordinates = source.getApparentCoordinates(t) # Values in radians + az, el, ra, dec = coordinates[:4] + position = PosGenerator.getGalacticParallacticAngle(latitude, az, el, ra, dec) + return position + except Exception as ex: + raeson = 'cannot get the %s (az, el) values' %source._get_name() + logger.logNotice('%s: %s' %(raeson, ex)) + raise PosGeneratorError(raeson) + + @staticmethod + def getLatitude(siteInfo): + """Return the site latitude""" try: - latitude = siteInfo['latitude'] + return siteInfo['latitude'] except (KeyError, TypeError) as ex: - raise PosGeneratorError('cannot get the latitude: %s' %ex.message) + raise PosGeneratorError('cannot get the latitude: %s' %ex) except Exception as ex: - raeson = 'unexpected exception getting the site latitude' + raeson = 'unexpected exception getting the site latitude' logger.logNotice(raeson) raise PosGeneratorError(raeson) - last_zerodiv_time = datetime.datetime.now() - while True: - try: - t = getTimeStamp().value + 1*10*6 # 100 ms in the future - coordinates = source.getApparentCoordinates(t) # Values in radians - az, el, ra, dec = coordinates[:4] - pg = PosGenerator.getGalacticParallacticAngle(latitude, az, el, ra, dec) - yield pg - last_zerodiv_time = datetime.datetime.now() - except ZeroDivisionError: - logger.logWarning('zero division error computing the galactic parallactic angle') - zerodiv_time = datetime.datetime.now() - last_zerodiv_time - if zerodiv_time.seconds >= self.zdtimeout: - raeson = 'zero division for more than %ds' %self.zdtimeout - logger.logError(raeson) - raise PosGeneratorError(raeson) - else: - time.sleep(0.5) - continue - except GeneratorExit: # Required in Python 2.5: - # http://www.algorithm.co.il/blogs/programming/generatorexit-another-reason-to-upgrade-to-python-2-6/ - raise - except Exception as ex: - raeson = 'cannot get the %s (az, el) values' %source._get_name() - logger.logNotice('%s: %s' %(raeson, ex.message)) - raise PosGeneratorError(raeson) - @staticmethod def getParallacticAngle(latitude, az, el): """Arguments in radians""" - p = atan2(-sin(az), tan(latitude)*cos(el) - sin(el)*cos(az)) - return degrees(p) + denominator = tan(latitude) * cos(el) - sin(el) * cos(az) + + # Avoid division by zero and keep continuity + if isclose(denominator, 0, abs_tol=1e-10): + return -90.0 if sin(az) > 0 else 90.0 + + return degrees(atan2(-sin(az), denominator)) @staticmethod def getGalacticAngle(ra, dec): """Arguments in radians""" - # North celestial pole coordinates in equatorial celestial frame (j200) - # ncp = ('12 51 26.28', '27 07 41.7') + # North celestial pole coordinates in equatorial celestial frame (j2000) + # ncp = ('12 51 26.28', '27 07 41.7') # ra0 = ephem.hours(ncp[0]) # dec0 = ephem.degrees(ncp[1]) ra0 = 3.3660332687500043 dec0 = 0.47347728280415174 - g = atan2(sin(ra-ra0), cos(dec)*tan(dec0) - sin(dec)*cos(ra-ra0)) - return degrees(g) + + denominator = cos(dec) * tan(dec0) - sin(dec) * cos(ra-ra0) + + # Avoid division by zero and keep continuity + if isclose(denominator, 0, abs_tol=1e-10): + return 90.0 if sin(ra-ra0) > 0 else -90.0 + + return degrees(atan2(sin(ra-ra0), denominator)) @staticmethod def getGalacticParallacticAngle(latitude, az, el, ra, dec): @@ -127,7 +101,6 @@ class PosGenerator(object): g = PosGenerator.getGalacticAngle(ra, dec) return p + g - + class PosGeneratorError(Exception): pass - diff --git a/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py b/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py index 03fbc071be72baaeeb4dc9f5023ff4c0c592c5b4..62471aaa5186a6ea76eb752f0565bef53ed2bbc4 100644 --- a/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py +++ b/Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py @@ -25,7 +25,9 @@ class Positioner(object): The `cdbconf` parameter is a CDBConf instance. """ self.conf = cdbconf - self.posgen = PosGenerator() + self.updatingTime = int(float(self.conf.getAttribute('UpdatingTime')) * 10**7) + self.trackingLeadTime = int(float(self.conf.getAttribute('TrackingLeadTime')) * 10**7) + self.posgen = PosGenerator(self.updatingTime, self.trackingLeadTime) self._setDefault() @@ -57,12 +59,11 @@ class Positioner(object): self.is_setup = True time.sleep(0.4) # Give the device the time to accomplish the setup self.control.updateScanInfo({'iStaticPos': setupPosition}) - self._start(self.posgen.goto, setupPosition) - time.sleep(0.1) # Give the thread the time to finish + self._setPosition(setupPosition) except (DerotatorErrors.PositioningErrorEx, DerotatorErrors.CommunicationErrorEx) as ex: - raise PositionerError("cannot set the position: %s" %ex.message) + raise PositionerError("cannot set the position: %s" %ex) except Exception as ex: - raise PositionerError(ex.message) + raise PositionerError(ex) finally: Positioner.generalLock.release() @@ -120,7 +121,7 @@ class Positioner(object): # Set the initialPosition, in order to add it to the dynamic one self.control.user_position = position except Exception as ex: - raise PositionerError('cannot set the position: %s' %ex.message) + raise PositionerError('cannot set the position: %s' %ex) def _setPosition(self, position): @@ -130,11 +131,11 @@ class Positioner(object): self.device.setPosition(self.control.target) except (DerotatorErrors.PositioningErrorEx, DerotatorErrors.CommunicationErrorEx) as ex: raeson = "cannot set the %s position" %self.device._get_name() - logger.logError('%s: %s' %(raeson, ex.message)) + logger.logError('%s: %s' %(raeson, ex)) raise PositionerError(raeson) except Exception as ex: raeson = "unknown exception setting the %s position" %self.device._get_name() - logger.logError('%s: %s' %(raeson, ex.message)) + logger.logError('%s: %s' %(raeson, ex)) raise PositionerError(raeson) else: raise OutOfRangeError("position %.2f out of range {%.2f, %.2f}" @@ -179,22 +180,20 @@ class Positioner(object): dParallacticPos=0, rewindingOffset=0, ) - self._start(self.posgen.goto, position) + self._setPosition(position) + self.control.mustUpdate = False else: posgen = getattr(self.posgen, functionName) angle_mapping = self.posgen.mapping[functionName] getAngleFunction = self.posgen.mapping[functionName]['getAngleFunction'] coordinateFrame = self.posgen.mapping[functionName]['coordinateFrame'] lat = self.siteInfo['latitude'] - try: - if coordinateFrame == 'horizontal': - iParallacticPos = getAngleFunction(lat, az, el) - elif coordinateFrame == 'equatorial': - iParallacticPos = getAngleFunction(lat, az, el, ra, dec) - else: - raise PositionerError('coordinate frame %s unknown' %coordinateFrame) - except ZeroDivisionError: - raise NotAllowedError('zero division error computing p(%.2f, %.2f)' %(az, el)) + if coordinateFrame == 'horizontal': + iParallacticPos = getAngleFunction(lat, az, el) + elif coordinateFrame == 'equatorial': + iParallacticPos = getAngleFunction(lat, az, el, ra, dec) + else: + raise PositionerError('coordinate frame %s unknown' %coordinateFrame) self.control.setScanInfo( axis=axis, @@ -204,15 +203,19 @@ class Positioner(object): dParallacticPos=0, rewindingOffset=0, ) - self._start(posgen, self.source, self.siteInfo) - self.control.mustUpdate = True + self._start( + posgen, + self.source, + self.siteInfo + ) + self.control.mustUpdate = True except Exception as ex: - raise PositionerError('configuration problem: %s' %ex.message) + raise PositionerError('configuration problem: %s' %ex) finally: Positioner.generalLock.release() - def _updatePosition(self, posgen, vargs): + def _updatePosition(self, posgen, source, siteInfo): try: self.control.isRewindingRequired = False self.control.isRewinding = False @@ -229,20 +232,48 @@ class Positioner(object): else: isOptimized = False - for position in posgen(*vargs): + new_trajectory = True + while True: if self.control.stop: break else: try: + if new_trajectory: + t = getTimeStamp().value + self.trackingLeadTime + position = posgen(source, siteInfo, t) Pis = self.control.scanInfo['iStaticPos'] + self.control.scanInfo['rewindingOffset'] Pip = self.control.scanInfo['iParallacticPos'] - Pdp = 0 if posgen.__name__ == 'goto' else (position - Pip) + Pdp = position - Pip target = Pis + Pdp if isOptimized else Pis + Pip + Pdp self.control.scanInfo.update({'dParallacticPos': Pdp}) - self._setPosition(target) # _setPosition() will add the offset - time.sleep(float(self.conf.getAttribute('UpdatingTime'))) + + self.control.target = target + self.control.offset + if self.device.getMinLimit() < self.control.target < self.device.getMaxLimit(): + try: + self.device.loadTrackingPoint(t, self.control.target, new_trajectory) + new_trajectory = False + t += self.updatingTime + except (DerotatorErrors.PositioningErrorEx, DerotatorErrors.CommunicationErrorEx) as ex: + raeson = "cannot set the %s position" %self.device._get_name() + logger.logError('%s: %s' %(raeson, ex)) + raise PositionerError(raeson) + except Exception as ex: + raeson = "unknown exception setting the %s position" %self.device._get_name() + logger.logError('%s: %s' %(raeson, ex)) + raise PositionerError(raeson) + else: + raise OutOfRangeError("position %.2f out of range {%.2f, %.2f}" + %(self.control.target, self.device.getMinLimit(), self.device.getMaxLimit())) + # We calculate the time to sleep + # Next point of the trajectory - TrackingLeadTime - now + # slightly less than UpdatingTime + # The resulting cycle should be around + # TrackingLeadTime seconds before the next point + time_to_sleep = max(0, t - self.trackingLeadTime - getTimeStamp().value) + time.sleep(float(time_to_sleep) / 10**7) except OutOfRangeError as ex: - logger.logInfo(ex.message) + new_trajectory = True + logger.logInfo(ex) self.control.isRewindingRequired = True if self.control.modes['rewinding'] == 'AUTO': try: @@ -250,7 +281,7 @@ class Positioner(object): except Exception as ex: # In case of wrong autoRewindingSteps self.control.isRewindingRequired = True - logger.logError('cannot rewind: %s' %ex.message) + logger.logError('cannot rewind: %s' %ex) break else: if self.control.modes['rewinding'] == 'MANUAL': @@ -262,16 +293,16 @@ class Positioner(object): else: logger.logError('wrong rewinding mode: %s' %self.control.modes['rewinding']) except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) break self.control.mustUpdate = False except KeyboardInterrupt: logger.logInfo('stopping Positioner._updatePosition() due to KeyboardInterrupt') except AttributeError as ex: logger.logError('Positioner._updatePosition(): attribute error') - logger.logDebug('Positioner._updatePosition(): %s' %ex.message) + logger.logDebug('Positioner._updatePosition(): %s' %ex) except PositionerError as ex: - logger.logError('Positioner._updatePosition(): %s' %ex.message) + logger.logError('Positioner._updatePosition(): %s' %ex) except Exception as ex: logger.logError('unexcpected exception in Positioner._updatePosition(): %s' %ex) finally: @@ -315,7 +346,7 @@ class Positioner(object): self.control.isRewindingRequired = False except Exception as ex: self.control.isRewindingRequired = True - raise PositionerError(ex.message) + raise PositionerError(ex) finally: self.control.isRewinding = False Positioner.rewindingLock.release() @@ -417,7 +448,7 @@ class Positioner(object): try: Positioner.generalLock.acquire() self.control.updateScanInfo({'iStaticPos': parkPosition}) - self._start(self.posgen.goto, parkPosition) + self._setPosition(parkPosition) finally: Positioner.generalLock.release() time.sleep(0.5) # Wait the thread stops before to set the defaults @@ -466,7 +497,7 @@ class Positioner(object): Positioner.generalLock.acquire() self.stopUpdating() self.control.updateScanInfo({'iStaticPos': position}) - self._start(self.posgen.goto, position) + self._setPosition(position) finally: Positioner.generalLock.release() @@ -481,7 +512,7 @@ class Positioner(object): else: self.stopUpdating() actPosition = self.getPosition() - self._start(self.posgen.goto, actPosition) + self._setPosition(actPosition) def clearOffset(self): @@ -569,17 +600,17 @@ class Positioner(object): def clearAutoRewindingSteps(self): self.control.autoRewindingSteps = None - def _start(self, posgen, *vargs): + def _start(self, posgen, source, siteInfo): """Start a new process that computes and sets the position""" if self.isSetup(): # self.stopUpdating() # Raise a PositionerError if the process stills alive self.t = ContainerServices.ContainerServices().getThread( name=posgen.__name__, target=self._updatePosition, - args=(posgen, vargs) + args=(posgen, source, siteInfo) ) self.t.start() - time.sleep(0.10) # In case of goto, take the time to command the position + # time.sleep(0.10) # In case of goto, take the time to command the position else: raise NotAllowedError('not configured: a setConfiguration() is required') @@ -613,12 +644,12 @@ class Positioner(object): try: status_obj = self.device._get_status() except Exception as ex: - raise PositionerError('cannot get the device status property: %s' %ex.message) + raise PositionerError('cannot get the device status property: %s' %ex) try: device_status, compl = status_obj.get_sync() except Exception as ex: - raise PositionerError('cannot get the device status value: %s' %ex.message) + raise PositionerError('cannot get the device status value: %s' %ex) if compl.code: raise PositionerError('the device status value is not valid') @@ -641,7 +672,7 @@ class Positioner(object): try: binrepr = Status.dec2bin(device_status, 6) # A string of 6 values except Exception as ex: - raise PositionerError('error in Status.dec2bin(): %s' %ex.message) + raise PositionerError('error in Status.dec2bin(): %s' %ex) po, f, ce, nr, s, w = [bool(int(item)) for item in reversed(binrepr)] if po: @@ -665,7 +696,7 @@ class Positioner(object): except NotAllowedError as ex: return '000000' # Not ready except Exception as ex: - logger.logError(ex.message) + logger.logError(ex) return '100000' # Failure finally: Positioner.generalLock.release() diff --git a/SRT/CDB/MACI/Components/BACKENDS/NoiseGenerator/NoiseGenerator.xml b/SRT/CDB/MACI/Components/BACKENDS/NoiseGenerator/NoiseGenerator.xml deleted file mode 100644 index 431cf8a1dfa155e9772ad0a7b033f80f3ac24fdc..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Components/BACKENDS/NoiseGenerator/NoiseGenerator.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - History: - - ---> -<Component xmlns="urn:schemas-cosylab-com:Component:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - Name="NoiseGenerator" - Code="NoiseGeneratorImpl" - Type="IDL:alma/Backends/NoiseGenerator:1.0" - Container="NoiseGeneratorContainer" - Default="false" - KeepAliveTime="-1" - ImplLang="cpp" -/> diff --git a/SRT/CDB/MACI/Components/BACKENDS/XBackends/XBackends.xml b/SRT/CDB/MACI/Components/BACKENDS/XBackends/XBackends.xml deleted file mode 100644 index f008110b9512ebe7e1923862dcfa7acac78bc26c..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Components/BACKENDS/XBackends/XBackends.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - History: - - ---> -<Component xmlns="urn:schemas-cosylab-com:Component:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - Name="XBackends" - Code="XBackendsImpl" - Type="IDL:alma/Backends/XBackends:1.0" - Container="XContainer" - ImplLang="cpp" -/> -<!--"BackendsContainer"--> diff --git a/SRT/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml b/SRT/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml similarity index 70% rename from SRT/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml rename to SRT/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml index a5801b66da5c3bdcc192282f036f16269a5c689c..8e6e427d61ba49f9d73690ac98cc16bb24dd73ff 100644 --- a/SRT/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml +++ b/SRT/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml @@ -5,11 +5,10 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - Name="PFP" - Code="SRTProgramTrackMinorServoImpl" + Name="DR_GFR1" + Code="SRTDerotatorImpl" ImplLang="cpp" - Type="IDL:alma/MinorServo/SRTProgramTrackMinorServo:1.0" + Type="IDL:alma/MinorServo/SRTDerotator:1.0" Container="MinorServoContainer" - Default="true" - + Default="false" /> diff --git a/SRT/CDB/MACI/Components/MINORSERVO/GFR/GFR.xml b/SRT/CDB/MACI/Components/MINORSERVO/GFR/GFR.xml index 23da6db86964dbb40d2a49684fb7a0b11280d257..0b019b829da8a6d8c8821275e75d1597c45292db 100644 --- a/SRT/CDB/MACI/Components/MINORSERVO/GFR/GFR.xml +++ b/SRT/CDB/MACI/Components/MINORSERVO/GFR/GFR.xml @@ -5,10 +5,10 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - Name="GFR" + Name="GFR" Code="SRTGenericMinorServoImpl" ImplLang="cpp" Type="IDL:alma/MinorServo/SRTGenericMinorServo:1.0" Container="MinorServoContainer" - Default="true" + Default="false" /> diff --git a/SRT/CDB/MACI/Components/MINORSERVO/M3R/M3R.xml b/SRT/CDB/MACI/Components/MINORSERVO/M3R/M3R.xml index 94efe94c9728624cfaaab98a2f33e6adadde1420..1d904b9879d5a78f0624f7b650f2fee9ba3f0ca6 100644 --- a/SRT/CDB/MACI/Components/MINORSERVO/M3R/M3R.xml +++ b/SRT/CDB/MACI/Components/MINORSERVO/M3R/M3R.xml @@ -5,10 +5,10 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - Name="M3R" + Name="M3R" Code="SRTGenericMinorServoImpl" ImplLang="cpp" Type="IDL:alma/MinorServo/SRTGenericMinorServo:1.0" Container="MinorServoContainer" - Default="true" + Default="false" /> diff --git a/SRT/CDB/MACI/Components/MINORSERVO/SRP/SRP.xml b/SRT/CDB/MACI/Components/MINORSERVO/SRP/SRP.xml index b957480d671b04fb21d14738f5a90d079e1dab46..ebfabed00531afc5e842b0f30e659d71fd3b0989 100644 --- a/SRT/CDB/MACI/Components/MINORSERVO/SRP/SRP.xml +++ b/SRT/CDB/MACI/Components/MINORSERVO/SRP/SRP.xml @@ -10,6 +10,5 @@ ImplLang="cpp" Type="IDL:alma/MinorServo/SRTProgramTrackMinorServo:1.0" Container="MinorServoContainer" - Default="true" - + Default="false" /> diff --git a/SRT/CDB/MACI/Components/RECEIVERS/LO_LP/LO_LP.xml b/SRT/CDB/MACI/Components/RECEIVERS/LO_LP/LO_LP.xml deleted file mode 100644 index 8b5d8351bd4c6b07bbef2a8541a85c2cebabc8a1..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Components/RECEIVERS/LO_LP/LO_LP.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - History: - - ---> -<Component xmlns="urn:schemas-cosylab-com:Component:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - Name="LO_LP" - Code="LocalOscillatorSimImpl.LocalOscillator" - Type="IDL:alma/Receivers/LocalOscillator:1.0" - Container="LocalOscillatorLPContainer" - KeepAliveTime="10" - Default="false" - ImplLang="py" -/> diff --git a/SRT/CDB/MACI/Components/RECEIVERS/SRTIFDistributor/SRTIFDistributor.xml b/SRT/CDB/MACI/Components/RECEIVERS/SRTIFDistributor/SRTIFDistributor.xml deleted file mode 100644 index 42b5b7832dd5148a934fb81b7851fd1a057d8d65..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Components/RECEIVERS/SRTIFDistributor/SRTIFDistributor.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Giuseppe Carboni <gcarboni@oa-cagliari.inaf.it> ---> - -<Component - xmlns="urn:schemas-cosylab-com:Component:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - Name="SRTIFDistributor" - Code="IFDistributor.SRTIFDistributorImpl" - Type="IDL:alma/Receivers/SRTIFDistributor:1.0" - Container="PyIFDistributorContainer" - ImplLang="py" - Default="true" -/> diff --git a/SRT/CDB/MACI/Components/RECEIVERS/SRTLPBandReceiver/SRTLPBandReceiver.xml b/SRT/CDB/MACI/Components/RECEIVERS/SRTLPBandReceiver/SRTLPBandReceiver.xml deleted file mode 100644 index d6732b9634b6ffe7ef38f349e232b58e52042241..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Components/RECEIVERS/SRTLPBandReceiver/SRTLPBandReceiver.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - History: - - ---> -<Component xmlns="urn:schemas-cosylab-com:Component:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - Name="LPBandReceiver" - Code="SRTLPBandReceiverImpl" - Type="IDL:alma/Receivers/SRTLPBand:1.0" - Container="SRTLPBandContainer" - KeepAliveTime="-1" - Default="false" - ImplLang="cpp" -/> diff --git a/SRT/CDB/MACI/Containers/HolographyContainer/HolographyContainer.xml b/SRT/CDB/MACI/Containers/HolographyContainer/HolographyContainer.xml deleted file mode 100644 index b6cba55101bcf27a546f793603b02a26e8f08322..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/HolographyContainer/HolographyContainer.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<Container - xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="cpp" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - diff --git a/SRT/CDB/MACI/Containers/HolographyDXCContainer/HolographyDXCContainer.xml b/SRT/CDB/MACI/Containers/HolographyDXCContainer/HolographyDXCContainer.xml deleted file mode 100644 index 9d7d96a624f4723a03365959b0cb7fa44b72cf3e..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/HolographyDXCContainer/HolographyDXCContainer.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - ImplLang="py" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - - - diff --git a/SRT/CDB/MACI/Containers/LocalOscillatorLPContainer/LocalOscillatorLPContainer.xml b/SRT/CDB/MACI/Containers/LocalOscillatorLPContainer/LocalOscillatorLPContainer.xml deleted file mode 100644 index 46868e13ad92a6372bb14baa5bbe76874298cf80..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/LocalOscillatorLPContainer/LocalOscillatorLPContainer.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Author Infos - * ============ - * Name: Marco Buttu - * E-mail: mbuttu@oa-cagliari.inaf.it - * Personal Web: http://www.pypeople.com/ ---> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="py" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - - - diff --git a/SRT/CDB/MACI/Containers/LocalOscillatorsContainer/LocalOscillatorsContainer.xml b/SRT/CDB/MACI/Containers/LocalOscillatorsContainer/LocalOscillatorsContainer.xml deleted file mode 100644 index 3ea1b6d4d3ab4789105482f11f850deea25fabcd..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/LocalOscillatorsContainer/LocalOscillatorsContainer.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Author Infos - * ============ - * Name: Marco Buttu - * E-mail: mbuttu@oa-cagliari.inaf.it - * Personal Web: http://www.pypeople.com/ ---> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="cpp" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - - - diff --git a/SRT/CDB/MACI/Containers/NoiseGeneratorContainer/NoiseGeneratorContainer.xml b/SRT/CDB/MACI/Containers/NoiseGeneratorContainer/NoiseGeneratorContainer.xml deleted file mode 100644 index b6cba55101bcf27a546f793603b02a26e8f08322..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/NoiseGeneratorContainer/NoiseGeneratorContainer.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<Container - xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="cpp" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - diff --git a/SRT/CDB/MACI/Containers/PyIFDistributorContainer/PyIFDistributorContainer.xml b/SRT/CDB/MACI/Containers/PyIFDistributorContainer/PyIFDistributorContainer.xml deleted file mode 100644 index 6b7298a73d3d8510b380645dd11083ef760e46a6..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/PyIFDistributorContainer/PyIFDistributorContainer.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - ImplLang="py" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> diff --git a/SRT/CDB/MACI/Containers/SRTLPBandContainer/SRTLPBandContainer.xml b/SRT/CDB/MACI/Containers/SRTLPBandContainer/SRTLPBandContainer.xml deleted file mode 100644 index c555569cc46559503db2f2c9eb264265dbe1f243..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/SRTLPBandContainer/SRTLPBandContainer.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Author - * ================= - * Name: Marco Buttu ---> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="cpp" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> - -</Container> - - - diff --git a/SRT/CDB/MACI/Containers/XContainer/XContainer.xml b/SRT/CDB/MACI/Containers/XContainer/XContainer.xml deleted file mode 100644 index d807ff2239b7aee824dbeb7d00485f8deb624a90..0000000000000000000000000000000000000000 --- a/SRT/CDB/MACI/Containers/XContainer/XContainer.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<Container - xmlns="urn:schemas-cosylab-com:Container:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" - Timeout="30.0" - UseIFR="true" - ManagerRetry="10" - ImplLang="cpp" - Recovery="false"> - - <Autoload> - <cdb:e string="baci" /> - </Autoload> - - <LoggingConfig - centralizedLogger="Log" - minLogLevel="5" - minLogLevelLocal="5" - dispatchPacketSize="0" - immediateDispatchLevel="8" - flushPeriodSeconds="1" - > - </LoggingConfig> -</Container> - diff --git a/SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml b/SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml index 93d131c69fd427ee06d3fe6162cd70cfeacfdae5..7899633de04be80e1db5fdb5235a651b0b7e811f 100644 --- a/SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml +++ b/SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml @@ -4,7 +4,7 @@ xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - DerotatorName="RECEIVERS/SRTKBandDerotator" + DerotatorName="MINORSERVO/DR_GFR1" ObservatoryName="ANTENNA/Observatory" CoordinateSourceName="ANTENNA/Boss" SetupPosition="0.0" diff --git a/SRT/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml b/SRT/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ebb604a196bd97b9c3ed510977a3a8e6f2b93ca --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - Author: Giuseppe Carboni + - History: + - 14-03-23 Created +--> + +<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <physical_axes_enabled><property_name>ROTARY_AXIS_ENABLED</property_name></physical_axes_enabled> + <physical_positions><property_name>ROTATION</property_name></physical_positions> + <virtual_positions><property_name>ROTATION</property_name></virtual_positions> + <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> + <virtual_offsets><property_name>OFFSET</property_name></virtual_offsets> +</SRTMinorServoProperties> diff --git a/SRT/CDB/alma/DataBlock/MinorServo/PFP/Properties/Properties.xml b/SRT/CDB/alma/DataBlock/MinorServo/PFP/Properties/Properties.xml deleted file mode 100644 index 688491e3051fc40ae7a0b13e14b0ff78ca5f6ec9..0000000000000000000000000000000000000000 --- a/SRT/CDB/alma/DataBlock/MinorServo/PFP/Properties/Properties.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - Author: Giuseppe Carboni - - History: - - 14-03-23 Created ---> - -<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" - xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" - xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <physical_axes_enabled><property_name>X_ENABLED</property_name></physical_axes_enabled> - <physical_axes_enabled><property_name>Z_MASTER_ENABLED</property_name></physical_axes_enabled> - <physical_axes_enabled><property_name>Z_SLAVE_ENABLED</property_name></physical_axes_enabled> - <physical_axes_enabled><property_name>THETA_MASTER_ENABLED</property_name></physical_axes_enabled> - <physical_axes_enabled><property_name>THETA_SLAVE_ENABLED</property_name></physical_axes_enabled> - - <physical_positions><property_name>ELONG_X</property_name></physical_positions> - <physical_positions><property_name>ELONG_Z_MASTER</property_name></physical_positions> - <physical_positions><property_name>ELONG_Z_SLAVE</property_name></physical_positions> - <physical_positions><property_name>ELONG_THETA_MASTER</property_name></physical_positions> - <physical_positions><property_name>ELONG_THETA_SLAVE</property_name></physical_positions> - - <virtual_positions><property_name>TX</property_name></virtual_positions> - <virtual_positions><property_name>TZ</property_name></virtual_positions> - <virtual_positions><property_name>RTHETA</property_name></virtual_positions> - - <virtual_axes_units><property_name>mm</property_name></virtual_axes_units> - <virtual_axes_units><property_name>mm</property_name></virtual_axes_units> - <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> - - <virtual_offsets><property_name>OFFSET_TX</property_name></virtual_offsets> - <virtual_offsets><property_name>OFFSET_TZ</property_name></virtual_offsets> - <virtual_offsets><property_name>OFFSET_RTHETA</property_name></virtual_offsets> -</SRTMinorServoProperties> diff --git a/SRT/CDB/alma/DataBlock/MinorServo/Tabella Setup.csv b/SRT/CDB/alma/DataBlock/MinorServo/Tabella Setup.csv index 1a9f02b7e6b48354164204fc278b74b26841e964..a686bb1a552f4f941c41bd6b2a70f40265e0af25 100644 --- a/SRT/CDB/alma/DataBlock/MinorServo/Tabella Setup.csv +++ b/SRT/CDB/alma/DataBlock/MinorServo/Tabella Setup.csv @@ -1,7 +1,7 @@ CONFIGURATION;PFP_TX;PFP_TZ;PFP_RTHETA;SRP_TX;SRP_TY;SRP_TZ;SRP_RX;SRP_RY;SRP_RZ;M3R_RZ;GFR_RZ;DR_GFR1;DR_GFR2;DR_GFR3;DR_PFP;GREGORIAN_CAP; Primario;0;0;0;-5;5;-120;0;0;0;*;*;*;*;*;*;*; Gregoriano1;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;-88.70659;*;*;*;*;4; -Gregoriano2;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;-159.8899;*;*;*;*;4; +Gregoriano2;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;-159.8899;12.5;*;*;*;4; Gregoriano3;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;90.97161;*;*;*;*;4; Gregoriano4;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;162.771;*;*;*;*;4; Gregoriano5;0;0;0;-1.5;11.1393650793988;1.08830677049999;0.049894179898239;-0.036111111111111;0;*;55.373967;*;*;*;*;4; diff --git a/SRT/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml b/SRT/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml new file mode 100644 index 0000000000000000000000000000000000000000..18191fa8093e972bdf890aa8a2e674e85e41816a --- /dev/null +++ b/SRT/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + Authors: Giuseppe Carboni giuseppe.carboni@inaf.it +--> +<SRTDerotator + xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + physical_axes="1" + virtual_axes="1" + max_speed="3.276" + acceleration="2.67" + min_range="-130" + max_range="130" + step="60" + tracking_delta="0.1" + zero_offset="12.5"> + + <enabled description="All physical axes enabled" /> + <drive_cabinet_status description="Drive cabinet status" /> + <block description="Minor servo in block status" /> + <operative_mode description="Minor servo operating mode" /> + <physical_axes description="Number of physical axes" /> + <physical_axes_enabled description="Sequence, physical axes enabled" /> + <physical_positions description="Sequence, physical axes positions" /> + <virtual_axes description="Number of virtual axes" /> + <plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" /> + <virtual_positions description="Sequence, virtual axes positions, without offsets" /> + <virtual_offsets description="Sequence, sum of user and system virtual axis offsets" /> + <tracking description="Boolean indicating whether the servo is tracking the given coordinates" /> + <trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" /> + <total_trajectory_points description="Number of points sent for the current trajectory" /> + <remaining_trajectory_points description="Remaining points of the current trajectory" /> + <actPosition description="Current position, with sign inverted in respect to the LDO one"/> + <cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" /> + <positionDiff description="Difference between the commanded and the current position" /> + <status description="Bit pattern indicating the status of the derotator" /> + +</SRTDerotator> diff --git a/SRT/CDB/alma/RECEIVERS/Boss/Boss.xml b/SRT/CDB/alma/RECEIVERS/Boss/Boss.xml index 4f67761f9950703fd6fb856d82f9f11b8db7df9e..6f82987bbfe0ba70634578e4f26376e2ecbd2aa0 100644 --- a/SRT/CDB/alma/RECEIVERS/Boss/Boss.xml +++ b/SRT/CDB/alma/RECEIVERS/Boss/Boss.xml @@ -28,7 +28,7 @@ <AvailableReceiver Code="CCG" Derotator="false" Component="RECEIVERS/SRT5GHzReceiver"/> -<AvailableReceiver Code="KKG" Derotator="false" Component="RECEIVERS/SRTKBandMFReceiver"/> +<AvailableReceiver Code="KKG" Derotator="true" Component="RECEIVERS/SRTKBandMFReceiver"/> <AvailableReceiver Code="LLP" Derotator="false" Component="RECEIVERS/SRTLPBandReceiver"/> diff --git a/SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml b/SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml index 12b213ea443be960d2777527773b7f8d2ae39910..8a57982ba106769132cfdba23ebd8e6c8769e53d 100644 --- a/SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml +++ b/SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml @@ -4,7 +4,8 @@ xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - UpdatingTime="0.1" + UpdatingTime="0.2" + TrackingLeadTime="2.6" RewindingSleepTime="0.1" RewindingTimeout="200" DefaultConfiguration="FIXED" diff --git a/SRT/Configuration/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml b/SRT/Configuration/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml new file mode 100644 index 0000000000000000000000000000000000000000..8e6e427d61ba49f9d73690ac98cc16bb24dd73ff --- /dev/null +++ b/SRT/Configuration/CDB/MACI/Components/MINORSERVO/DR_GFR1/DR_GFR1.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Component + xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="DR_GFR1" + Code="SRTDerotatorImpl" + ImplLang="cpp" + Type="IDL:alma/MinorServo/SRTDerotator:1.0" + Container="MinorServoContainer" + Default="false" +/> diff --git a/SRT/Configuration/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml b/SRT/Configuration/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml index 93d131c69fd427ee06d3fe6162cd70cfeacfdae5..7899633de04be80e1db5fdb5235a651b0b7e811f 100644 --- a/SRT/Configuration/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml +++ b/SRT/Configuration/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml @@ -4,7 +4,7 @@ xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - DerotatorName="RECEIVERS/SRTKBandDerotator" + DerotatorName="MINORSERVO/DR_GFR1" ObservatoryName="ANTENNA/Observatory" CoordinateSourceName="ANTENNA/Boss" SetupPosition="0.0" diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ebb604a196bd97b9c3ed510977a3a8e6f2b93ca --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/DR_GFR1/Properties/Properties.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - Author: Giuseppe Carboni + - History: + - 14-03-23 Created +--> + +<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <physical_axes_enabled><property_name>ROTARY_AXIS_ENABLED</property_name></physical_axes_enabled> + <physical_positions><property_name>ROTATION</property_name></physical_positions> + <virtual_positions><property_name>ROTATION</property_name></virtual_positions> + <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> + <virtual_offsets><property_name>OFFSET</property_name></virtual_offsets> +</SRTMinorServoProperties> diff --git a/SRT/Configuration/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml b/SRT/Configuration/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml new file mode 100644 index 0000000000000000000000000000000000000000..18191fa8093e972bdf890aa8a2e674e85e41816a --- /dev/null +++ b/SRT/Configuration/CDB/alma/MINORSERVO/DR_GFR1/DR_GFR1.xml @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + Authors: Giuseppe Carboni giuseppe.carboni@inaf.it +--> +<SRTDerotator + xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + physical_axes="1" + virtual_axes="1" + max_speed="3.276" + acceleration="2.67" + min_range="-130" + max_range="130" + step="60" + tracking_delta="0.1" + zero_offset="12.5"> + + <enabled description="All physical axes enabled" /> + <drive_cabinet_status description="Drive cabinet status" /> + <block description="Minor servo in block status" /> + <operative_mode description="Minor servo operating mode" /> + <physical_axes description="Number of physical axes" /> + <physical_axes_enabled description="Sequence, physical axes enabled" /> + <physical_positions description="Sequence, physical axes positions" /> + <virtual_axes description="Number of virtual axes" /> + <plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" /> + <virtual_positions description="Sequence, virtual axes positions, without offsets" /> + <virtual_offsets description="Sequence, sum of user and system virtual axis offsets" /> + <tracking description="Boolean indicating whether the servo is tracking the given coordinates" /> + <trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" /> + <total_trajectory_points description="Number of points sent for the current trajectory" /> + <remaining_trajectory_points description="Remaining points of the current trajectory" /> + <actPosition description="Current position, with sign inverted in respect to the LDO one"/> + <cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" /> + <positionDiff description="Difference between the commanded and the current position" /> + <status description="Bit pattern indicating the status of the derotator" /> + +</SRTDerotator> diff --git a/SRT/Configuration/CDB/alma/RECEIVERS/Boss/Boss.xml b/SRT/Configuration/CDB/alma/RECEIVERS/Boss/Boss.xml index 4f67761f9950703fd6fb856d82f9f11b8db7df9e..b098cecce2304e86ef39aba69edb56be8e37120c 100644 --- a/SRT/Configuration/CDB/alma/RECEIVERS/Boss/Boss.xml +++ b/SRT/Configuration/CDB/alma/RECEIVERS/Boss/Boss.xml @@ -28,7 +28,7 @@ <AvailableReceiver Code="CCG" Derotator="false" Component="RECEIVERS/SRT5GHzReceiver"/> -<AvailableReceiver Code="KKG" Derotator="false" Component="RECEIVERS/SRTKBandMFReceiver"/> +<AvailableReceiver Code="KKG" Derotator="true" Component="RECEIVERS/SRTKBandMFReceiver"/> <AvailableReceiver Code="LLP" Derotator="false" Component="RECEIVERS/SRTLPBandReceiver"/> diff --git a/SRT/Configuration/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml b/SRT/Configuration/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml index 12b213ea443be960d2777527773b7f8d2ae39910..8a57982ba106769132cfdba23ebd8e6c8769e53d 100644 --- a/SRT/Configuration/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml +++ b/SRT/Configuration/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml @@ -4,7 +4,8 @@ xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - UpdatingTime="0.1" + UpdatingTime="0.2" + TrackingLeadTime="2.6" RewindingSleepTime="0.1" RewindingTimeout="200" DefaultConfiguration="FIXED" diff --git a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTDerotator.idl b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTDerotator.idl new file mode 100644 index 0000000000000000000000000000000000000000..aa65c3ccc937c5957320c47cbe00ab1a6c0e7be0 --- /dev/null +++ b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTDerotator.idl @@ -0,0 +1,44 @@ +#ifndef __SRTDEROTATOR_IDL__ +#define __SRTDEROTATOR_IDL__ +/***************************************************************\ + * Authors: + * Giuseppe Carboni <giuseppe.carboni@inaf.it> + * + * Created: Mon May 06 10:00:00 CEST 2024 +\***************************************************************/ + +#include "GenericDerotator.idl" +#include "SRTMinorServoCommon.idl" + +#pragma prefix "alma" + +module MinorServo +{ + /** + * This IDL interface describes the CORBA interface of a common Leonardo Derotator component. + */ + interface SRTDerotator : SRTLDOBaseProperties, Receivers::GenericDerotator, ACS::CharacteristicComponent + { + /** + * This property indicates the ID of the trajectory. It always corresponds to starting time of the trajectory, expressed as the UNIX Epoch * 1000 (long) + */ + readonly attribute ACS::ROlong trajectory_id; + + /** + * This property indicates the total number of points loaded into the current trajectory + */ + readonly attribute ACS::ROlong total_trajectory_points; + + /** + * This property indicates the number of points of the current trajectory which remain to be tracked + */ + readonly attribute ACS::ROlong remaining_trajectory_points; + + /** + * This method asks the hardware its status and updates the properties. + */ + boolean updateStatus(); + }; +}; + +#endif diff --git a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl index b88d589425cfde7d01be5cb95193f67df5f9960b..6cd48ffbe58ef99d9bd1923e8bf2689062e8749f 100644 --- a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl +++ b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl @@ -17,61 +17,8 @@ module MinorServo * This IDL interface describes the CORBA interface of a common SRTMinorServo component. * This is simply the base interface from which the SRTGenericMinorServo and SRTProgramTrackMinorServo interfaces inherit. */ - interface SRTBaseMinorServo : ACS::CharacteristicComponent + interface SRTBaseMinorServo : SRTLDOBaseProperties, ACS::CharacteristicComponent { - /** - * This property tells if all the servo axes are enabled - */ - readonly attribute Management::ROTBoolean enabled; - - /** - * This property tells the status of the servo drive cabinet - */ - readonly attribute ROSRTMinorServoCabinetStatus drive_cabinet_status; - - /** - * This property tells if the servo is in blocked state and cannot move - */ - readonly attribute Management::ROTBoolean block; - - /** - * This property returns the current operative mode of the servo - */ - readonly attribute ROSRTMinorServoOperativeMode operative_mode; - - /** - * This property returns the sequence of statuses of the servo physical axes - */ - readonly attribute ACS::RObooleanSeq physical_axes_enabled; - - /** - * This property returns the sequence of current positions of the physical axes of the servo - */ - readonly attribute ACS::ROdoubleSeq physical_positions; - - /** - * This property returns the number of virtual axes of the servo - */ - readonly attribute ACS::ROlong virtual_axes; - - /** - * This property returns the current plain positions of the virtual axes of the servo - * The plain positions are the positions returned from the Leonardo servo system, without subtracting the offsets - */ - readonly attribute ACS::ROdoubleSeq plain_virtual_positions; - - /** - * This property returns the current positions of the virtual axes of the servo - * The positions returned by this property equals to the plain virtual positions minus the offsets - */ - readonly attribute ACS::ROdoubleSeq virtual_positions; - - /** - * This property returns the current offsets of the virtual axes of the servo - * The offset values are the sum of user and system offsets - */ - readonly attribute ACS::ROdoubleSeq virtual_offsets; - /** * This property returns the current user offsets of the virtual axes of the servo */ diff --git a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServoCommon.midl b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServoCommon.midl index 45980430fa97f2591b1769bc83542e6daa0a64a7..54c6585a69fd4321eb67ebeca1ffc85b2412d962 100644 --- a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServoCommon.midl +++ b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServoCommon.midl @@ -126,5 +126,65 @@ module MinorServo ERROR_DRIVE_CABINET }; ACS_ENUM(SRTMinorServoError); + + /* + * This IDL interface describes the CORBA interface of a common Leonardo Minor Servo System component. + * This interface contains the properties that are common to a focus path minor servo system and a derotator minor servo system. + */ + interface SRTLDOBaseProperties + { + /** + * This property tells if all the servo axes are enabled + */ + readonly attribute Management::ROTBoolean enabled; + + /** + * This property tells the status of the servo drive cabinet + */ + readonly attribute ROSRTMinorServoCabinetStatus drive_cabinet_status; + + /** + * This property tells if the servo is in blocked state and cannot move + */ + readonly attribute Management::ROTBoolean block; + + /** + * This property returns the current operative mode of the servo + */ + readonly attribute ROSRTMinorServoOperativeMode operative_mode; + + /** + * This property returns the sequence of statuses of the servo physical axes + */ + readonly attribute ACS::RObooleanSeq physical_axes_enabled; + + /** + * This property returns the sequence of current positions of the physical axes of the servo + */ + readonly attribute ACS::ROdoubleSeq physical_positions; + + /** + * This property returns the number of virtual axes of the servo + */ + readonly attribute ACS::ROlong virtual_axes; + + /** + * This property returns the current plain positions of the virtual axes of the servo + * The plain positions are the positions returned from the Leonardo servo system, without subtracting the offsets + */ + readonly attribute ACS::ROdoubleSeq plain_virtual_positions; + + /** + * This property returns the current positions of the virtual axes of the servo + * The positions returned by this property equals to the plain virtual positions minus the offsets + */ + readonly attribute ACS::ROdoubleSeq virtual_positions; + + /** + * This property returns the current offsets of the virtual axes of the servo + * The offset values are the sum of user and system offsets + */ + readonly attribute ACS::ROdoubleSeq virtual_offsets; + }; }; #endif diff --git a/SRT/Interfaces/SRTMinorServoInterface/src/Makefile b/SRT/Interfaces/SRTMinorServoInterface/src/Makefile index 9cac56365c702b4372361e45dceed9178f460c00..2ddc48b823b3cc1fb772a6257d6fd5fb07370979 100644 --- a/SRT/Interfaces/SRTMinorServoInterface/src/Makefile +++ b/SRT/Interfaces/SRTMinorServoInterface/src/Makefile @@ -24,11 +24,12 @@ CSOURCENAMES = \ # # IDL FILES # -IDL_FILES = SRTMinorServoBoss SRTMinorServo SRTMinorServoCommon +IDL_FILES = SRTMinorServoBoss SRTMinorServo SRTDerotator SRTMinorServoCommon SRTMinorServoCommonStubs_LIBS = baciStubs ManagmentDefinitionsStubs MinorServoDefinitionsStubs ComponentErrorsStubs MinorServoErrorsStubs SRTMinorServoStubs_LIBS = SRTMinorServoCommonStubs SRTMinorServoBossStubs_LIBS = SRTMinorServoCommonStubs MinorServoBossStubs +SRTDerotatorStubs_LIBS = SRTMinorServoCommonStubs GenericDerotatorStubs # # INCLUDE STANDARDS diff --git a/SRT/Interfaces/SRTReceiversInterface/idl/SRTKBandDerotator.idl b/SRT/Interfaces/SRTReceiversInterface/idl/SRTKBandDerotator.idl index 2710d184fc46ef629f62b9c9d94084cf4ae4fd25..d0617293256dac4f3aec04a383e5705e2a6eec7b 100644 --- a/SRT/Interfaces/SRTReceiversInterface/idl/SRTKBandDerotator.idl +++ b/SRT/Interfaces/SRTReceiversInterface/idl/SRTKBandDerotator.idl @@ -10,7 +10,17 @@ module Receivers { - interface SRTKBandDerotator : GenericDerotator { + interface SRTKBandDerotator : GenericDerotator, ACS::CharacteristicComponent + { + + /** + * <h3>Methods</h3>: + * <ul> + * <li>powerOff(): switch the power amplifier off </li> + * <li>setSpeed(): set the derotator speed, in rpm</li> + * <li>getSpeed(): get the derotator speed, in rpm</li> + * </ul> + */ /** Computation of the sensor lenght * @@ -104,9 +114,42 @@ module Receivers { ComponentErrors::ComponentErrorsEx ); - }; + + /** Switch the power amplifier off + * + * @throw CORBA::SystemException + * @throw ComponentErrors::ComponentErrorsEx + */ + void powerOff() raises (ComponentErrors::ComponentErrorsEx); + + + /** + * Set the derotator speed + * + * @arg speed speed in rpm + * @throw ComponentErrors::ComponentErrorsEx, + * @throw DerotatorErrors::DerotatorErrorsEx + */ + void setSpeed(in unsigned long speed) raises ( + ComponentErrors::ComponentErrorsEx, + DerotatorErrors::DerotatorErrorsEx + ); + + + /** + * Get the derotator speed + * + * @return the derotator speed in rpm + * @throw ComponentErrors::ComponentErrorsEx, + * @throw DerotatorErrors::DerotatorErrorsEx + */ + unsigned long getSpeed() raises ( + ComponentErrors::ComponentErrorsEx, + DerotatorErrors::DerotatorErrorsEx + ); + }; }; #endif diff --git a/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h b/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h index e966f532dec770beeac0b78a168a79f29a287d71..e4474676c23bc245f1dc8f2946b17a354a6f0822 100644 --- a/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h +++ b/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h @@ -583,7 +583,7 @@ namespace MinorServo const std::string getPlainCommand() const { std::shared_lock<std::shared_mutex> lock(m_mutex); - return this->get<std::string>("PLAIN_COMMAND"); + return this->count("PLAIN_COMMAND") > 0 ? this->get<std::string>("PLAIN_COMMAND") : ""; } /** @@ -593,7 +593,7 @@ namespace MinorServo const std::string getPlainAnswer() const { std::shared_lock<std::shared_mutex> lock(m_mutex); - return this->get<std::string>("PLAIN_ANSWER"); + return this->count("PLAIN_ANSWER") > 0 ? this->get<std::string>("PLAIN_ANSWER") : ""; } protected: @@ -883,6 +883,25 @@ namespace MinorServo */ const std::vector<std::string> m_virtual_offsets; }; + + /** + * This class is a specialization of the SRTMinorServoStatus for a derotator of the Leonardo Minor Servo System. + */ + class SRTDerotatorStatus : public SRTMinorServoStatus + { + public: + using SRTMinorServoStatus::SRTMinorServoStatus; + + /** + * This method returns the current derotator position. There is a sign inversion since the LDO derotator sign is opposite to the required one. + * @return the current derotator position + */ + double getActualPosition() const + { + double position = getVirtualPositions()[0]; + return position == 0 ? position : -position; + } + }; } #endif diff --git a/SRT/Misc/SRTScripts/app-defaults/simulationStartup.xml b/SRT/Misc/SRTScripts/app-defaults/simulationStartup.xml index 55d8ba5caea2d4b2a04c1c0fad0e7336af19c23e..197c93cfabee53eec9ef20554fd67b284094247e 100644 --- a/SRT/Misc/SRTScripts/app-defaults/simulationStartup.xml +++ b/SRT/Misc/SRTScripts/app-defaults/simulationStartup.xml @@ -14,7 +14,7 @@ <toolAgainstInterfaceRepository></toolAgainstInterfaceRepository> <toolAgainstNameService></toolAgainstNameService> <containers> - <select>34</select> + <select>31</select> <againstManagerHost></againstManagerHost> <againstManagerPort></againstManagerPort> <againstCDB></againstCDB> @@ -64,7 +64,7 @@ <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> </container> - <container> + <!--container> <name>LocalOscillatorLPContainer</name> <type>py</type> <heapSizeMB></heapSizeMB> @@ -72,7 +72,7 @@ <scriptBase>0</scriptBase> <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> - </container> + </container--> <container> <name>LocalOscillatorCContainer</name> <type>py</type> @@ -190,7 +190,7 @@ <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> </container> - <container> + <!--container> <name>SRTLPBandContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> @@ -198,7 +198,7 @@ <scriptBase>0</scriptBase> <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> - </container> + </container--> <container> <name>TotalPowerContainer</name> <type>cpp</type> diff --git a/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR2/DR_GFR2.xml b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR2/DR_GFR2.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f7a8218792534d9093b13a50fb842b1e9212d13 --- /dev/null +++ b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR2/DR_GFR2.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Component + xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="DR_GFR2" + Code="SRTDerotatorImpl" + ImplLang="cpp" + Type="IDL:alma/MinorServo/SRTDerotator:1.0" + Container="MinorServoContainer" + Default="false" +/> diff --git a/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR3/DR_GFR3.xml b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR3/DR_GFR3.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b329339acdcef19b0afa2b36746c3fbd06e4660 --- /dev/null +++ b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_GFR3/DR_GFR3.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Component + xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="DR_GFR3" + Code="SRTDerotatorImpl" + ImplLang="cpp" + Type="IDL:alma/MinorServo/SRTDerotator:1.0" + Container="MinorServoContainer" + Default="false" +/> diff --git a/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_PFP/DR_PFP.xml b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_PFP/DR_PFP.xml new file mode 100644 index 0000000000000000000000000000000000000000..05bdc74fb9596a883e2e748a9813871d83677fb3 --- /dev/null +++ b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/DR_PFP/DR_PFP.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Component + xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="DR_PFP" + Code="SRTDerotatorImpl" + ImplLang="cpp" + Type="IDL:alma/MinorServo/SRTDerotator:1.0" + Container="MinorServoContainer" + Default="false" +/> diff --git a/SRT/Outdated/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml index a5801b66da5c3bdcc192282f036f16269a5c689c..f3b9c99dfa9beadaa0b48c8aaaeb522461844b08 100644 --- a/SRT/Outdated/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml +++ b/SRT/Outdated/CDB/MACI/Components/MINORSERVO/PFP/PFP.xml @@ -5,11 +5,10 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - Name="PFP" + Name="PFP" Code="SRTProgramTrackMinorServoImpl" ImplLang="cpp" Type="IDL:alma/MinorServo/SRTProgramTrackMinorServo:1.0" Container="MinorServoContainer" - Default="true" - + Default="false" /> diff --git a/SRT/CDB/MACI/Components/RECEIVERS/SRTSBandMFReceiver/SRTSBandMFReceiver.xml b/SRT/Outdated/CDB/MACI/Components/RECEIVERS/SRTSBandMFReceiver/SRTSBandMFReceiver.xml similarity index 100% rename from SRT/CDB/MACI/Components/RECEIVERS/SRTSBandMFReceiver/SRTSBandMFReceiver.xml rename to SRT/Outdated/CDB/MACI/Components/RECEIVERS/SRTSBandMFReceiver/SRTSBandMFReceiver.xml diff --git a/SRT/CDB/MACI/Components/TestNamespace/Positioner/Positioner.xml b/SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner/Positioner.xml similarity index 100% rename from SRT/CDB/MACI/Components/TestNamespace/Positioner/Positioner.xml rename to SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner/Positioner.xml diff --git a/SRT/CDB/MACI/Components/TestNamespace/Positioner00/Positioner00.xml b/SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner00/Positioner00.xml similarity index 100% rename from SRT/CDB/MACI/Components/TestNamespace/Positioner00/Positioner00.xml rename to SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner00/Positioner00.xml diff --git a/SRT/CDB/MACI/Components/TestNamespace/Positioner01/Positioner01.xml b/SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner01/Positioner01.xml similarity index 100% rename from SRT/CDB/MACI/Components/TestNamespace/Positioner01/Positioner01.xml rename to SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner01/Positioner01.xml diff --git a/SRT/CDB/MACI/Components/TestNamespace/Positioner02/Positioner02.xml b/SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner02/Positioner02.xml similarity index 100% rename from SRT/CDB/MACI/Components/TestNamespace/Positioner02/Positioner02.xml rename to SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner02/Positioner02.xml diff --git a/SRT/CDB/MACI/Components/TestNamespace/Positioner03/Positioner03.xml b/SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner03/Positioner03.xml similarity index 100% rename from SRT/CDB/MACI/Components/TestNamespace/Positioner03/Positioner03.xml rename to SRT/Outdated/CDB/MACI/Components/TestNamespace/Positioner03/Positioner03.xml diff --git a/SRT/CDB/MACI/Containers/AntennaBossSimContainer/AntennaBossSimContainer.xml b/SRT/Outdated/CDB/MACI/Containers/AntennaBossSimContainer/AntennaBossSimContainer.xml similarity index 100% rename from SRT/CDB/MACI/Containers/AntennaBossSimContainer/AntennaBossSimContainer.xml rename to SRT/Outdated/CDB/MACI/Containers/AntennaBossSimContainer/AntennaBossSimContainer.xml diff --git a/SRT/CDB/MACI/Containers/PositionerContainer/PositionerContainer.xml b/SRT/Outdated/CDB/MACI/Containers/PositionerContainer/PositionerContainer.xml similarity index 100% rename from SRT/CDB/MACI/Containers/PositionerContainer/PositionerContainer.xml rename to SRT/Outdated/CDB/MACI/Containers/PositionerContainer/PositionerContainer.xml diff --git a/SRT/CDB/MACI/Containers/PyLOContainer/PyLOContainer.py b/SRT/Outdated/CDB/MACI/Containers/PyLOContainer/PyLOContainer.py similarity index 100% rename from SRT/CDB/MACI/Containers/PyLOContainer/PyLOContainer.py rename to SRT/Outdated/CDB/MACI/Containers/PyLOContainer/PyLOContainer.py diff --git a/SRT/CDB/MACI/Containers/SRTSBandContainer/SRTSBandContainer.xml b/SRT/Outdated/CDB/MACI/Containers/SRTSBandContainer/SRTSBandContainer.xml similarity index 100% rename from SRT/CDB/MACI/Containers/SRTSBandContainer/SRTSBandContainer.xml rename to SRT/Outdated/CDB/MACI/Containers/SRTSBandContainer/SRTSBandContainer.xml diff --git a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR2/Properties/Properties.xml b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR2/Properties/Properties.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ebb604a196bd97b9c3ed510977a3a8e6f2b93ca --- /dev/null +++ b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR2/Properties/Properties.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - Author: Giuseppe Carboni + - History: + - 14-03-23 Created +--> + +<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <physical_axes_enabled><property_name>ROTARY_AXIS_ENABLED</property_name></physical_axes_enabled> + <physical_positions><property_name>ROTATION</property_name></physical_positions> + <virtual_positions><property_name>ROTATION</property_name></virtual_positions> + <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> + <virtual_offsets><property_name>OFFSET</property_name></virtual_offsets> +</SRTMinorServoProperties> diff --git a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR3/Properties/Properties.xml b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR3/Properties/Properties.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ebb604a196bd97b9c3ed510977a3a8e6f2b93ca --- /dev/null +++ b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_GFR3/Properties/Properties.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - Author: Giuseppe Carboni + - History: + - 14-03-23 Created +--> + +<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <physical_axes_enabled><property_name>ROTARY_AXIS_ENABLED</property_name></physical_axes_enabled> + <physical_positions><property_name>ROTATION</property_name></physical_positions> + <virtual_positions><property_name>ROTATION</property_name></virtual_positions> + <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> + <virtual_offsets><property_name>OFFSET</property_name></virtual_offsets> +</SRTMinorServoProperties> diff --git a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_PFP/Properties/Properties.xml b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_PFP/Properties/Properties.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ebb604a196bd97b9c3ed510977a3a8e6f2b93ca --- /dev/null +++ b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/DR_PFP/Properties/Properties.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - Author: Giuseppe Carboni + - History: + - 14-03-23 Created +--> + +<SRTMinorServoProperties xmlns="urn:schemas-cosylab-com:SRTMinorServoProperties:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <physical_axes_enabled><property_name>ROTARY_AXIS_ENABLED</property_name></physical_axes_enabled> + <physical_positions><property_name>ROTATION</property_name></physical_positions> + <virtual_positions><property_name>ROTATION</property_name></virtual_positions> + <virtual_axes_units><property_name>degree</property_name></virtual_axes_units> + <virtual_offsets><property_name>OFFSET</property_name></virtual_offsets> +</SRTMinorServoProperties> diff --git a/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR2/DR_GFR2.xml b/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR2/DR_GFR2.xml new file mode 100644 index 0000000000000000000000000000000000000000..18191fa8093e972bdf890aa8a2e674e85e41816a --- /dev/null +++ b/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR2/DR_GFR2.xml @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + Authors: Giuseppe Carboni giuseppe.carboni@inaf.it +--> +<SRTDerotator + xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + physical_axes="1" + virtual_axes="1" + max_speed="3.276" + acceleration="2.67" + min_range="-130" + max_range="130" + step="60" + tracking_delta="0.1" + zero_offset="12.5"> + + <enabled description="All physical axes enabled" /> + <drive_cabinet_status description="Drive cabinet status" /> + <block description="Minor servo in block status" /> + <operative_mode description="Minor servo operating mode" /> + <physical_axes description="Number of physical axes" /> + <physical_axes_enabled description="Sequence, physical axes enabled" /> + <physical_positions description="Sequence, physical axes positions" /> + <virtual_axes description="Number of virtual axes" /> + <plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" /> + <virtual_positions description="Sequence, virtual axes positions, without offsets" /> + <virtual_offsets description="Sequence, sum of user and system virtual axis offsets" /> + <tracking description="Boolean indicating whether the servo is tracking the given coordinates" /> + <trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" /> + <total_trajectory_points description="Number of points sent for the current trajectory" /> + <remaining_trajectory_points description="Remaining points of the current trajectory" /> + <actPosition description="Current position, with sign inverted in respect to the LDO one"/> + <cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" /> + <positionDiff description="Difference between the commanded and the current position" /> + <status description="Bit pattern indicating the status of the derotator" /> + +</SRTDerotator> diff --git a/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR3/DR_GFR3.xml b/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR3/DR_GFR3.xml new file mode 100644 index 0000000000000000000000000000000000000000..df76d9833829b353ab9c6cd6ebc7145c0e9ea26d --- /dev/null +++ b/SRT/Outdated/CDB/alma/MINORSERVO/DR_GFR3/DR_GFR3.xml @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + Authors: Giuseppe Carboni giuseppe.carboni@inaf.it +--> +<SRTDerotator + xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + physical_axes="1" + virtual_axes="1" + max_speed="3.276" + acceleration="2.67" + min_range="-127" + max_range="127" + step="60" + tracking_delta="0.1" + zero_offset="12.5"> + + <enabled description="All physical axes enabled" /> + <drive_cabinet_status description="Drive cabinet status" /> + <block description="Minor servo in block status" /> + <operative_mode description="Minor servo operating mode" /> + <physical_axes description="Number of physical axes" /> + <physical_axes_enabled description="Sequence, physical axes enabled" /> + <physical_positions description="Sequence, physical axes positions" /> + <virtual_axes description="Number of virtual axes" /> + <plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" /> + <virtual_positions description="Sequence, virtual axes positions, without offsets" /> + <virtual_offsets description="Sequence, sum of user and system virtual axis offsets" /> + <tracking description="Boolean indicating whether the servo is tracking the given coordinates" /> + <trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" /> + <total_trajectory_points description="Number of points sent for the current trajectory" /> + <remaining_trajectory_points description="Remaining points of the current trajectory" /> + <actPosition description="Current position, with sign inverted in respect to the LDO one"/> + <cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" /> + <positionDiff description="Difference between the commanded and the current position" /> + <status description="Bit pattern indicating the status of the derotator" /> + +</SRTDerotator> diff --git a/SRT/Outdated/CDB/alma/MINORSERVO/DR_PFP/DR_PFP.xml b/SRT/Outdated/CDB/alma/MINORSERVO/DR_PFP/DR_PFP.xml new file mode 100644 index 0000000000000000000000000000000000000000..18191fa8093e972bdf890aa8a2e674e85e41816a --- /dev/null +++ b/SRT/Outdated/CDB/alma/MINORSERVO/DR_PFP/DR_PFP.xml @@ -0,0 +1,40 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + Authors: Giuseppe Carboni giuseppe.carboni@inaf.it +--> +<SRTDerotator + xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + physical_axes="1" + virtual_axes="1" + max_speed="3.276" + acceleration="2.67" + min_range="-130" + max_range="130" + step="60" + tracking_delta="0.1" + zero_offset="12.5"> + + <enabled description="All physical axes enabled" /> + <drive_cabinet_status description="Drive cabinet status" /> + <block description="Minor servo in block status" /> + <operative_mode description="Minor servo operating mode" /> + <physical_axes description="Number of physical axes" /> + <physical_axes_enabled description="Sequence, physical axes enabled" /> + <physical_positions description="Sequence, physical axes positions" /> + <virtual_axes description="Number of virtual axes" /> + <plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" /> + <virtual_positions description="Sequence, virtual axes positions, without offsets" /> + <virtual_offsets description="Sequence, sum of user and system virtual axis offsets" /> + <tracking description="Boolean indicating whether the servo is tracking the given coordinates" /> + <trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" /> + <total_trajectory_points description="Number of points sent for the current trajectory" /> + <remaining_trajectory_points description="Remaining points of the current trajectory" /> + <actPosition description="Current position, with sign inverted in respect to the LDO one"/> + <cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" /> + <positionDiff description="Difference between the commanded and the current position" /> + <status description="Bit pattern indicating the status of the derotator" /> + +</SRTDerotator> diff --git a/SRT/Configuration/CDB/alma/MINORSERVO/PFP/PFP.xml b/SRT/Outdated/CDB/alma/MINORSERVO/PFP/PFP.xml similarity index 100% rename from SRT/Configuration/CDB/alma/MINORSERVO/PFP/PFP.xml rename to SRT/Outdated/CDB/alma/MINORSERVO/PFP/PFP.xml diff --git a/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServo.xsd b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServo.xsd index 88b05456865326e953d7468380297f4673bce694..34ec4318201e86f03a0b4734136a6aca74b3dd51 100644 --- a/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServo.xsd +++ b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServo.xsd @@ -19,7 +19,7 @@ <xs:import namespace="urn:schemas-cosylab-com:Managment:1.0" schemaLocation="Managment.xsd"/> <xs:import namespace="urn:schemas-cosylab-com:SRTMinorServoCommon:1.0" schemaLocation="SRTMinorServoCommon.xsd"/> - <xs:complexType name="SRTBaseMinorServoType"> + <xs:complexType name="SRTLDOBasePropertiesType"> <xs:complexContent> <xs:extension base="baci:CharacteristicComponent"> <xs:sequence> @@ -34,12 +34,6 @@ <xs:element name="plain_virtual_positions" type="baci:ROdoubleSeq" /> <xs:element name="virtual_positions" type="baci:ROdoubleSeq" /> <xs:element name="virtual_offsets" type="baci:ROdoubleSeq" /> - <xs:element name="virtual_user_offsets" type="baci:ROdoubleSeq" /> - <xs:element name="virtual_system_offsets" type="baci:ROdoubleSeq" /> - <xs:element name="commanded_virtual_positions" type="baci:ROdoubleSeq" /> - <xs:element name="in_use" type="mng:BooleanType" /> - <xs:element name="current_setup" type="baci:ROstring" /> - <xs:element name="error_code" type="ms:SRTMinorServoErrorType" /> </xs:sequence> <xs:attribute name="physical_axes" type="xs:unsignedShort" use="required" /> <xs:attribute name="virtual_axes" type="xs:unsignedShort" use="required" /> @@ -51,6 +45,21 @@ </xs:complexContent> </xs:complexType> + <xs:complexType name="SRTBaseMinorServoType"> + <xs:complexContent> + <xs:extension base="SRTLDOBasePropertiesType"> + <xs:sequence> + <xs:element name="virtual_user_offsets" type="baci:ROdoubleSeq" /> + <xs:element name="virtual_system_offsets" type="baci:ROdoubleSeq" /> + <xs:element name="commanded_virtual_positions" type="baci:ROdoubleSeq" /> + <xs:element name="in_use" type="mng:BooleanType" /> + <xs:element name="current_setup" type="baci:ROstring" /> + <xs:element name="error_code" type="ms:SRTMinorServoErrorType" /> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="SRTProgramTrackMinorServoType"> <xs:complexContent> <xs:extension base="SRTBaseMinorServoType"> @@ -66,7 +75,29 @@ </xs:complexContent> </xs:complexType> + <xs:complexType name="SRTDerotatorType"> + <xs:complexContent> + <xs:extension base="SRTLDOBasePropertiesType"> + <xs:sequence> + <xs:element name="tracking" type="mng:BooleanType" /> + <xs:element name="trajectory_id" type="baci:ROlong" /> + <xs:element name="total_trajectory_points" type="baci:ROlong" /> + <xs:element name="remaining_trajectory_points" type="baci:ROlong" /> + <xs:element name="actPosition" type="baci:ROdouble" /> + <xs:element name="cmdPosition" type="baci:RWdouble" /> + <xs:element name="positionDiff" type="baci:ROdouble" /> + <xs:element name="status" type="baci:ROpattern" /> + </xs:sequence> + <xs:attribute name="status_thread_period" type="xs:double" use="optional" default="0.05" /> + <xs:attribute name="step" type="xs:string" use="required" /> + <xs:attribute name="tracking_delta" type="xs:string" use="required" /> + <xs:attribute name="zero_offset" type="xs:string" use="optional" default="0.0" /> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="SRTGenericMinorServo" type="SRTBaseMinorServoType" /> <xs:element name="SRTProgramTrackMinorServo" type="SRTProgramTrackMinorServoType" /> + <xs:element name="SRTDerotator" type="SRTDerotatorType" /> </xs:schema> diff --git a/SRT/Servers/SRTMinorServo/include/MSDevIOs.h b/SRT/Servers/SRTMinorServo/include/MSDevIOs.h index 49749dc7f403892ce4c488dbc51a5f475c443f4f..8a53266bf0b5016879364b5773bff493ac1f5969 100644 --- a/SRT/Servers/SRTMinorServo/include/MSDevIOs.h +++ b/SRT/Servers/SRTMinorServo/include/MSDevIOs.h @@ -47,6 +47,8 @@ namespace MinorServo /** * It writes values into controller. Unused because all the properties are read-only. + * Derotator update, the cmdPosition is actually a RW property, but the position is never set anywhere by using the DevIO. + * I will keep this implementation that does nothing and the position will be set by the setPosition or programTrack methods. */ void write(const T& value, ACS::Time& timestamp) { @@ -237,7 +239,7 @@ namespace MinorServo * The templates is specialized for the types listed right below and compilation will fail if the developer attempts to use it for an unknown MSDevIO type. */ template <typename X, typename Y, typename = std::enable_if< - is_any_v<Y, SRTMinorServoGeneralStatus, SRTMinorServoStatus> + is_any_v<Y, SRTMinorServoGeneralStatus, SRTMinorServoStatus, SRTDerotatorStatus> && is_any_v<X, Management::TBoolean, CORBA::Double, @@ -306,7 +308,7 @@ namespace MinorServo const std::string m_property_name; /** - * The reference to the SRTMinorServoAnswerMap in which the readings from the PLC appear. This could be either a SRTMinorServoGeneralStatus or a SRTMinorServoStatus. + * The reference to the SRTMinorServoAnswerMap in which the readings from the PLC appear. This could be either a SRTMinorServoGeneralStatus, a SRTMinorServoStatus or a SRTDerotatorStatus. */ const Y& m_map; @@ -322,7 +324,14 @@ namespace MinorServo * The templates is specialized for the combinations of types listed right below and the compilation will fail if the developer attempts to use it with any other types combination. */ template <typename C, typename A, typename = std::enable_if_t< - is_any_v<C, Management::TSystemStatus, Management::TBoolean, ACE_CString, CORBA::Long, SRTMinorServoError> || (std::is_same_v<C, ACS::doubleSeq> && std::is_same_v<A, std::vector<double>>) + is_any_v<C, + Management::TSystemStatus, + Management::TBoolean, + ACE_CString, + CORBA::Long, + SRTMinorServoError, + double, + ACS::pattern> || (std::is_same_v<C, ACS::doubleSeq> && std::is_same_v<A, std::vector<double>>) >> class MSGenericDevIO : public MSBaseDevIO<C> { diff --git a/SRT/Servers/SRTMinorServo/include/SRTDerotatorImpl.h b/SRT/Servers/SRTMinorServo/include/SRTDerotatorImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..546b7f55ca34b9285159e9de71422f45960ca0c8 --- /dev/null +++ b/SRT/Servers/SRTMinorServo/include/SRTDerotatorImpl.h @@ -0,0 +1,545 @@ +#ifndef __SRTDEROTATORIMPL_H__ +#define __SRTDEROTATORIMPL_H__ + +/** + * SRTDerotatorImpl.h + * Giuseppe Carboni (giuseppe.carboni@inaf.it) + */ + +#include "SuppressWarnings.h" +//#include <regex> +#include <IRA> +#include <baciCharacteristicComponentImpl.h> +#include <baciSmartPropertyPointer.h> +#include <baciROlong.h> +#include <baciRObooleanSeq.h> +#include <baciROdoubleSeq.h> +#include <baciROstring.h> +#include <baciROdouble.h> +#include <baciRWdouble.h> +#include <enumpropROImpl.h> +#include <SRTMinorServoS.h> +#include <maciACSComponentDefines.h> +#include <ManagmentDefinitionsS.h> +#include "ManagementErrors.h" +#include "DerotatorErrors.h" +#include "SRTMinorServoSocket.h" +#include "MSDevIOs.h" +#include "SRTDerotatorStatusThread.h" +#include <SRTDerotatorS.h> + +class SRTDerotatorStatusThread; + + +using namespace MinorServo; + +/** + * This class implements the base ACS::CharacteristicComponent CORBA interface for a SRTDerotator component. + * It is inherited by the other classes declared below. + */ +class SRTDerotatorImpl : public baci::CharacteristicComponentImpl, public virtual POA_MinorServo::SRTDerotator +{ + friend class SRTDerotatorStatusThread; + +public: + /** + * Constructor. + * @param component_name component's name. This is also the name that will be used to find the configuration data for the component in the Configuration DataBase. + * @param container_services pointer to the class that exposes all services offered by container. + * @throw ComponentErrors::ComponentErrorsEx when there has been an issue reading some value from the CDB. + */ + SRTDerotatorImpl(const ACE_CString& component_name, maci::ContainerServices* container_services); + + /** + * Destructor. + */ + virtual ~SRTDerotatorImpl(); + + /** + * Called to give the component time to initialize itself. The component reads in configuration files/parameters, builds up connection. + * Called before execute. It is implemented as a synchronous (blocking) call. + * @throw ComponentErrors::ComponentErrorsEx when there has been a memory allocation issue with the properties pointers. + */ + void initialize(); + + /** + * Called after initialize to tell the component that it has to be ready to accept incoming functional calls any time. + * Must be implemented as a synchronous (blocking) call. In this class the default implementation only logs the COMPSTATE_OPERATIONAL. + */ + void execute(); + + /** + * Called by the container before destroying the server in a normal situation. This function takes charge of releasing all resources. + */ + void cleanUp(); + + /** + * Called by the container in case of error or emergency situation. + * This function tries to free all resources even though there is no warranty that the function is completely executed before the component is destroyed. + */ + void aboutToAbort(); + + /** + * Asks the servo system to get ready. + * @throw DerotatorErrors::DerotatorErrorsEx + * @throw ComponentErrors::ComponentErrorsEx + */ + void setup(); + + // TODO: this should be a simple preset command + void setPosition(CORBA::Double position); + + // TODO easy implementation, return last commanded preset or programTrack position + double getCmdPosition() { return m_commanded_position.load(); }; + + // TODO return current position, just read the devio or the AnswerMap + double getActPosition() { return getPositionFromHistory(0); }; + + /** + * Returns the rotation the derotator was at the given time acs_time. + * @param acs_time the epoch we want to retrieve the derotator position. + * @throw MinorServoErrors::MinorServoErrorsEx when the position history is empty. + * @throw ComponentErrors::ComponentErrorsEx when the position history is empty + * @return a double object containing the derotator position at the given epoch. + */ + double getPositionFromHistory(ACS::Time acs_time); + + // TODO: easy implementation, return the min and max values read from the CDB + double getMinLimit() { return m_min; }; + double getMaxLimit() { return m_max; }; + + // TODO: degrees between 2 lateral feeds. How to implement this with new receivers? + double getStep() { return m_step; }; + + // TODO: easy implementation + bool isReady(); + bool isSlewing(); + + /** + * Returns the tracking status of the minor servo. + * @return true if the minor servo is tracking within the tracking error, false otherwise + */ + bool isTracking() { return m_tracking.load() == Management::MNG_TRUE; } + + /** + * This method loads a position that has to be tracked by the derotator + * @param point_time an ACS::Time object indicating the time associated with the coordinates to be tracked. + * Only the start time is sent to the derotator and the points after are always spaced by the same amount of time from one another. + * It is still necessary to fill this field in order to associate a time to the coordinates inside the component. + * @param position the position to track at the given time + * @param restart flag that restarts the tracking with a new trajectory + */ + void loadTrackingPoint(ACS::Time point_time, CORBA::Double position, CORBA::Boolean restart); + + /** + * Asks the component to calculate the servo system position starting from the given elevation. + * @param elevation the elevation we want to use to calculate and retrieve the servo system coordinates, expressed in degrees. + * @throw MinorServoErrors::MinorServoErrorsEx when the servo has not been configured yet and has not loaded any coefficient for the position calculation. + * @return a pointer to the double sequence object containing the calculated coordinates of the servo system. + */ + //ACS::doubleSeq* calcCoordinates(CORBA::Double elevation); + + /** + * Asks the component the virtual axes user offsets. + * @return a pointer to the double sequence object containing the current virtual axes user offsets of the servo system. + */ + //ACS::doubleSeq* getUserOffsets(); + + /** + * Load a single virtual axis user offset to the component and to the servo system. + * @param axis_name the name of the axis to load the given offset to. + * @param offset the desired user offset, expressed in millimeters or degrees, depending if the axis is a translation axis or a rotation one. + * @throw MinorServoErrors::MinorServoErrorsEx when the given axis_name is unknown, when the sum of user and system offsets for the given axis are out of range, + * when there has been a communication error or when the command was not accepted. + */ + //void setUserOffset(const char* axis_name, CORBA::Double offset); + + /** + * Resets the virtual axes user offsets to 0. + * @throw MinorServoErrors::MinorServoErrorsEx when there has been a communication error or when the command was not accepted. + */ + //void clearUserOffsets(); + + /** + * Asks the component the virtual axes system offsets. + * @return a pointer to the double sequence object containing the current virtual axes system offsets of the servo system. + */ + //ACS::doubleSeq* getSystemOffsets(); + + /** + * Load a single virtual axis system offset to the component and to the servo system. + * @param axis_name the name of the axis to load the given offset to. + * @param offset the desired system offset, expressed in millimeters or degrees, depending if the axis is a translation axis or a rotation one. + * @throw MinorServoErrors::MinorServoErrorsEx when the given axis is unknown, when the sum of user and system offsets for the given axis are out of range, + * when there has been a communication error or when the command was not accepted. + */ + //void setSystemOffset(const char* axis_name, CORBA::Double offset); + + /** + * Resets the virtual axes system offsets to 0. + * @throw MinorServoErrors::MinorServoErrorsEx when there has been a communication error or when the command was not accepted. + */ + //void clearSystemOffsets(); + + /** + * Reload the user and the system offsets to the minor servo when the Leonardo offsets do not correspond to the sum of the DISCOS user and system offsets. + * @throw MinorServoErrors::MinorServoErrorsEx when there has been a communication error or when the command was not accepted. + */ + //void reloadOffsets(); + + /** + * Returns the maximum travel time to get from a starting position to a destination position. + * @param start a double sequence containing the starting position. If the provided sequence is empty, the current axes positions are used for the calculation. + * @param dest a double sequence containing the destination position. + * @throw MinorServoErrors::MinorServoErrorsEx when receiving a starting position sequence of length different from zero or the number of virtual axes of the servo, + * when receiving a destination position sequence of lenght different from the number of virtual axes of the servo + * @return an ACS::TimeInterval object representing the total duration of the movement from the starting position to the destination position + */ + //ACS::TimeInterval getTravelTime(const ACS::doubleSeq& start, const ACS::doubleSeq& dest); + + /** + * Returns the minimum and maximum range of the virtual axes of the servo system, as reference arguments. + * @param min_ranges_out a double sequence object containing the minimum ranges of the virtual axes of the servo system. + * @param max_ranges_out a double sequence object containing the maximum ranges of the virtual axes of the servo system. + */ + //void getAxesRanges(ACS::doubleSeq_out min_ranges_out, ACS::doubleSeq_out max_ranges_out); + + /** + * Returns a reference to the enabled property implementation of the IDL interface. + * @return pointer to the read-only boolean property enabled. + */ + virtual Management::ROTBoolean_ptr enabled(); + + /** + * Returns a reference to the drive_cabinet_status property implementation of the IDL interface. + * @return pointer to the read-only SRTMinorServoCabinerStatus (enumeration) property drive_cabinet_status. + */ + virtual ROSRTMinorServoCabinetStatus_ptr drive_cabinet_status(); + + /** + * Returns a reference to the block property implementation of the IDL interface. + * @return pointer to the read-only boolean property block. + */ + virtual Management::ROTBoolean_ptr block(); + + /** + * Returns a reference to the operative_mode property implementation of the IDL interface. + * @return pointer to the read-only SRTMinorServoOperativeMode (enumeration) property operative_mode. + */ + virtual ROSRTMinorServoOperativeMode_ptr operative_mode(); + + /** + * Returns a reference to the physical_axes_enabled property implementation of the IDL interface. + * @return pointer to the read-only boolean sequence property physical_axes_enabled. + */ + virtual ACS::RObooleanSeq_ptr physical_axes_enabled(); + + /** + * Returns a reference to the physical_positions property implementation of the IDL interface. + * @return pointer to the read-only boolean sequence property physical_positions. + */ + virtual ACS::ROdoubleSeq_ptr physical_positions(); + + /** + * Returns a reference to the virtual_axes property implementation of the IDL interface. + * @return pointer to the read-only long property virtual_axes. + */ + virtual ACS::ROlong_ptr virtual_axes(); + + /** + * Returns a reference to the plain_virtual_positions property implementation of the IDL interface. + * @return pointer to the read-only double sequence property plain_virtual_positions. + */ + virtual ACS::ROdoubleSeq_ptr plain_virtual_positions(); + + /** + * Returns a reference to the virtual_positions property implementation of the IDL interface. + * @return pointer to the read-only double sequence property virtual_positions. + */ + virtual ACS::ROdoubleSeq_ptr virtual_positions(); + + /** + * Returns a reference to the virtual_offsets property implementation of the IDL interface. + * @return pointer to the read-only double sequence property virtual_offsets. + */ + virtual ACS::ROdoubleSeq_ptr virtual_offsets(); + + /** + * Returns a reference to the tracking property implementation of the IDL interface. + * @return pointer to the read-only boolean property tracking. + */ + virtual Management::ROTBoolean_ptr tracking(); + + /** + * Returns a reference to the trajectory_id property implementation of the IDL interface. + * @return pointer to the read-only long property trajectory_id. + */ + virtual ACS::ROlong_ptr trajectory_id(); + + /** + * Returns a reference to the total_trajectory_points property implementation of the IDL interface. + * @return pointer to the read-only long property total_trajectory_points. + */ + virtual ACS::ROlong_ptr total_trajectory_points(); + + /** + * Returns a reference to the remaining_trajectory_points property implementation of the IDL interface. + * @return pointer to the read-only long property remaining_trajectory_points. + */ + virtual ACS::ROlong_ptr remaining_trajectory_points(); + + virtual ACS::RWdouble_ptr cmdPosition(); + + virtual ACS::ROdouble_ptr actPosition(); + + /** + * Returns a reference to the positionDiff property implementation of the IDL interface. + * @return pointer to the read-only double sequence property positionDiff. + */ + virtual ACS::ROdouble_ptr positionDiff(); + + virtual ACS::ROpattern_ptr status(); + +private: + /** + * Updates the status of the component by asking the hardware its status. + */ + bool updateStatus(); + + /** + * Checks if the socket is connected and if the minor servo system is in a good state. + * @throw MinorServoErrors::MinorServoErrorsEx when the socket is not connected or when the minor servo system is blocked or the drive cabinet is in error state. + */ + void checkLineStatus(); + + /** + * Static function used to retrieve some constants from the component CDB xml schema. + * @param object the instance of this class, used inside the function logic. + * @param constant the name of the constants we want to retrieve from the CDB. + * @throw ComponentErrors::ComponentErrorsEx when the requested value cannot be read from the CDB or when it has a non meaningful value. + * @return a vector of doubles containing the retrieved constants, its length is the same as the number of virtual axes of the servo system. + */ + //static std::vector<double> getMotionConstant(SRTBaseMinorServoImpl& object, const std::string& constant); + + /** + * Static function used to retrieve a table from the CDB DataBlock directory. Used inside the initialization list. + * @param object the instance of this class, used inside the function logic. + * @param properties_name the name of the block to retrieve as written inside the DataBlock file. + * @throw ComponentErrors::ComponentErrorsEx when the requested value cannot be read from the CDB. + * @return a vector of strings containing the retrieved table fields. + */ + static std::vector<std::string> getPropertiesTable(SRTDerotatorImpl& object, const std::string& properties_name); + + /** + * Attributes. + * Keep the same order for the initialization list. + */ + + /** + * Name of the component. + */ + const std::string m_component_name; + + /** + * Name of the servo system. + */ + const std::string m_servo_name; + + /** + * Number of virtual axes of the servo system. + */ + const size_t m_virtual_axes; + + /** + * Number of physical axes of the servo system. + */ + const size_t m_physical_axes; + + /** + * Name of the virtual axes of the servo system. + */ + const std::vector<std::string> m_virtual_axes_names; + + /** + * Units of the virtual axes of the servo system. + */ + const std::vector<std::string> m_virtual_axes_units; + + /** + * Dictionary containing the last status retrieved form the servo system. + */ + SRTDerotatorStatus m_status; + + /** + * Commanded user offsets for each axis of the servo system. + */ + std::vector<double> m_user_offsets; + + /** + * Commanded system offsets for each axis of the servo system. + */ + std::vector<double> m_system_offsets; + + /** + * Queue of positions assumed by the servo system in time. + */ + SRTMinorServoPositionsQueue m_positions_queue; + + /** + * The offset to apply to bring the derotator to the receiver rest position. + */ + const double m_zero_offset; + + /** + * Minimum ranges of the axes of the servo system. + */ + const double m_min; + + /** + * Maximum ranges of the axes of the servo system. + */ + const double m_max; + + /** + * Queue of positions to be assumed by the servo system when tracking a trajectory. + */ + SRTMinorServoPositionsQueue m_tracking_queue; + + /** + * Degrees between 2 adjacent lateral feeds. + */ + const double m_step; + + /** + * Tracking delta values for all minor servo system virtual axes. + */ + const double m_tracking_delta; + + /** + * Tracking error values for all minor servo system virtual axes. + */ + std::vector<double> m_tracking_error; + + /** + * Indicates if the servo system is tracking or not. It is tracking when the position error is lower than the tracking delta for all the virtual axes. + */ + std::atomic<Management::TBoolean> m_tracking; + + /** + * Current trajectory ID. + */ + std::atomic<unsigned int> m_trajectory_id; + + /** + * Total trajectory points of the current trajectory. + */ + std::atomic<unsigned int> m_total_trajectory_points; + + /** + * Remaining trajectory points of the current trajectory. + */ + std::atomic<unsigned int> m_remaining_trajectory_points; + + std::atomic<double> m_commanded_position; + + std::atomic<double> m_position_difference; + + std::atomic<long> m_status_pattern; + + /** + * Current speed of rotation + */ + double m_c_s; + + /** + * Pointer to the enabled property. + */ + baci::SmartPropertyPointer<ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>> m_enabled_ptr; + + /** + * Pointer to the drive_cabinet_status property. + */ + baci::SmartPropertyPointer<ROEnumImpl<ACS_ENUM_T(SRTMinorServoCabinetStatus), POA_MinorServo::ROSRTMinorServoCabinetStatus>> m_drive_cabinet_status_ptr; + + /** + * Pointer to the block property. + */ + baci::SmartPropertyPointer<ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>> m_block_ptr; + + /** + * Pointer to the operative_mode property. + */ + baci::SmartPropertyPointer<ROEnumImpl<ACS_ENUM_T(SRTMinorServoOperativeMode), POA_MinorServo::ROSRTMinorServoOperativeMode>> m_operative_mode_ptr; + + /** + * Pointer to the physical_axes_enabled property. + */ + baci::SmartPropertyPointer<baci::RObooleanSeq> m_physical_axes_enabled_ptr; + + /** + * Pointer to the physical_positions property. + */ + baci::SmartPropertyPointer<baci::ROdoubleSeq> m_physical_positions_ptr; + + /** + * Pointer to the virtual_axes property. + */ + baci::SmartPropertyPointer<baci::ROlong> m_virtual_axes_ptr; + + /** + * Pointer to the plain_virtual_positions property. + */ + baci::SmartPropertyPointer<baci::ROdoubleSeq> m_plain_virtual_positions_ptr; + + /** + * Pointer to the virtual_positions property. + */ + baci::SmartPropertyPointer<baci::ROdoubleSeq> m_virtual_positions_ptr; + + /** + * Pointer to the virtual_offsets property. + */ + baci::SmartPropertyPointer<baci::ROdoubleSeq> m_virtual_offsets_ptr; + + /** + * Pointer to the tracking property. + */ + baci::SmartPropertyPointer<ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>> m_tracking_ptr; + + /** + * Pointer to the trajectory_id property. + */ + baci::SmartPropertyPointer<baci::ROlong> m_trajectory_id_ptr; + + /** + * Pointer to the total_trajectory_points property. + */ + baci::SmartPropertyPointer<baci::ROlong> m_total_trajectory_points_ptr; + + /** + * Pointer to the remaining_trajectory_points property. + */ + baci::SmartPropertyPointer<baci::ROlong> m_remaining_trajectory_points_ptr; + + baci::SmartPropertyPointer<baci::ROdouble> m_actual_position_ptr; + baci::SmartPropertyPointer<baci::RWdouble> m_commanded_position_ptr; + baci::SmartPropertyPointer<baci::ROdouble> m_position_difference_ptr; + baci::SmartPropertyPointer<baci::ROpattern> m_status_ptr; + + /** + * Configuration of the socket object. + */ + const SRTMinorServoSocketConfiguration& m_socket_configuration; + + /** + * Socket object. + */ + SRTMinorServoSocket& m_socket; + + /** + * Pointer to the status thread. + */ + SRTDerotatorStatusThread* m_status_thread; +}; + +#endif diff --git a/SRT/Servers/SRTMinorServo/include/SRTDerotatorStatusThread.h b/SRT/Servers/SRTMinorServo/include/SRTDerotatorStatusThread.h new file mode 100644 index 0000000000000000000000000000000000000000..b0c3ece339d6c9f47d2534cf9d1ef22c571d445a --- /dev/null +++ b/SRT/Servers/SRTMinorServo/include/SRTDerotatorStatusThread.h @@ -0,0 +1,63 @@ +#ifndef _SRTDEROTATORSTATUSTHREAD_H_ +#define _SRTDEROTATORSTATUSTHREAD_H_ + +/** + * SRTDerotatorStatusThread.h + * Giuseppe Carboni (giuseppe.carboni@inaf.it) + */ + +#include "SuppressWarnings.h" +#include <acsThread.h> +#include <ComponentErrors.h> +#include "SRTMinorServoSocket.h" +#include "SRTDerotatorImpl.h" + +class SRTDerotatorImpl; + + +/** + * This class implements a status thread. This thread is in charge of updating the status of the relative derotator component. + */ +class SRTDerotatorStatusThread : public ACS::Thread +{ +public: + /** + * Constructor. + * @param name thread name + * @param response_time thread's heartbeat response time in 100ns unit. Default value is 1s. + * @param sleep_time thread's sleep time in 100ns unit. Default value is 100ms. + */ + SRTDerotatorStatusThread(const ACE_CString& name, SRTDerotatorImpl& component, const ACS::TimeInterval& response_time=ThreadBase::defaultResponseTime, const ACS::TimeInterval& sleep_time=ThreadBase::defaultSleepTime); + + /** + * Destructor. + */ + ~SRTDerotatorStatusThread(); + + /** + * This method is executed once when the thread starts. + */ + virtual void onStart(); + + /** + * This method is executed once when the thread stops. + */ + virtual void onStop(); + + /** + * This method overrides the thread implementation class. + * The thread can be exited by calling ACS::ThreadBase::stop or ACS::ThreadBase::exit command. + */ + virtual void runLoop(); + +private: + SRTDerotatorImpl& m_component; + + /** + * The sleeping time of the thread. + * The thread should be cycling at a constant rate, therefore the inner sleeping time is always updated taking into account this and the thread execution time. + */ + ACS::TimeInterval m_sleep_time; +}; + +#endif /*_SRTDEROTATORSTATUSTHREAD_H_*/ diff --git a/SRT/Servers/SRTMinorServo/src/Makefile b/SRT/Servers/SRTMinorServo/src/Makefile index 141c676de6656bd3bba8aef79cacd265160390f9..3cf5a0bcd372536affc9b7d31fa5489aa970e598 100644 --- a/SRT/Servers/SRTMinorServo/src/Makefile +++ b/SRT/Servers/SRTMinorServo/src/Makefile @@ -18,12 +18,12 @@ CDB_SCHEMAS = SRTMinorServoCommon SRTMinorServoBoss SRTMinorServo SRTMinorServoS # ---------------------------- # Libraries (public and local) # ---------------------------- -LIBRARIES = SRTGenericMinorServoImpl SRTProgramTrackMinorServoImpl SRTMinorServoBossImpl +LIBRARIES = SRTGenericMinorServoImpl SRTProgramTrackMinorServoImpl SRTMinorServoBossImpl SRTDerotatorImpl USER_CFLAGS = SRTMinorServoBossImpl_OBJECTS = SRTMinorServoBossCore SRTMinorServoSetupThread SRTMinorServoParkThread SRTMinorServoTrackingThread SRTMinorServoScanThread SRTMinorServoBossImpl SRTMinorServoStatusThread -SRTMinorServoBossImpl_LIBS = IRALibrary SRTMinorServoBossStubs SRTMinorServoStubs ComponentErrors MinorServoErrors ManagementErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary AntennaBossStubs SRTMinorServoSocketLibrary ParserErrors DiscosVersion acsnc +SRTMinorServoBossImpl_LIBS = IRALibrary SRTMinorServoBossStubs SRTMinorServoStubs SRTDerotatorStubs ComponentErrors MinorServoErrors ManagementErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary AntennaBossStubs SRTMinorServoSocketLibrary ParserErrors DiscosVersion acsnc SRTMinorServoBossImpl_CFLAGS = -std=c++17 -fconcepts SRTMinorServoBossCore_CFLAGS = -std=c++17 -fconcepts SRTMinorServoStatusThread_CFLAGS = -std=c++17 -fconcepts @@ -39,6 +39,10 @@ SRTGenericMinorServoImpl_CFLAGS = -std=c++17 -fconcepts SRTProgramTrackMinorServoImpl_OBJECTS = SRTProgramTrackMinorServoImpl SRTBaseMinorServoImpl SRTProgramTrackMinorServoImpl_LIBS = IRALibrary SRTMinorServoStubs MinorServoErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary SRTMinorServoSocketLibrary DiscosVersion SRTProgramTrackMinorServoImpl_CFLAGS = -std=c++17 -fconcepts +SRTDerotatorImpl_OBJECTS = SRTDerotatorImpl SRTDerotatorStatusThread +SRTDerotatorImpl_LIBS = IRALibrary SRTMinorServoStubs MinorServoDefinitionsStubs SRTMinorServoCommandLibrary SRTMinorServoSocketLibrary GenericDerotatorStubs SRTDerotatorStubs DerotatorErrors DiscosVersion +SRTDerotatorImpl_CFLAGS = -std=c++17 -fconcepts +SRTDerotatorStatusThread_CFLAGS = -std=c++17 -fconcepts # ---------------------------------------------------------------------- diff --git a/SRT/Servers/SRTMinorServo/src/SRTDerotatorImpl.cpp b/SRT/Servers/SRTMinorServo/src/SRTDerotatorImpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b00a29420f14e34d640c349a5ad25d9fcc61b85d --- /dev/null +++ b/SRT/Servers/SRTMinorServo/src/SRTDerotatorImpl.cpp @@ -0,0 +1,490 @@ +#include "SRTDerotatorImpl.h" + +using namespace MinorServo; + +SRTDerotatorImpl::SRTDerotatorImpl(const ACE_CString& component_name, maci::ContainerServices* container_services): + CharacteristicComponentImpl(component_name, container_services), + m_component_name(std::string(component_name.c_str())), + m_servo_name(std::string(strchr(component_name.c_str(), '/') + 1)), + m_virtual_axes(getCDBValue<size_t>(container_services, "virtual_axes")), + m_physical_axes(getCDBValue<size_t>(container_services, "physical_axes")), + m_virtual_axes_names(SRTDerotatorImpl::getPropertiesTable(*this, "virtual_positions")), + m_virtual_axes_units(SRTDerotatorImpl::getPropertiesTable(*this, "virtual_axes_units")), + m_status( + m_servo_name, + SRTDerotatorImpl::getPropertiesTable(*this, "physical_axes_enabled"), + SRTDerotatorImpl::getPropertiesTable(*this, "physical_positions"), + m_virtual_axes_names, + SRTDerotatorImpl::getPropertiesTable(*this, "virtual_offsets") + ), + m_positions_queue(5 * 60 * int(1 / getCDBValue<double>(container_services, "status_thread_period", "/MINORSERVO/Boss")), m_virtual_axes), + m_zero_offset(getCDBValue<double>(container_services, "zero_offset")), + m_min(-(getCDBValue<double>(container_services, "max_range") - m_zero_offset)), + m_max(-(getCDBValue<double>(container_services, "min_range") - m_zero_offset)), + m_tracking_queue(1500, m_virtual_axes), + m_step(getCDBValue<double>(container_services, "step")), + m_tracking_delta(getCDBValue<double>(container_services, "tracking_delta")), + m_tracking_error(m_virtual_axes, 0.0), + m_tracking(Management::MNG_FALSE), + m_trajectory_id(0), + m_total_trajectory_points(0), + m_remaining_trajectory_points(0), + m_commanded_position(0), + m_position_difference(0), + m_status_pattern(0), + m_c_s(0), + m_enabled_ptr(this), + m_drive_cabinet_status_ptr(this), + m_block_ptr(this), + m_operative_mode_ptr(this), + m_physical_axes_enabled_ptr(this), + m_physical_positions_ptr(this), + m_virtual_axes_ptr(this), + m_plain_virtual_positions_ptr(this), + m_virtual_positions_ptr(this), + m_virtual_offsets_ptr(this), + m_tracking_ptr(this), + m_trajectory_id_ptr(this), + m_total_trajectory_points_ptr(this), + m_remaining_trajectory_points_ptr(this), + m_actual_position_ptr(this), + m_commanded_position_ptr(this), + m_position_difference_ptr(this), + m_status_ptr(this), + m_socket_configuration(SRTMinorServoSocketConfiguration::getInstance(container_services)), + m_socket(SRTMinorServoSocket::getInstance(m_socket_configuration.m_ip_address, m_socket_configuration.m_port, m_socket_configuration.m_timeout)) +{ + AUTO_TRACE(m_servo_name + "::SRTDerotatorImpl()"); +} + +SRTDerotatorImpl::~SRTDerotatorImpl() +{ + AUTO_TRACE(m_servo_name + "::~SRTDerotatorImpl()"); + + if(m_status_thread != nullptr) + { + m_status_thread->terminate(); + getContainerServices()->getThreadManager()->destroy(m_status_thread); + } +} + +void SRTDerotatorImpl::initialize() +{ + AUTO_TRACE(m_servo_name + "::initialize()"); + + try + { + m_enabled_ptr = new ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>((m_component_name + ":enabled").c_str(), getComponent(), + new MSAnswerMapDevIO<Management::TBoolean, SRTMinorServoStatus>("enabled", m_status, &SRTMinorServoStatus::isEnabled), true); + m_drive_cabinet_status_ptr = new ROEnumImpl<ACS_ENUM_T(SRTMinorServoCabinetStatus), POA_MinorServo::ROSRTMinorServoCabinetStatus>((m_component_name + ":drive_cabinet_status").c_str(), getComponent(), + new MSAnswerMapDevIO<SRTMinorServoCabinetStatus, SRTMinorServoStatus>("drive_cabinet_status", m_status, &SRTMinorServoStatus::getDriveCabinetStatus), true); + m_block_ptr = new ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>((m_component_name + ":block").c_str(), getComponent(), + new MSAnswerMapDevIO<Management::TBoolean, SRTMinorServoStatus>("block", m_status, &SRTMinorServoStatus::isBlocked), true); + m_operative_mode_ptr = new ROEnumImpl<ACS_ENUM_T(SRTMinorServoOperativeMode), POA_MinorServo::ROSRTMinorServoOperativeMode>((m_component_name + ":operative_mode").c_str(), getComponent(), + new MSAnswerMapDevIO<SRTMinorServoOperativeMode, SRTMinorServoStatus>("operative_mode", m_status, &SRTMinorServoStatus::getOperativeMode), true); + m_physical_axes_enabled_ptr = new baci::RObooleanSeq((m_component_name + ":physical_axes_enabled").c_str(), getComponent(), + new MSAnswerMapDevIO<ACS::booleanSeq, SRTMinorServoStatus>("physical_axes_enabled", m_status, &SRTMinorServoStatus::getPhysicalAxesEnabled), true); + m_physical_positions_ptr = new baci::ROdoubleSeq((m_component_name + ":physical_positions").c_str(), getComponent(), + new MSAnswerMapDevIO<ACS::doubleSeq, SRTMinorServoStatus>("physical_positions", m_status, &SRTMinorServoStatus::getPhysicalPositions), true); + m_virtual_axes_ptr = new baci::ROlong((m_component_name + ":virtual_axes").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Long, const size_t>(m_virtual_axes), true); + m_plain_virtual_positions_ptr = new baci::ROdoubleSeq((m_component_name + ":plain_virtual_positions").c_str(), getComponent(), + new MSAnswerMapDevIO<ACS::doubleSeq, SRTMinorServoStatus>("plain_virtual_positions", m_status, &SRTMinorServoStatus::getPlainVirtualPositions), true); + m_virtual_positions_ptr = new baci::ROdoubleSeq((m_component_name + ":virtual_positions").c_str(), getComponent(), + new MSAnswerMapDevIO<ACS::doubleSeq, SRTMinorServoStatus>("virtual_positions", m_status, &SRTMinorServoStatus::getVirtualPositions), true); + m_virtual_offsets_ptr = new baci::ROdoubleSeq((m_component_name + ":virtual_offsets").c_str(), getComponent(), + new MSAnswerMapDevIO<ACS::doubleSeq, SRTMinorServoStatus>("virtual_offsets", m_status, &SRTMinorServoStatus::getVirtualOffsets), true); + m_tracking_ptr = new ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>((m_component_name + ":tracking").c_str(), getComponent(), + new MSGenericDevIO<Management::TBoolean, std::atomic<Management::TBoolean>>(m_tracking), true); + m_trajectory_id_ptr = new baci::ROlong((m_component_name + ":trajectory_id").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Long, std::atomic<unsigned int>>(m_trajectory_id), true); + m_total_trajectory_points_ptr = new baci::ROlong((m_component_name + ":total_trajectory_points").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Long, std::atomic<unsigned int>>(m_total_trajectory_points), true); + m_remaining_trajectory_points_ptr = new baci::ROlong((m_component_name + ":remaining_trajectory_points").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Long, std::atomic<unsigned int>>(m_remaining_trajectory_points), true); + m_actual_position_ptr = new baci::ROdouble((m_component_name + ":actPosition").c_str(), getComponent(), + new MSAnswerMapDevIO<CORBA::Double, SRTDerotatorStatus>("actPosition", m_status, &SRTDerotatorStatus::getActualPosition), true); + m_commanded_position_ptr = new baci::RWdouble((m_component_name + ":cmdPosition").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Double, std::atomic<double>>(m_commanded_position), true); + m_position_difference_ptr = new baci::ROdouble((m_component_name + ":positionDiff").c_str(), getComponent(), + new MSGenericDevIO<CORBA::Double, std::atomic<double>>(m_position_difference), true); + m_status_ptr = new baci::ROpattern((m_component_name + ":status").c_str(), getComponent(), + new MSGenericDevIO<ACS::pattern, std::atomic<long>>(m_status_pattern), true); + } + catch(std::bad_alloc& ba) + { + _EXCPT(ComponentErrors::MemoryAllocationExImpl, ex, (m_servo_name + "::initialize()").c_str()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + + // Try to read the current status of the derotator + try + { + updateStatus(); + } + catch(...) + { + // This block is necessary since the socket might not be connected yet. If the Leonardo system is not reachable the status(); call will fail, but we want to instantiate the component anyway + // A non connected socket will try to connect every time a new command is sent, therefore the status thread will establish the connection as soon as possible. + } +} + +void SRTDerotatorImpl::execute() +{ + AUTO_TRACE(m_servo_name + "::execute()"); + + try + { + m_status_thread = getContainerServices()->getThreadManager()->create<SRTDerotatorStatusThread, SRTDerotatorImpl&>((m_component_name + "StatusThread").c_str(), *this); + m_status_thread->setSleepTime(getCDBValue<double>(getContainerServices(), "status_thread_period") * 10000000); + m_status_thread->resume(); + } + catch(acsthreadErrType::CanNotSpawnThreadExImpl& impl) + { + // The thread failed to start for some reason + _ADD_BACKTRACE(ComponentErrors::CanNotStartThreadExImpl, ex, impl, (m_component_name + "::startThread()").c_str()); + ex.setThreadName((m_component_name + "StatusThread").c_str()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } +} + +void SRTDerotatorImpl::cleanUp() +{ + AUTO_TRACE(m_servo_name + "::cleanUp()"); +} + +void SRTDerotatorImpl::aboutToAbort() +{ + AUTO_TRACE(m_servo_name + "::aboutToAbort()"); +} + +/////////////////// PUBLIC methods +bool SRTDerotatorImpl::updateStatus() +{ + AUTO_TRACE(m_servo_name + "::status()"); + + // Initialize the status variable + long status = 0; + + // We don't check if the socket is connected here since a status command will try to reconnect it automatically + try + { + m_socket.sendCommand(SRTMinorServoCommandLibrary::status(m_servo_name), m_status); + + ACS::Time last_timestamp = m_status.getTimestamp(); + + // Send the zero offset if not correct + if(m_status.getVirtualOffsets()[0] != m_zero_offset) + { + m_socket.sendCommand(SRTMinorServoCommandLibrary::offset(m_servo_name, { m_zero_offset })); + } + + if(m_status.isBlocked() == Management::MNG_TRUE || m_status.getDriveCabinetStatus() == DRIVE_CABINET_ERROR) + { + // Set to failure + status |= (1L << 1); + // Not ready as well + status |= (1L << 3); + } + + if(!isReady()) + { + // No failures but not ready + status |= (1L << 3); + } + + if(isSlewing()) + { + status |= (1L << 4); + } + + double current_point = m_status.getActualPosition(); + + // Calculate the current speed of the axes, °/s + try + { + std::pair<ACS::Time, const std::vector<double>> previous_point = m_positions_queue.get(last_timestamp); + m_c_s = (current_point - previous_point.second[0]) * ((double(last_timestamp - previous_point.first)) / 10000000); + } + catch(...) + { + // Empty queue, first reading, skip the speed calculation + } + + if(m_status.getOperativeMode() == OPERATIVE_MODE_PROGRAMTRACK) + { + try + { + m_commanded_position = m_tracking_queue.get(last_timestamp).second[0]; + m_remaining_trajectory_points.store(m_tracking_queue.getRemainingPoints(last_timestamp)); + } + catch(...) + { + // Weird, we should have at least one tracking point by now, just skip + } + } + + m_positions_queue.put(last_timestamp, { current_point }); + m_position_difference.store(m_commanded_position - current_point); + if(std::fabs(m_position_difference.load()) <= m_tracking_delta) + { + m_tracking.store(Management::MNG_TRUE); + } + else + { + m_tracking.store(Management::MNG_FALSE); + } + } + catch(...) + { + // Communication error, sets failure, communication error and not ready bits + status |= (1L << 1); + status |= (1L << 2); + status |= (1L << 3); + + m_status_pattern.store(status); + return false; + } + + m_status_pattern.store(status); + return true; +} + +void SRTDerotatorImpl::setup() +{ + AUTO_TRACE(m_servo_name + "::setup()"); +} + +void SRTDerotatorImpl::setPosition(CORBA::Double position) +{ + AUTO_TRACE(m_servo_name + "::setPosition()"); + + checkLineStatus(); + + if(position < m_min || position > m_max) + { + _EXCPT(DerotatorErrors::OutOfRangeErrorExImpl, ex, (m_servo_name + "::setPosition()").c_str()); + ex.addData("Reason", std::string("Resulting position " + std::to_string(position) + " out of range.").c_str()); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } + + // Sign inversion required + double pos = position * -1; + + if(!m_socket.sendCommand(SRTMinorServoCommandLibrary::preset(m_servo_name, std::vector<double>{ pos })).checkOutput()) + { + _EXCPT(DerotatorErrors::CommunicationErrorExImpl, ex, (m_servo_name + "::setPosition()").c_str()); + ex.addData("Reason", "Received NAK in response to a PRESET command."); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } + + m_commanded_position.store(position); +} + +double SRTDerotatorImpl::getPositionFromHistory(ACS::Time acs_time) +{ + AUTO_TRACE(m_servo_name + "::getPositionFromHistory()"); + + // Get the latest position + if(acs_time == 0) + { + acs_time = getTimeStamp(); + } + + try + { + return m_positions_queue.get(acs_time).second[0]; + } + catch(std::logic_error& le) + { + // TODO: change this to ComponentErrors + _EXCPT(ComponentErrors::OperationErrorExImpl, ex, (m_servo_name + "::getPositionFromHistory()").c_str()); + ex.setReason("Positions history is empty!"); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } +} + +bool SRTDerotatorImpl::isReady() +{ + // Always ready unless it has errors + return (m_status.isBlocked() == Management::MNG_TRUE || m_status.getDriveCabinetStatus() == DRIVE_CABINET_ERROR) ? false : true; +} + +bool SRTDerotatorImpl::isSlewing() +{ + SRTMinorServoOperativeMode operative_mode = m_status.getOperativeMode(); + if(operative_mode == OPERATIVE_MODE_PROGRAMTRACK) + { + if(m_remaining_trajectory_points.load() > 0) + { + // We are still tracking a trajectory, therefore we are slewing + return true; + } + else + { + // Trajectory is finished, the derotator might still be slowing down to 0°/s but for simplicity we say it's not slewing anymore + return false; + } + } + else if(operative_mode == OPERATIVE_MODE_UNKNOWN) + { + // We trust the protocol, this means the derotator is moving due to a preset command + return true; + } + + return false; +} + +void SRTDerotatorImpl::loadTrackingPoint(ACS::Time point_time, CORBA::Double position, CORBA::Boolean restart) +{ + AUTO_TRACE(m_servo_name + "::loadTrackingPoint()"); + + checkLineStatus(); + + if(position < m_min || position > m_max) + { + _EXCPT(DerotatorErrors::OutOfRangeErrorExImpl, ex, (m_servo_name + "::loadTrackingPoint()").c_str()); + ex.addData("Reason", std::string("Resulting position " + std::to_string(position) + " out of range.").c_str()); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } + + unsigned int trajectory_id, point_id; + + if(restart) + { + trajectory_id = (unsigned int)(IRA::CIRATools::ACSTime2UNIXEpoch(point_time)); + point_id = 0; + } + else + { + trajectory_id = m_trajectory_id.load(); + point_id = m_total_trajectory_points.load(); + } + + if(!m_socket.sendCommand(SRTMinorServoCommandLibrary::programTrack(m_servo_name, trajectory_id, point_id, std::vector<double>{ -position }, restart ? IRA::CIRATools::ACSTime2UNIXEpoch(point_time) : 0)).checkOutput()) + { + _EXCPT(DerotatorErrors::CommunicationErrorExImpl, ex, (m_servo_name + "::loadTrackingPoint()").c_str()); + ex.addData("Reason", "Received NAK in response to a PROGRAMTRACK command."); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } + + if(restart) + { + // Clear the tracking queue to avoid interpolation between 2 different trajectories + m_tracking_queue.clear(); + } + + m_trajectory_id.store(trajectory_id); + m_tracking_queue.put(point_time, { position }); + m_total_trajectory_points.store(point_id + 1); +} + + +/////////////////// PROTECTED methods +void SRTDerotatorImpl::checkLineStatus() +{ + if(!m_socket.isConnected()) + { + _EXCPT(DerotatorErrors::CommunicationErrorExImpl, ex, (m_servo_name + "checkLineStatus()").c_str()); + ex.addData("Reason", "Socket not connected."); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } + + if(m_status.isBlocked() == Management::MNG_TRUE || m_status.getDriveCabinetStatus() == DRIVE_CABINET_ERROR) + { + _EXCPT(DerotatorErrors::UnexpectedErrorExImpl, ex, (m_servo_name + "::checkLineStatus()").c_str()); + ex.addData("Reason", "Servo system blocked or drive cabinet error."); + ex.log(LM_DEBUG); + throw ex.getDerotatorErrorsEx(); + } +} + +/////////////////// PRIVATE methods +std::vector<std::string> SRTDerotatorImpl::getPropertiesTable(SRTDerotatorImpl& object, const std::string& properties_name) +{ + AUTO_STATIC_TRACE(object.m_servo_name + "::getPropertiesTable()"); + + std::vector<std::string> properties; + + IRA::CDBTable table(object.getContainerServices(), properties_name.c_str(), std::string("DataBlock/MinorServo/" + object.m_servo_name).c_str()); + IRA::CError error; + error.Reset(); + + if(!table.addField(error, "property_name", IRA::CDataField::STRING)) + { + error.setExtra("Error adding field property_name", 0); + } + if(!error.isNoError()) + { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl, ex, error); + ex.setCode(error.getErrorCode()); + ex.setDescription((const char *)error.getDescription()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + if(!table.openTable(error)) + { + _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, ex, error); + ex.setFieldName(properties_name.c_str()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + + table.First(); + for(unsigned int i = 0; i < table.recordCount(); i++, table.Next()) + { + properties.push_back(std::string(table["property_name"]->asString())); + } + table.closeTable(); + + size_t expected_size = 0; + + if(properties_name.find("virtual_") == 0) + { + expected_size = object.m_virtual_axes; + } + else if(properties_name.find("physical_") == 0) + { + expected_size = object.m_physical_axes; + } + + if(expected_size == 0 || properties.size() != expected_size) + { + _EXCPT(ComponentErrors::CDBAccessExImpl, ex, (object.m_servo_name + "::initialize()").c_str()); + ex.setFieldName(properties_name.c_str()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + + return properties; +} + + +GET_PROPERTY_REFERENCE(Management::ROTBoolean, SRTDerotatorImpl, m_enabled_ptr, enabled); +GET_PROPERTY_REFERENCE(ROSRTMinorServoCabinetStatus, SRTDerotatorImpl, m_drive_cabinet_status_ptr, drive_cabinet_status); +GET_PROPERTY_REFERENCE(Management::ROTBoolean, SRTDerotatorImpl, m_block_ptr, block); +GET_PROPERTY_REFERENCE(ROSRTMinorServoOperativeMode, SRTDerotatorImpl, m_operative_mode_ptr, operative_mode); +GET_PROPERTY_REFERENCE(ACS::RObooleanSeq, SRTDerotatorImpl, m_physical_axes_enabled_ptr, physical_axes_enabled); +GET_PROPERTY_REFERENCE(ACS::ROdoubleSeq, SRTDerotatorImpl, m_physical_positions_ptr, physical_positions); +GET_PROPERTY_REFERENCE(ACS::ROlong, SRTDerotatorImpl, m_virtual_axes_ptr, virtual_axes); +GET_PROPERTY_REFERENCE(ACS::ROdoubleSeq, SRTDerotatorImpl, m_plain_virtual_positions_ptr, plain_virtual_positions); +GET_PROPERTY_REFERENCE(ACS::ROdoubleSeq, SRTDerotatorImpl, m_virtual_positions_ptr, virtual_positions); +GET_PROPERTY_REFERENCE(ACS::ROdoubleSeq, SRTDerotatorImpl, m_virtual_offsets_ptr, virtual_offsets); +GET_PROPERTY_REFERENCE(Management::ROTBoolean, SRTDerotatorImpl, m_tracking_ptr, tracking); +GET_PROPERTY_REFERENCE(ACS::ROlong, SRTDerotatorImpl, m_trajectory_id_ptr, trajectory_id); +GET_PROPERTY_REFERENCE(ACS::ROlong, SRTDerotatorImpl, m_total_trajectory_points_ptr, total_trajectory_points); +GET_PROPERTY_REFERENCE(ACS::ROlong, SRTDerotatorImpl, m_remaining_trajectory_points_ptr, remaining_trajectory_points); +GET_PROPERTY_REFERENCE(ACS::ROdouble, SRTDerotatorImpl, m_actual_position_ptr, actPosition); +GET_PROPERTY_REFERENCE(ACS::RWdouble, SRTDerotatorImpl, m_commanded_position_ptr, cmdPosition); +GET_PROPERTY_REFERENCE(ACS::ROdouble, SRTDerotatorImpl, m_position_difference_ptr, positionDiff); +GET_PROPERTY_REFERENCE(ACS::ROpattern, SRTDerotatorImpl, m_status_ptr, status); + +MACI_DLL_SUPPORT_FUNCTIONS(SRTDerotatorImpl) diff --git a/SRT/Servers/SRTMinorServo/src/SRTDerotatorStatusThread.cpp b/SRT/Servers/SRTMinorServo/src/SRTDerotatorStatusThread.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9ddd980c5a9259e04426ab7b37212d047ab1181 --- /dev/null +++ b/SRT/Servers/SRTMinorServo/src/SRTDerotatorStatusThread.cpp @@ -0,0 +1,46 @@ +#include "SRTDerotatorStatusThread.h" + +using namespace MinorServo; + +SRTDerotatorStatusThread::SRTDerotatorStatusThread(const ACE_CString& name, SRTDerotatorImpl& component, const ACS::TimeInterval& response_time, const ACS::TimeInterval& sleep_time) : + ACS::Thread(name, response_time, sleep_time), + m_component(component), + m_sleep_time(this->getSleepTime()) +{ + AUTO_TRACE("SRTDerotatorStatusThread::SRTDerotatorStatusThread()"); +} + +SRTDerotatorStatusThread::~SRTDerotatorStatusThread() +{ + AUTO_TRACE("SRTDerotatorStatusThread::~SRTDerotatorStatusThread()"); +} + +void SRTDerotatorStatusThread::onStart() +{ + AUTO_TRACE("SRTDerotatorStatusThread::onStart()"); + + ACS_LOG(LM_FULL_INFO, "SRTDerotatorStatusThread::onStart()", (LM_DEBUG, "STATUS THREAD STARTED")); +} + +void SRTDerotatorStatusThread::onStop() +{ + AUTO_TRACE("SRTDerotatorStatusThread::onStop()"); + + ACS_LOG(LM_FULL_INFO, "SRTDerotatorStatusThread::onStop()", (LM_DEBUG, "STATUS THREAD STOPPED")); +} + +void SRTDerotatorStatusThread::runLoop() +{ + AUTO_TRACE("SRTDerotatorStatusThread::runLoop()"); + + ACS::Time t0 = getTimeStamp(); + unsigned long sleep_time = 10000000; + + if(m_component.updateStatus()) + { + // Update the sleep time in order to not drift away by adding latency + sleep_time = std::max(m_sleep_time - (getTimeStamp() - t0), (long unsigned int)0); + } + + this->setSleepTime(sleep_time); +}