Commit d45211b1 authored by Marco Buttu's avatar Marco Buttu
Browse files

We avoid to call directly the Derotator.setPosition() in case of out of range.

The DewarPositioner checks the derotator limits before commanding a new position.
This avoid the container to log an error when it intercepts the exception raised by
the Derotator.
parent 91edcf7a
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -124,11 +124,9 @@ class Positioner(object):

    def _setPosition(self, position):
        self.control.target = position + self.control.offset
        if self.device.getMinLimit() < self.control.target < self.device.getMaxLimit():
            try:
                self.device.setPosition(self.control.target)
        except DerotatorErrors.OutOfRangeErrorEx:
            raise OutOfRangeError("position %.2f out of range {%.2f, %.2f}" 
                %(self.control.target, self.device.getMinLimit(), self.device.getMaxLimit()))
            except (DerotatorErrors.PositioningErrorEx, DerotatorErrors.CommunicationErrorEx), ex:
                raeson = "cannot set the %s position" %self.device._get_name()
                logger.logError('%s: %s' %(raeson, ex.message))
@@ -137,6 +135,9 @@ class Positioner(object):
                raeson = "unknown exception setting the %s position" %self.device._get_name()
                logger.logError('%s: %s' %(raeson, ex.message))
                raise PositionerError(raeson)
        else:
            raise OutOfRangeError("position %.2f out of range {%.2f, %.2f}" 
                %(self.control.target, self.device.getMinLimit(), self.device.getMaxLimit()))


    def startUpdating(self, axis, sector, az, el, ra, dec):
@@ -535,7 +536,7 @@ class Positioner(object):

    def getCmdPosition(self):
        if self.isSetup():
            return self.device.getCmdPosition()
            return self.control.target
        else:
            raise NotAllowedError('positioner not configured: a setup() is required')