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):
00052 super(ToolchangerCommand, self).__init__(hands, hand)
00053
00054 def _assign_dio_names(self):
00055 '''
00056 @see abs_hand_command.AbsractHandCommand._assign_dio_names
00057 '''
00058 self._DIO_VALVE5PORT_R = self._DIO_19
00059 self._DIO_VALVE_R_1 = self._DIO_20
00060 self._DIO_VALVE_R_2 = self._DIO_21
00061 self._DIO_VALVE5PORT_L = self._DIO_24
00062 self._DIO_VALVE_L_1 = self._DIO_25
00063 self._DIO_VALVE_L_2 = self._DIO_26
00064
00065 def execute(self, operation):
00066 '''
00067 @see abs_hand_command.AbsractHandCommand.execute
00068 '''
00069 dout = []
00070
00071
00072
00073
00074
00075 mask = [self._DIO_VALVE_L_1, self._DIO_VALVE_L_2]
00076 if self.HAND_TOOLCHANGE_ON == operation:
00077 if self._hands.HAND_L == self._hand:
00078
00079 mask = [self._DIO_VALVE5PORT_L]
00080 elif self._hands.HAND_R == self._hand:
00081 mask = [self._DIO_VALVE5PORT_R]
00082 elif self.HAND_TOOLCHANGE_OFF == operation:
00083 if self._hands.HAND_L == self._hand:
00084
00085
00086 mask.append(self._DIO_VALVE5PORT_L)
00087 dout = [self._DIO_VALVE5PORT_L]
00088 elif self._hands.HAND_R == self._hand:
00089 mask.append(self._DIO_VALVE5PORT_R)
00090 dout = [self._DIO_VALVE5PORT_R]
00091 self._hands._dio_writer(dout, mask)
00092
00093 def release_ejector(self, hand=None, on=True):
00094 '''
00095 @deprecated: TODO: need to figure out how this can be used. Until
00096 then, set derprecated.
00097 '''
00098 dout = []
00099 mask = []
00100 if on:
00101 if self.HAND_R == hand:
00102
00103
00104 dout = mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2]
00105 elif self.HAND_L == hand:
00106 dout = mask = [self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00107 elif not hand:
00108 dout = mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2,
00109 self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00110 else:
00111 if self.HAND_R == hand:
00112 mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2]
00113 elif self.HAND_L == hand:
00114 mask = [self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00115 elif not hand:
00116 mask = [self._DIO_EJECTOR_R_1, self._DIO_EJECTOR_R_2,
00117 self._DIO_EJECTOR_L_1, self._DIO_EJECTOR_L_2]
00118 self._hands._dio_writer(dout, mask)