예제 #1
0
    def state(self, axis):
        """Returns the current axis state"""
        self.log_info("state() called for axis %r" % axis.name)

        # Get a unique status for all IcePAP axes
        status = self.libtraj[axis].status()
        self.log_info("hardware status got: 0x%08x" % status)

        # Convert status from icepaplib to bliss format.
        _state = AxisState()
        if(libicepap.status_ismoving(status)):
            self.log_info("status MOVING")
            _state.set("MOVING")
            return _state

        if(libicepap.status_isready(status)):
            self.log_info("status READY")
            _state.set("READY")

            if(libicepap.status_lowlim(status)):
                _state.set("LIMNEG")

            if(libicepap.status_highlim(status)):
                _state.set("LIMPOS")

            if(libicepap.status_home(status)):
                _state.set("HOME")

            return _state

        # Abnormal end
        return AxisState("FAULT")
예제 #2
0
파일: IcePAP.py 프로젝트: mguijarr/bliss
    def state(self, axis):
        """Returns the current axis state"""
        self.log_info("state() called for axis %r" % axis.name)

        # The axis can only be accessed through a group in IcePAP lib
        # Use the default group
        status = self.libgroup.status(axis.libaxis)

        # Convert status from icepaplib to bliss format.
        self.icestate.clear()

        # first all concurrent states
        if(libicepap.status_lowlim(status)):
            self.icestate.set("LIMNEG")

        if(libicepap.status_highlim(status)):
            self.icestate.set("LIMPOS")

        if(libicepap.status_home(status)):
            self.icestate.set("HOME")

        modcod, modstr, moddsc = libicepap.status_get_mode(status)
        if modcod != None:
            self.icestate.set(modstr)

        sccod, scstr, scdsc = libicepap.status_get_stopcode(status)
        if sccod != None:
            self.icestate.set(scstr)

        if(libicepap.status_isready(status)):
            self.icestate.set("READY")
            # if motor is ready then no need to investigate deeper
            return self.icestate

        if(libicepap.status_ismoving(status)):
            self.icestate.set("MOVING")

        if(not libicepap.status_ispoweron(status)):
            self.icestate.set("POWEROFF")

        discod, disstr, disdsc = libicepap.status_get_disable(status)
        if discod != None:
            self.icestate.set(disstr)

        if not self.icestate.MOVING:
          # it seems it is not safe to call warning and/or alarm commands
          # while homing motor, so let's not ask if motor is moving
          if(libicepap.status_warning(status)):
              warn_str = self.libgroup.warning(axis.libaxis)
              warn_dsc = "warning condition: \n" + str(warn_str)
              self.icestate.create_state("WARNING",  warn_dsc)
              self.icestate.set("WARNING")

          alarm_str = self.libgroup.alarm(axis.libaxis)
          if alarm_str != 'NO':
              alarm_dsc = "alarm condition: " + str(alarm_str)
              self.icestate.create_state("ALARMDESC",  alarm_dsc)
              self.icestate.set("ALARMDESC")

        return self.icestate