Skip to content
Snippets Groups Projects
Commit 271e52bc authored by Jens Meyer's avatar Jens Meyer
Browse files

Added RUNNING state to indicate the the robot movement was paused

when entering the hutch. The movement will resume when
the hutch is closed.
parent a01a68d0
No related branches found
No related tags found
No related merge requests found
...@@ -19,14 +19,14 @@ handle all functionality of the robot. ...@@ -19,14 +19,14 @@ handle all functionality of the robot.
""" """
# PyTango imports # PyTango imports
import PyTango import tango
from PyTango import DebugIt from tango import DebugIt
from PyTango.server import run from tango.server import run
from PyTango.server import Device, DeviceMeta from tango.server import Device
from PyTango.server import attribute, command from tango.server import attribute, command
from PyTango.server import device_property from tango.server import device_property
from PyTango import AttrQuality, DispLevel, DevState from tango import AttrQuality, DispLevel, DevState
from PyTango import AttrWriteType, PipeWriteType from tango import AttrWriteType, PipeWriteType
# Additional import # Additional import
# PROTECTED REGION ID(TomoSampleChanger.additionnal_import) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.additionnal_import) ENABLED START #
...@@ -50,8 +50,17 @@ class TomoSampleChanger(Device): ...@@ -50,8 +50,17 @@ class TomoSampleChanger(Device):
The robot can be installed on different tomgraphy end stations and aligns itself with the set-up used. The robot can be installed on different tomgraphy end stations and aligns itself with the set-up used.
The class used the StaubLink/StaubPy/id19Controller.py of the StaubLink project on the ESRF Gitlab to The class used the StaubLink/StaubPy/id19Controller.py of the StaubLink project on the ESRF Gitlab to
handle all functionality of the robot. handle all functionality of the robot.
**Properties:**
- Device Property
sampleLoaded
- Is the sample loaded
- Type:'DevBoolean'
samplePosition
- The position of the loaded sample
- Type:'DevString'
""" """
__metaclass__ = DeviceMeta
# PROTECTED REGION ID(TomoSampleChanger.class_variable) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.class_variable) ENABLED START #
green_mode = PyTango.GreenMode.Gevent green_mode = PyTango.GreenMode.Gevent
...@@ -273,11 +282,13 @@ class TomoSampleChanger(Device): ...@@ -273,11 +282,13 @@ class TomoSampleChanger(Device):
# ----------------- # -----------------
sampleLoaded = device_property( sampleLoaded = device_property(
dtype='bool', default_value=False dtype='DevBoolean',
default_value=False
) )
samplePosition = device_property( samplePosition = device_property(
dtype='str', default_value="None" dtype='DevString',
default_value="None"
) )
# ---------- # ----------
...@@ -285,48 +296,48 @@ class TomoSampleChanger(Device): ...@@ -285,48 +296,48 @@ class TomoSampleChanger(Device):
# ---------- # ----------
SamplePosition = attribute( SamplePosition = attribute(
dtype='str', dtype='DevString',
) )
SampleLoaded = attribute( SampleLoaded = attribute(
dtype='bool', dtype='DevBoolean',
label="Sample loaded", label="Sample loaded",
doc="The name of the sample currently loaded", doc="The name of the sample currently loaded",
) )
Aligned = attribute( Aligned = attribute(
dtype='bool', dtype='DevBoolean',
doc="Sample changer aligned with tomograph end station", doc="Sample changer aligned with tomograph end station",
) )
ParkingPosition = attribute( ParkingPosition = attribute(
dtype='bool', dtype='DevBoolean',
) )
RemoteMode = attribute( RemoteMode = attribute(
dtype='bool', dtype='DevBoolean',
) )
AirPressureOK = attribute( AirPressureOK = attribute(
dtype='bool', dtype='DevBoolean',
label="Air pressure OK", label="Air pressure OK",
doc="True when the air pressure is not to high nor to low.", doc="True when the air pressure is not to high nor to low.",
) )
WagoOK = attribute( WagoOK = attribute(
dtype='bool', dtype='DevBoolean',
label="Wago OK", label="Wago OK",
doc="True when the connection to the interlock Wago controller is alive.", doc="True when the connection to the interlock Wago controller is alive.",
) )
TomographUsed = attribute( TomographUsed = attribute(
dtype='str', dtype='DevString',
label="Tomograph used", label="Tomograph used",
doc="The name of the tomography end station where the sample changer is installed.", doc="The name of the tomography end station where the sample changer is installed.",
) )
RobotLibraryName = attribute( RobotLibraryName = attribute(
dtype='str', dtype='DevString',
label="Robot Library Name", label="Robot Library Name",
) )
...@@ -335,6 +346,7 @@ class TomoSampleChanger(Device): ...@@ -335,6 +346,7 @@ class TomoSampleChanger(Device):
# --------------- # ---------------
def init_device(self): def init_device(self):
"""Initialises the attributes and properties of the TomoSampleChanger."""
Device.init_device(self) Device.init_device(self)
# PROTECTED REGION ID(TomoSampleChanger.init_device) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.init_device) ENABLED START #
...@@ -406,15 +418,21 @@ class TomoSampleChanger(Device): ...@@ -406,15 +418,21 @@ class TomoSampleChanger(Device):
# PROTECTED REGION END # // TomoSampleChanger.init_device # PROTECTED REGION END # // TomoSampleChanger.init_device
def always_executed_hook(self): def always_executed_hook(self):
"""Method always executed before any TANGO command is executed."""
# PROTECTED REGION ID(TomoSampleChanger.always_executed_hook) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.always_executed_hook) ENABLED START #
pass pass
# PROTECTED REGION END # // TomoSampleChanger.always_executed_hook # PROTECTED REGION END # // TomoSampleChanger.always_executed_hook
def delete_device(self): def delete_device(self):
"""Hook to delete resources allocated in init_device.
This method allows for any memory or other resources allocated in the
init_device method to be released. This method is called by the device
destructor and by the device Init command.
"""
# PROTECTED REGION ID(TomoSampleChanger.delete_device) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.delete_device) ENABLED START #
pass pass
# PROTECTED REGION END # // TomoSampleChanger.delete_device # PROTECTED REGION END # // TomoSampleChanger.delete_device
# ------------------ # ------------------
# Attributes methods # Attributes methods
# ------------------ # ------------------
...@@ -490,7 +508,6 @@ class TomoSampleChanger(Device): ...@@ -490,7 +508,6 @@ class TomoSampleChanger(Device):
# PROTECTED REGION END # // TomoSampleChanger.RobotLibraryName_read # PROTECTED REGION END # // TomoSampleChanger.RobotLibraryName_read
# -------- # --------
# Commands # Commands
# -------- # --------
...@@ -510,8 +527,9 @@ class TomoSampleChanger(Device): ...@@ -510,8 +527,9 @@ class TomoSampleChanger(Device):
else: else:
if self.is_moving == True: if self.is_moving == True:
# pause mode activated # pause mode activated
# The hutch was opened, the movemeny is inerrupted and will resume on hutch closure
if self.robot.power() == 0: if self.robot.power() == 0:
_state = PyTango.DevState.PAUSE _state = PyTango.DevState.RUNNING
else: else:
_state = PyTango.DevState.MOVING _state = PyTango.DevState.MOVING
else: else:
...@@ -542,8 +560,8 @@ class TomoSampleChanger(Device): ...@@ -542,8 +560,8 @@ class TomoSampleChanger(Device):
if state == PyTango.DevState.DISABLE: if state == PyTango.DevState.DISABLE:
self._status += "DISABLED" self._status += "DISABLED"
else: else:
if state == PyTango.DevState.PAUSE: if state == PyTango.DevState.RUNNING:
self._status += "PAUSE" self._status += "PAUSE, movement is paused due to hutch opening"
else: else:
if state == PyTango.DevState.MOVING: if state == PyTango.DevState.MOVING:
self._status += "MOVING" self._status += "MOVING"
...@@ -587,9 +605,6 @@ class TomoSampleChanger(Device): ...@@ -587,9 +605,6 @@ class TomoSampleChanger(Device):
self._status += "\nReading of the robot status failed\n" self._status += "\nReading of the robot status failed\n"
self._status += "\n" self._status += "\n"
self._status += str(self.state_error) self._status += str(self.state_error)
else:
if state == PyTango.DevState.PAUSE:
self._status += "\nGo to the robot teach pendant and follows instructions\n"
self.set_status(self._status) self.set_status(self._status)
return self._status return self._status
...@@ -597,8 +612,8 @@ class TomoSampleChanger(Device): ...@@ -597,8 +612,8 @@ class TomoSampleChanger(Device):
# PROTECTED REGION END # // TomoSampleChanger.Status # PROTECTED REGION END # // TomoSampleChanger.Status
@command( @command(
dtype_in='str', dtype_in='DevString',
doc_in="Sample to load", doc_in="Sample to load",
) )
@DebugIt() @DebugIt()
def LoadSample(self, argin): def LoadSample(self, argin):
...@@ -804,6 +819,7 @@ class TomoSampleChanger(Device): ...@@ -804,6 +819,7 @@ class TomoSampleChanger(Device):
def main(args=None, **kwargs): def main(args=None, **kwargs):
"""Main function of the TomoSampleChanger module."""
# PROTECTED REGION ID(TomoSampleChanger.main) ENABLED START # # PROTECTED REGION ID(TomoSampleChanger.main) ENABLED START #
# Enable gevents for the server # Enable gevents for the server
...@@ -812,5 +828,6 @@ def main(args=None, **kwargs): ...@@ -812,5 +828,6 @@ def main(args=None, **kwargs):
# PROTECTED REGION END # // TomoSampleChanger.main # PROTECTED REGION END # // TomoSampleChanger.main
if __name__ == '__main__': if __name__ == '__main__':
main() main()
<?xml version="1.0" encoding="ASCII"?> <?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="TomoSampleChanger" pogoRevision="9.6"> <classes name="TomoSampleChanger" pogoRevision="9.7">
<description description="Handles the sample changer robot for micro tomography on ID19.&#xA;The robot can be installed on different tomgraphy end stations and aligns itself with the set-up used.&#xA;The class used the StaubLink/StaubPy/id19Controller.py of the StaubLink project on the ESRF Gitlab to &#xA;handle all functionality of the robot." title="Sample changer for micro tomography on ID19" sourcePath="/mntdirect/_users/meyer/ID19/SampleChanger/SampleChangerDS" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="Copyright (C): 2018&#xA; European Synchrotron Radiation Facility&#xA; BP 220, Grenoble 38043&#xA; France" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <description description="Handles the sample changer robot for micro tomography on ID19.&#xA;The robot can be installed on different tomgraphy end stations and aligns itself with the set-up used.&#xA;The class used the StaubLink/StaubPy/id19Controller.py of the StaubLink project on the ESRF Gitlab to &#xA;handle all functionality of the robot." title="Sample changer for micro tomography on ID19" sourcePath="/mntdirect/_users/meyer/ID19/SampleChanger/SampleChangerDS" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="Copyright (C): 2018&#xA; European Synchrotron Radiation Facility&#xA; BP 220, Grenoble 38043&#xA; France" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/> <inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at esrf.fr - meyer" author="meyer" emailDomain="esrf.fr" classFamily="BeamlineComponents" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="none" reference=""/> <identification contact="at esrf.fr - meyer" author="meyer" emailDomain="esrf.fr" classFamily="BeamlineComponents" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="none" reference=""/>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
<states name="MOVING" description="Moving to load, unload or align"> <states name="MOVING" description="Moving to load, unload or align">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states> </states>
<states name="PAUSE" description="Waiting for restart"> <states name="RUNNING" description="The robot movement was stopped to enter the hutch. The movement will resume &#xA;when the hutch will be closed.">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states> </states>
<states name="FAULT" description="Requested movement failed."> <states name="FAULT" description="Requested movement failed.">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment