base_toolchanger_hands.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Software License Agreement (BSD License)
4 #
5 # Copyright (c) 2013, 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.toolchanger_command import ToolchangerCommand
39 from nextage_ros_bridge.command.handlight_command import HandlightCommand
40 
41 
43  '''
44  This class holds methods that are specific to the hands of NEXTAGE OPEN,
45  accompanied with toolchanger.
46 
47  @deprecated: Since version 0.5.1, the functionality in this class is moved
48  to other BaseHands subclasses (e.g. Iros13Hands).
49  '''
50  # TODO: Unittest is needed!!
51 
52  def __init__(self, parent):
53  '''
54  Since this class operates requires an access to
55  hrpsys.hrpsys_config.HrpsysConfigurator, valid 'parent' is a must.
56  Otherwise __init__ returns without doing anything.
57 
58  @type parent: hrpsys.hrpsys_config.HrpsysConfigurator
59  @param parent: derived class of HrpsysConfigurator.
60  '''
61  super(BaseToolchangerHands, self).__init__(parent)
62  if not parent:
63  return # TODO: Replace with throwing exception
64  self._parent = parent
65 
70 
71  def turn_handlight(self, hand=None, on=True):
72  '''
73  @param hand: Both hands if None.
74  @type on: bool
75  @param on: Despite its type, it's handled as str in this method.
76  @rtype: bool
77  @return: True if the lights turned. False otherwise.
78  '''
79  _result = True
80  if self.HAND_L == hand:
81  _result = self.handlight_l_command.execute(on)
82  elif self.HAND_R == hand:
83  _result = self.handlight_r_command.execute(on)
84  elif not hand: # both hands
85  _result = self.handlight_l_command.execute(on) and _result
86  _result = self.handlight_r_command.execute(on) and _result
87  return _result


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