Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 from abs_hand_command import AbsractHandCommand
00038
00039
00040 class ToolchangerCommand(AbsractHandCommand):
00041 '''
00042 Following Command design pattern, this class represents commands for
00043 a toolchanger of NEXTAGE OPEN.
00044 '''
00045
00046
00047
00048 HAND_TOOLCHANGE_ON = 'toolchange_on'
00049 HAND_TOOLCHANGE_OFF = 'toolchange_off'
00050
00051 def __init__(self, hands, hand, dio_pins):
00052 super(ToolchangerCommand, self).__init__(hands, hand, dio_pins)
00053
00054 def _assign_dio_names(self, dio_pins):
00055 '''
00056 @see abs_hand_command.AbsractHandCommand._assign_dio_names
00057 '''
00058 self._DIO_VALVE5PORT_L = dio_pins[0]
00059 self._DIO_VALVE5PORT_R = dio_pins[1]
00060
00061 def execute(self, operation):
00062 '''
00063 @see abs_hand_command.AbsractHandCommand.execute
00064 '''
00065 dout = []
00066
00067
00068
00069
00070
00071 mask = []
00072 if self.HAND_TOOLCHANGE_ON == operation:
00073 if self._hands.HAND_L == self._hand:
00074
00075 mask = [self._DIO_VALVE5PORT_L]
00076 elif self._hands.HAND_R == self._hand:
00077 mask = [self._DIO_VALVE5PORT_R]
00078 elif self.HAND_TOOLCHANGE_OFF == operation:
00079 if self._hands.HAND_L == self._hand:
00080
00081
00082 mask.append(self._DIO_VALVE5PORT_L)
00083 dout = [self._DIO_VALVE5PORT_L]
00084 elif self._hands.HAND_R == self._hand:
00085 mask.append(self._DIO_VALVE5PORT_R)
00086 dout = [self._DIO_VALVE5PORT_R]
00087 return self._hands._dio_writer(dout, mask)
00088
00089 def release_ejector(self, hand=None, on=True):
00090 '''
00091 @deprecated: TODO: need to figure out how this can be used. Until
00092 then, set derprecated.
00093 '''
00094 dout = []
00095 mask = []
00096 if on:
00097 if self.HAND_R == hand:
00098
00099
00100 dout = mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2]
00101 elif self.HAND_L == hand:
00102 dout = mask = [self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00103 elif not hand:
00104 dout = mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2,
00105 self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00106 else:
00107 if self.HAND_R == hand:
00108 mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2]
00109 elif self.HAND_L == hand:
00110 mask = [self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00111 elif not hand:
00112 mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2,
00113 self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00114 return self._hands._dio_writer(dout, mask)