Loading Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py +10 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from IRAPy import logger __docformat__ = 'restructuredtext' class Positioner(object): generalLock = threading.Lock() rewindingLock = threading.Lock() Loading Loading @@ -255,7 +256,9 @@ class Positioner(object): if self.control.modes['rewinding'] == 'MANUAL': logger.logInfo('a derotator rewinding is required') while self.control.isRewindingRequired: time.sleep(2) # Wait until the user calls a rewind if self.control.stop: break time.sleep(0.1) # Wait until the user calls a rewind else: logger.logError('wrong rewinding mode: %s' %self.control.modes['rewinding']) except Exception, ex: Loading Loading @@ -299,7 +302,9 @@ class Positioner(object): logger.logInfo('rewinding in progress...') startingTime = now = datetime.datetime.now() while (now - startingTime).seconds < float(self.conf.getAttribute('RewindingTimeout')): if self.device.isTracking(): if self.control.stop: break elif self.device.isTracking(): break else: time.sleep(float(self.conf.getAttribute('RewindingSleepTime'))) Loading Loading @@ -394,7 +399,7 @@ class Positioner(object): """Stop the updating thread""" try: self.control.stop = True self.t.join(timeout=10) self.t.join(timeout=2) if self.t.isAlive(): logger.logWarning('thread %s is alive' %self.t.getName()) except AttributeError: Loading @@ -406,8 +411,9 @@ class Positioner(object): def park(self, parkPosition=0): self._clearOffset() if self.isSetup(): if self.isSetup() and self.isUpdating(): self.stopUpdating() elif self.isSetup(): try: Positioner.generalLock.acquire() self.control.updateScanInfo({'iStaticPos': parkPosition}) Loading Common/Servers/PyDewarPositioner/test/functional/test_rewind.py +13 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ class StartUpdatingTest(unittest2.TestCase): def setUp(self): self.client = PySimpleClient() self.device = self.client.getComponent('RECEIVERS/SRTKBandDerotator') self.antenna = self.client.getComponent('ANTENNA/BossSimulator') self.antenna = self.client.getComponent('ANTENNA/Boss') self.positioner = self.client.getComponent('RECEIVERS/DewarPositioner') self.positioner.setup('KKG') self.positioner.setConfiguration('custom') Loading @@ -28,7 +28,7 @@ class StartUpdatingTest(unittest2.TestCase): self.positioner.park() time.sleep(0.5) self.client.releaseComponent('RECEIVERS/DewarPositioner') self.client.releaseComponent('ANTENNA/BossSimulator') self.client.releaseComponent('ANTENNA/Boss') self.device = self.client.releaseComponent('RECEIVERS/SRTKBandDerotator') Loading Loading @@ -65,6 +65,17 @@ class StartUpdatingTest(unittest2.TestCase): self.assertEqual(self.positioner.isRewinding(), False) self.assertEqual(self.positioner.isTracking(), False) def test_stopUpdating_when_rewinding_required(self): """Verify stopUpdating() works properly when a rewinding is required""" self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) time.sleep(0.5) self.positioner.stopUpdating() time.sleep(1) self.assertFalse(self.positioner.isUpdating()) def test_updating_and_position_after_manual_rewind(self): """Verify position and that it stills updating after a manual rewind""" self.positioner.setRewindingMode('MANUAL') Loading Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_park.py +5 −12 Original line number Diff line number Diff line Loading @@ -21,22 +21,15 @@ class PositionerParkTest(unittest2.TestCase): def test_set_park_position(self): """Vefify the park() method sets the device position.""" try: client = PySimpleClient() device = client.getComponent('RECEIVERS/SRTKBandDerotator') using_mock = False except CannotGetComponentEx: print '\nINFO -> component not available: we will use a mock device' from DewarPositionerMockers.mock_components import MockDevice device = MockDevice() using_mock = True p = Positioner(self.cdbconf) p.setup(siteInfo={}, source=None, device=device) time.sleep(0.5) if using_mock else time.sleep(2) time.sleep(2) park_position=1 p.park(parkPosition=park_position) time.sleep(0.5) if using_mock else time.sleep(3) time.sleep(3) self.assertAlmostEqual( park_position, device.getActPosition(), Loading SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DerotatorName="RECEIVERS/SRTKBandDerotator" ObservatoryName="ANTENNA/Observatory" CoordinateSourceName="ANTENNA/BossSimulator" CoordinateSourceName="ANTENNA/Boss" SetupPosition="0.0" ParkPosition="0.0" /> SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UpdatingTime="0.1" RewindingSleepTime="1" RewindingSleepTime="0.1" RewindingTimeout="200" DefaultConfiguration="FIXED" DefaultRewindingMode="AUTO" Loading Loading
Common/Servers/PyDewarPositioner/src/DewarPositioner/positioner.py +10 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from IRAPy import logger __docformat__ = 'restructuredtext' class Positioner(object): generalLock = threading.Lock() rewindingLock = threading.Lock() Loading Loading @@ -255,7 +256,9 @@ class Positioner(object): if self.control.modes['rewinding'] == 'MANUAL': logger.logInfo('a derotator rewinding is required') while self.control.isRewindingRequired: time.sleep(2) # Wait until the user calls a rewind if self.control.stop: break time.sleep(0.1) # Wait until the user calls a rewind else: logger.logError('wrong rewinding mode: %s' %self.control.modes['rewinding']) except Exception, ex: Loading Loading @@ -299,7 +302,9 @@ class Positioner(object): logger.logInfo('rewinding in progress...') startingTime = now = datetime.datetime.now() while (now - startingTime).seconds < float(self.conf.getAttribute('RewindingTimeout')): if self.device.isTracking(): if self.control.stop: break elif self.device.isTracking(): break else: time.sleep(float(self.conf.getAttribute('RewindingSleepTime'))) Loading Loading @@ -394,7 +399,7 @@ class Positioner(object): """Stop the updating thread""" try: self.control.stop = True self.t.join(timeout=10) self.t.join(timeout=2) if self.t.isAlive(): logger.logWarning('thread %s is alive' %self.t.getName()) except AttributeError: Loading @@ -406,8 +411,9 @@ class Positioner(object): def park(self, parkPosition=0): self._clearOffset() if self.isSetup(): if self.isSetup() and self.isUpdating(): self.stopUpdating() elif self.isSetup(): try: Positioner.generalLock.acquire() self.control.updateScanInfo({'iStaticPos': parkPosition}) Loading
Common/Servers/PyDewarPositioner/test/functional/test_rewind.py +13 −2 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ class StartUpdatingTest(unittest2.TestCase): def setUp(self): self.client = PySimpleClient() self.device = self.client.getComponent('RECEIVERS/SRTKBandDerotator') self.antenna = self.client.getComponent('ANTENNA/BossSimulator') self.antenna = self.client.getComponent('ANTENNA/Boss') self.positioner = self.client.getComponent('RECEIVERS/DewarPositioner') self.positioner.setup('KKG') self.positioner.setConfiguration('custom') Loading @@ -28,7 +28,7 @@ class StartUpdatingTest(unittest2.TestCase): self.positioner.park() time.sleep(0.5) self.client.releaseComponent('RECEIVERS/DewarPositioner') self.client.releaseComponent('ANTENNA/BossSimulator') self.client.releaseComponent('ANTENNA/Boss') self.device = self.client.releaseComponent('RECEIVERS/SRTKBandDerotator') Loading Loading @@ -65,6 +65,17 @@ class StartUpdatingTest(unittest2.TestCase): self.assertEqual(self.positioner.isRewinding(), False) self.assertEqual(self.positioner.isTracking(), False) def test_stopUpdating_when_rewinding_required(self): """Verify stopUpdating() works properly when a rewinding is required""" self.positioner.setRewindingMode('MANUAL') az, el, target = self.prepare_negative_oor() # after prepare_negative_oor(), startUpdating() will cause oor self.positioner.startUpdating(MNG_TRACK, ANT_SOUTH, az, el, 0, 0) time.sleep(0.5) self.positioner.stopUpdating() time.sleep(1) self.assertFalse(self.positioner.isUpdating()) def test_updating_and_position_after_manual_rewind(self): """Verify position and that it stills updating after a manual rewind""" self.positioner.setRewindingMode('MANUAL') Loading
Common/Servers/PyDewarPositioner/test/pyunit/positioner/test_park.py +5 −12 Original line number Diff line number Diff line Loading @@ -21,22 +21,15 @@ class PositionerParkTest(unittest2.TestCase): def test_set_park_position(self): """Vefify the park() method sets the device position.""" try: client = PySimpleClient() device = client.getComponent('RECEIVERS/SRTKBandDerotator') using_mock = False except CannotGetComponentEx: print '\nINFO -> component not available: we will use a mock device' from DewarPositionerMockers.mock_components import MockDevice device = MockDevice() using_mock = True p = Positioner(self.cdbconf) p.setup(siteInfo={}, source=None, device=device) time.sleep(0.5) if using_mock else time.sleep(2) time.sleep(2) park_position=1 p.park(parkPosition=park_position) time.sleep(0.5) if using_mock else time.sleep(3) time.sleep(3) self.assertAlmostEqual( park_position, device.getActPosition(), Loading
SRT/CDB/alma/DataBlock/DewarPositioner/KKG/Mapping/Mapping.xml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DerotatorName="RECEIVERS/SRTKBandDerotator" ObservatoryName="ANTENNA/Observatory" CoordinateSourceName="ANTENNA/BossSimulator" CoordinateSourceName="ANTENNA/Boss" SetupPosition="0.0" ParkPosition="0.0" />
SRT/CDB/alma/RECEIVERS/DewarPositioner/DewarPositioner.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" UpdatingTime="0.1" RewindingSleepTime="1" RewindingSleepTime="0.1" RewindingTimeout="200" DefaultConfiguration="FIXED" DefaultRewindingMode="AUTO" Loading