hands_05.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Software License Agreement (BSD License)
4 #
5 # Copyright (c) 2014, Tokyo Opensource Robotics Kyokai Association
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above
15 # copyright notice, this list of conditions and the following
16 # disclaimer in the documentation and/or other materials provided
17 # with the distribution.
18 # * Neither the name of Tokyo Opensource Robotics Kyokai Association. nor the
19 # names of its contributors may be used to endorse or promote products
20 # derived from this software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
34 #
35 # Author: Isaac Isao Saito
36 
37 from nextage_ros_bridge.base_hands import BaseHands
38 from nextage_ros_bridge.command.airhand_command import AbsractHandCommand
39 from nextage_ros_bridge.command.airhand_command import AirhandCommand
40 from nextage_ros_bridge.command.gripper_command import GripperCommand
41 from nextage_ros_bridge.command.handlight_command import HandlightCommand
42 from nextage_ros_bridge.command.toolchanger_command import ToolchangerCommand
43 
44 
46  '''
47  This class holds methods to operate the hands of NEXTAGE OPEN, based on the
48  specification of the robot made by the manufacturer (Kawada)
49  in August 2014 and thereafter.
50 
51  For the robot shipped before then, use Iros13Hands.
52  '''
53 
54  def __init__(self, parent):
55  '''
56  @see: AbsractIros13Hands.__init__
57  '''
58  # Instantiating public command classes.
59  #
60  # There can be at least 2 ways for the Robot client classes
61  # (eg. See nextage_client.NextageClient) to call hand commands.
62  #
63  # (1) Call directly the 'execute' methods of each command.
64  # (2) Call via interface methods in the hand class.
65  #
66  # In this class, (1) is used. (1) is faster to implement. And
67  # I think it's ok for robot client classes to know what commands exist,
68  # without the hand class has the interfaces for commands. But you can
69  # always apply (2) approach, which is cleaner.
70  super(Hands05, self).__init__(parent)
71  _pins_airhand = [self.DIO_27, self.DIO_28, self.DIO_25, self.DIO_26]
72  _pins_gripper = [self.DIO_23, self.DIO_24, self.DIO_21, self.DIO_22]
73  _pins_handlight = [self.DIO_18, self.DIO_17]
74  _pins_toolchanger = [self.DIO_20, self.DIO_27, self.DIO_28, # L-hand
75  self.DIO_19, self.DIO_25, self.DIO_26] # R-hand
76 
77  self._airhand_l_command = AirhandCommand(self, self.HAND_L, _pins_airhand)
78  self._airhand_r_command = AirhandCommand(self, self.HAND_R, _pins_airhand)
79  self._gripper_l_command = GripperCommand(self, self.HAND_L, _pins_gripper)
80  self._gripper_r_command = GripperCommand(self, self.HAND_R, _pins_gripper)
81 
82  # The following lines are moved from BaseToolchangerHands
83  self._handlight_l_command = HandlightCommand(self, self.HAND_L, _pins_handlight)
84  self._handlight_r_command = HandlightCommand(self, self.HAND_R, _pins_handlight)
85  self._toolchanger_l_command = ToolchangerCommand(self, self.HAND_L, _pins_toolchanger)
86  self._toolchanger_r_command = ToolchangerCommand(self, self.HAND_R, _pins_toolchanger)
87 
88  def airhand_l_drawin(self):
89  return self._airhand_l_command.execute(self._airhand_l_command.AIRHAND_DRAWIN)
90 
91  def airhand_r_drawin(self):
92  return self._airhand_r_command.execute(self._airhand_r_command.AIRHAND_DRAWIN)
93 
94  def airhand_l_keep(self):
95  return self._airhand_l_command.execute(self._airhand_l_command.AIRHAND_KEEP)
96 
97  def airhand_r_keep(self):
98  return self._airhand_r_command.execute(self._airhand_r_command.AIRHAND_KEEP)
99 
100  def airhand_l_release(self):
101  return self._airhand_l_command.execute(self._airhand_l_command.AIRHAND_RELEASE)
102 
103  def airhand_r_release(self):
104  return self._airhand_r_command.execute(self._airhand_r_command.AIRHAND_RELEASE)
105 
106  def gripper_l_close(self):
107  return self._gripper_l_command.execute(self._gripper_l_command.GRIPPER_CLOSE)
108 
109  def gripper_r_close(self):
110  return self._gripper_r_command.execute(self._gripper_r_command.GRIPPER_CLOSE)
111 
112  def gripper_l_open(self):
113  return self._gripper_l_command.execute(self._gripper_r_command.GRIPPER_OPEN)
114 
115  def gripper_r_open(self):
116  return self._gripper_r_command.execute(self._gripper_r_command.GRIPPER_OPEN)
117 
118  def handtool_l_eject(self):
119  return self._toolchanger_l_command.execute(
120  self._toolchanger_l_command.HAND_TOOLCHANGE_OFF)
121 
122  def handtool_r_eject(self):
123  return self._toolchanger_r_command.execute(
124  self._toolchanger_r_command.HAND_TOOLCHANGE_OFF)
125 
126  def handtool_l_attach(self):
127  return self._toolchanger_l_command.execute(
128  self._toolchanger_l_command.HAND_TOOLCHANGE_ON)
129 
130  def handtool_r_attach(self):
131  return self._toolchanger_r_command.execute(
132  self._toolchanger_r_command.HAND_TOOLCHANGE_ON)
133 
134  def handlight_r(self, is_on=True):
135  return self._handlight_r_command.turn_handlight(self.HAND_R, is_on)
136 
137  def handlight_l(self, is_on=True):
138  return self._handlight_l_command.turn_handlight(self.HAND_L, is_on)
139 
140  def handlight_both(self, is_on=True):
141  result = self._handlight_l_command.turn_handlight(self.HAND_L, is_on)
142  result = self._handlight_r_command.turn_handlight(self.HAND_R, is_on) and result
143  return result
def handlight_l(self, is_on=True)
Definition: hands_05.py:137
def handlight_r(self, is_on=True)
Definition: hands_05.py:134
def handlight_both(self, is_on=True)
Definition: hands_05.py:140


nextage_ros_bridge
Author(s): Isaac Isao Saito , Akio Ochiai
autogenerated on Wed Jun 17 2020 04:14:47