$search
00001 """autogenerated by genmsg_py from RIQHandState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import riq_msgs.msg 00006 00007 class RIQHandState(roslib.message.Message): 00008 _md5sum = "3ab70f8c0e9b67b0db99e45af2360afc" 00009 _type = "riq_msgs/RIQHandState" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# ROS state information from RobotIQ hand 00012 00013 # Action status 00014 int8 FAULTED = 0 00015 int8 IN_PROGRESS = 1 00016 int8 ILLEGAL_OR_UNDEFINED = 2 00017 int8 SUCCESSFUL = 3 00018 00019 # Mode constants 00020 int8 CYLINDRICAL = 0 00021 int8 PINCH = 1 00022 int8 SPHERIOD = 2 00023 int8 SCISSORS = 3 00024 00025 # Grip 00026 int8 STOPPED = 0 00027 int8 OPENED = 1 00028 int8 CLOSED = 2 00029 int8 INITIALIZING_OR_CHANGING = 3 00030 00031 # Object detection status 00032 int8 NOT_DETECTED = 0 00033 int8 DETECTED_1_FINGER = 1 00034 int8 DETECTED_2_FINGERS = 2 00035 int8 DETECTED_ALL_FINGERS = 3 00036 00037 00038 bool operational # True when RIQ hand is operational, 00039 # False if there is an error, or hand has not been initialized 00040 00041 int8 status # Result of last requested action 00042 # SUCCESSFULL, FAULTED, IN_PROGRESS, ILLEGAL_OR_UNDEFINED 00043 00044 int8 mode # Mode gripper is curretly in: 00045 # PINCH, CYLINDRICAL, SPHERIOD, SCISSORS 00046 00047 int8 grip # Grip 00048 # CLOSED, OPEN, STOPPED, INTIALIZING_OR_CHANGING 00049 00050 int8 object # Object detection 00051 # NOT_DETECTED, DETECTED_1_FINGER, DETECTED_2_FINGERS, DETECTED_ALL_FINGERS 00052 00053 RIQActuatorState thumb 00054 RIQActuatorState right_finger 00055 RIQActuatorState left_finger 00056 RIQActuatorState scissors # Scissors is joint motor between right and left finger 00057 ================================================================================ 00058 MSG: riq_msgs/RIQActuatorState 00059 # ROS state information for RobotIQ actuator. 00060 00061 # Measured motor current (in Amps) 00062 float64 current 00063 00064 # Motor position range from (0.0 to 1.0) 00065 float64 position 00066 00067 # True when finger / actuator detected an object 00068 bool object_detected 00069 """ 00070 # Pseudo-constants 00071 FAULTED = 0 00072 IN_PROGRESS = 1 00073 ILLEGAL_OR_UNDEFINED = 2 00074 SUCCESSFUL = 3 00075 CYLINDRICAL = 0 00076 PINCH = 1 00077 SPHERIOD = 2 00078 SCISSORS = 3 00079 STOPPED = 0 00080 OPENED = 1 00081 CLOSED = 2 00082 INITIALIZING_OR_CHANGING = 3 00083 NOT_DETECTED = 0 00084 DETECTED_1_FINGER = 1 00085 DETECTED_2_FINGERS = 2 00086 DETECTED_ALL_FINGERS = 3 00087 00088 __slots__ = ['operational','status','mode','grip','object','thumb','right_finger','left_finger','scissors'] 00089 _slot_types = ['bool','int8','int8','int8','int8','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState'] 00090 00091 def __init__(self, *args, **kwds): 00092 """ 00093 Constructor. Any message fields that are implicitly/explicitly 00094 set to None will be assigned a default value. The recommend 00095 use is keyword arguments as this is more robust to future message 00096 changes. You cannot mix in-order arguments and keyword arguments. 00097 00098 The available fields are: 00099 operational,status,mode,grip,object,thumb,right_finger,left_finger,scissors 00100 00101 @param args: complete set of field values, in .msg order 00102 @param kwds: use keyword arguments corresponding to message field names 00103 to set specific fields. 00104 """ 00105 if args or kwds: 00106 super(RIQHandState, self).__init__(*args, **kwds) 00107 #message fields cannot be None, assign default values for those that are 00108 if self.operational is None: 00109 self.operational = False 00110 if self.status is None: 00111 self.status = 0 00112 if self.mode is None: 00113 self.mode = 0 00114 if self.grip is None: 00115 self.grip = 0 00116 if self.object is None: 00117 self.object = 0 00118 if self.thumb is None: 00119 self.thumb = riq_msgs.msg.RIQActuatorState() 00120 if self.right_finger is None: 00121 self.right_finger = riq_msgs.msg.RIQActuatorState() 00122 if self.left_finger is None: 00123 self.left_finger = riq_msgs.msg.RIQActuatorState() 00124 if self.scissors is None: 00125 self.scissors = riq_msgs.msg.RIQActuatorState() 00126 else: 00127 self.operational = False 00128 self.status = 0 00129 self.mode = 0 00130 self.grip = 0 00131 self.object = 0 00132 self.thumb = riq_msgs.msg.RIQActuatorState() 00133 self.right_finger = riq_msgs.msg.RIQActuatorState() 00134 self.left_finger = riq_msgs.msg.RIQActuatorState() 00135 self.scissors = riq_msgs.msg.RIQActuatorState() 00136 00137 def _get_types(self): 00138 """ 00139 internal API method 00140 """ 00141 return self._slot_types 00142 00143 def serialize(self, buff): 00144 """ 00145 serialize message into buffer 00146 @param buff: buffer 00147 @type buff: StringIO 00148 """ 00149 try: 00150 _x = self 00151 buff.write(_struct_B4b2dB2dB2dB2dB.pack(_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected)) 00152 except struct.error as se: self._check_types(se) 00153 except TypeError as te: self._check_types(te) 00154 00155 def deserialize(self, str): 00156 """ 00157 unpack serialized message in str into this message instance 00158 @param str: byte array of serialized message 00159 @type str: str 00160 """ 00161 try: 00162 if self.thumb is None: 00163 self.thumb = riq_msgs.msg.RIQActuatorState() 00164 if self.right_finger is None: 00165 self.right_finger = riq_msgs.msg.RIQActuatorState() 00166 if self.left_finger is None: 00167 self.left_finger = riq_msgs.msg.RIQActuatorState() 00168 if self.scissors is None: 00169 self.scissors = riq_msgs.msg.RIQActuatorState() 00170 end = 0 00171 _x = self 00172 start = end 00173 end += 73 00174 (_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected,) = _struct_B4b2dB2dB2dB2dB.unpack(str[start:end]) 00175 self.operational = bool(self.operational) 00176 self.thumb.object_detected = bool(self.thumb.object_detected) 00177 self.right_finger.object_detected = bool(self.right_finger.object_detected) 00178 self.left_finger.object_detected = bool(self.left_finger.object_detected) 00179 self.scissors.object_detected = bool(self.scissors.object_detected) 00180 return self 00181 except struct.error as e: 00182 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00183 00184 00185 def serialize_numpy(self, buff, numpy): 00186 """ 00187 serialize message with numpy array types into buffer 00188 @param buff: buffer 00189 @type buff: StringIO 00190 @param numpy: numpy python module 00191 @type numpy module 00192 """ 00193 try: 00194 _x = self 00195 buff.write(_struct_B4b2dB2dB2dB2dB.pack(_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected)) 00196 except struct.error as se: self._check_types(se) 00197 except TypeError as te: self._check_types(te) 00198 00199 def deserialize_numpy(self, str, numpy): 00200 """ 00201 unpack serialized message in str into this message instance using numpy for array types 00202 @param str: byte array of serialized message 00203 @type str: str 00204 @param numpy: numpy python module 00205 @type numpy: module 00206 """ 00207 try: 00208 if self.thumb is None: 00209 self.thumb = riq_msgs.msg.RIQActuatorState() 00210 if self.right_finger is None: 00211 self.right_finger = riq_msgs.msg.RIQActuatorState() 00212 if self.left_finger is None: 00213 self.left_finger = riq_msgs.msg.RIQActuatorState() 00214 if self.scissors is None: 00215 self.scissors = riq_msgs.msg.RIQActuatorState() 00216 end = 0 00217 _x = self 00218 start = end 00219 end += 73 00220 (_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected,) = _struct_B4b2dB2dB2dB2dB.unpack(str[start:end]) 00221 self.operational = bool(self.operational) 00222 self.thumb.object_detected = bool(self.thumb.object_detected) 00223 self.right_finger.object_detected = bool(self.right_finger.object_detected) 00224 self.left_finger.object_detected = bool(self.left_finger.object_detected) 00225 self.scissors.object_detected = bool(self.scissors.object_detected) 00226 return self 00227 except struct.error as e: 00228 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00229 00230 _struct_I = roslib.message.struct_I 00231 _struct_B4b2dB2dB2dB2dB = struct.Struct("<B4b2dB2dB2dB2dB")