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 nextage_ros_bridge.base_hands import BaseHands
00038 from nextage_ros_bridge.command.toolchanger_command import ToolchangerCommand
00039 from nextage_ros_bridge.command.handlight_command import HandlightCommand
00040
00041
00042 class BaseToolchangerHands(BaseHands):
00043 '''
00044 This class holds methods that are specific to the hands of NEXTAGE OPEN,
00045 accompanied with toolchanger.
00046
00047 @deprecated: Since version 0.5.1, the functionality in this class is moved
00048 to other BaseHands subclasses (e.g. Iros13Hands).
00049 '''
00050
00051
00052 def __init__(self, parent):
00053 '''
00054 Since this class operates requires an access to
00055 hrpsys.hrpsys_config.HrpsysConfigurator, valid 'parent' is a must.
00056 Otherwise __init__ returns without doing anything.
00057
00058 @type parent: hrpsys.hrpsys_config.HrpsysConfigurator
00059 @param parent: derived class of HrpsysConfigurator.
00060 '''
00061 super(BaseToolchangerHands, self).__init__(parent)
00062 if not parent:
00063 return
00064 self._parent = parent
00065
00066 self.handlight_l_command = HandlightCommand(self, self.HAND_L)
00067 self.handlight_r_command = HandlightCommand(self, self.HAND_R)
00068 self.toolchanger_l_command = ToolchangerCommand(self, self.HAND_L)
00069 self.toolchanger_r_command = ToolchangerCommand(self, self.HAND_R)
00070
00071 def turn_handlight(self, hand=None, on=True):
00072 '''
00073 @param hand: Both hands if None.
00074 @type on: bool
00075 @param on: Despite its type, it's handled as str in this method.
00076 @rtype: bool
00077 @return: True if the lights turned. False otherwise.
00078 '''
00079 _result = True
00080 if self.HAND_L == hand:
00081 _result = self.handlight_l_command.execute(on)
00082 elif self.HAND_R == hand:
00083 _result = self.handlight_r_command.execute(on)
00084 elif not hand:
00085 _result = self.handlight_l_command.execute(on) and _result
00086 _result = self.handlight_r_command.execute(on) and _result
00087 return _result