$search
00001 """autogenerated by genmsg_py from ReactiveGraspingResult.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class ReactiveGraspingResult(roslib.message.Message): 00008 _md5sum = "f230ec55570635c19c49d69cf7ccb233" 00009 _type = "srs_assisted_grasping_msgs/ReactiveGraspingResult" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ====== 00012 # RESULT 00013 std_msgs/Float32MultiArray actual_joint_values # n 00014 std_msgs/Int16MultiArray actual_forces # m 00015 std_msgs/Float32MultiArray time_to_stop # n 00016 00017 ================================================================================ 00018 MSG: std_msgs/Float32MultiArray 00019 # Please look at the MultiArrayLayout message definition for 00020 # documentation on all multiarrays. 00021 00022 MultiArrayLayout layout # specification of data layout 00023 float32[] data # array of data 00024 00025 00026 ================================================================================ 00027 MSG: std_msgs/MultiArrayLayout 00028 # The multiarray declares a generic multi-dimensional array of a 00029 # particular data type. Dimensions are ordered from outer most 00030 # to inner most. 00031 00032 MultiArrayDimension[] dim # Array of dimension properties 00033 uint32 data_offset # padding bytes at front of data 00034 00035 # Accessors should ALWAYS be written in terms of dimension stride 00036 # and specified outer-most dimension first. 00037 # 00038 # multiarray(i,j,k) = data[data_offset + dim_stride[1]*i + dim_stride[2]*j + k] 00039 # 00040 # A standard, 3-channel 640x480 image with interleaved color channels 00041 # would be specified as: 00042 # 00043 # dim[0].label = "height" 00044 # dim[0].size = 480 00045 # dim[0].stride = 3*640*480 = 921600 (note dim[0] stride is just size of image) 00046 # dim[1].label = "width" 00047 # dim[1].size = 640 00048 # dim[1].stride = 3*640 = 1920 00049 # dim[2].label = "channel" 00050 # dim[2].size = 3 00051 # dim[2].stride = 3 00052 # 00053 # multiarray(i,j,k) refers to the ith row, jth column, and kth channel. 00054 ================================================================================ 00055 MSG: std_msgs/MultiArrayDimension 00056 string label # label of given dimension 00057 uint32 size # size of given dimension (in type units) 00058 uint32 stride # stride of given dimension 00059 ================================================================================ 00060 MSG: std_msgs/Int16MultiArray 00061 # Please look at the MultiArrayLayout message definition for 00062 # documentation on all multiarrays. 00063 00064 MultiArrayLayout layout # specification of data layout 00065 int16[] data # array of data 00066 00067 00068 """ 00069 __slots__ = ['actual_joint_values','actual_forces','time_to_stop'] 00070 _slot_types = ['std_msgs/Float32MultiArray','std_msgs/Int16MultiArray','std_msgs/Float32MultiArray'] 00071 00072 def __init__(self, *args, **kwds): 00073 """ 00074 Constructor. Any message fields that are implicitly/explicitly 00075 set to None will be assigned a default value. The recommend 00076 use is keyword arguments as this is more robust to future message 00077 changes. You cannot mix in-order arguments and keyword arguments. 00078 00079 The available fields are: 00080 actual_joint_values,actual_forces,time_to_stop 00081 00082 @param args: complete set of field values, in .msg order 00083 @param kwds: use keyword arguments corresponding to message field names 00084 to set specific fields. 00085 """ 00086 if args or kwds: 00087 super(ReactiveGraspingResult, self).__init__(*args, **kwds) 00088 #message fields cannot be None, assign default values for those that are 00089 if self.actual_joint_values is None: 00090 self.actual_joint_values = std_msgs.msg.Float32MultiArray() 00091 if self.actual_forces is None: 00092 self.actual_forces = std_msgs.msg.Int16MultiArray() 00093 if self.time_to_stop is None: 00094 self.time_to_stop = std_msgs.msg.Float32MultiArray() 00095 else: 00096 self.actual_joint_values = std_msgs.msg.Float32MultiArray() 00097 self.actual_forces = std_msgs.msg.Int16MultiArray() 00098 self.time_to_stop = std_msgs.msg.Float32MultiArray() 00099 00100 def _get_types(self): 00101 """ 00102 internal API method 00103 """ 00104 return self._slot_types 00105 00106 def serialize(self, buff): 00107 """ 00108 serialize message into buffer 00109 @param buff: buffer 00110 @type buff: StringIO 00111 """ 00112 try: 00113 length = len(self.actual_joint_values.layout.dim) 00114 buff.write(_struct_I.pack(length)) 00115 for val1 in self.actual_joint_values.layout.dim: 00116 _x = val1.label 00117 length = len(_x) 00118 buff.write(struct.pack('<I%ss'%length, length, _x)) 00119 _x = val1 00120 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00121 buff.write(_struct_I.pack(self.actual_joint_values.layout.data_offset)) 00122 length = len(self.actual_joint_values.data) 00123 buff.write(_struct_I.pack(length)) 00124 pattern = '<%sf'%length 00125 buff.write(struct.pack(pattern, *self.actual_joint_values.data)) 00126 length = len(self.actual_forces.layout.dim) 00127 buff.write(_struct_I.pack(length)) 00128 for val1 in self.actual_forces.layout.dim: 00129 _x = val1.label 00130 length = len(_x) 00131 buff.write(struct.pack('<I%ss'%length, length, _x)) 00132 _x = val1 00133 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00134 buff.write(_struct_I.pack(self.actual_forces.layout.data_offset)) 00135 length = len(self.actual_forces.data) 00136 buff.write(_struct_I.pack(length)) 00137 pattern = '<%sh'%length 00138 buff.write(struct.pack(pattern, *self.actual_forces.data)) 00139 length = len(self.time_to_stop.layout.dim) 00140 buff.write(_struct_I.pack(length)) 00141 for val1 in self.time_to_stop.layout.dim: 00142 _x = val1.label 00143 length = len(_x) 00144 buff.write(struct.pack('<I%ss'%length, length, _x)) 00145 _x = val1 00146 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00147 buff.write(_struct_I.pack(self.time_to_stop.layout.data_offset)) 00148 length = len(self.time_to_stop.data) 00149 buff.write(_struct_I.pack(length)) 00150 pattern = '<%sf'%length 00151 buff.write(struct.pack(pattern, *self.time_to_stop.data)) 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.actual_joint_values is None: 00163 self.actual_joint_values = std_msgs.msg.Float32MultiArray() 00164 if self.actual_forces is None: 00165 self.actual_forces = std_msgs.msg.Int16MultiArray() 00166 if self.time_to_stop is None: 00167 self.time_to_stop = std_msgs.msg.Float32MultiArray() 00168 end = 0 00169 start = end 00170 end += 4 00171 (length,) = _struct_I.unpack(str[start:end]) 00172 self.actual_joint_values.layout.dim = [] 00173 for i in range(0, length): 00174 val1 = std_msgs.msg.MultiArrayDimension() 00175 start = end 00176 end += 4 00177 (length,) = _struct_I.unpack(str[start:end]) 00178 start = end 00179 end += length 00180 val1.label = str[start:end] 00181 _x = val1 00182 start = end 00183 end += 8 00184 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00185 self.actual_joint_values.layout.dim.append(val1) 00186 start = end 00187 end += 4 00188 (self.actual_joint_values.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00189 start = end 00190 end += 4 00191 (length,) = _struct_I.unpack(str[start:end]) 00192 pattern = '<%sf'%length 00193 start = end 00194 end += struct.calcsize(pattern) 00195 self.actual_joint_values.data = struct.unpack(pattern, str[start:end]) 00196 start = end 00197 end += 4 00198 (length,) = _struct_I.unpack(str[start:end]) 00199 self.actual_forces.layout.dim = [] 00200 for i in range(0, length): 00201 val1 = std_msgs.msg.MultiArrayDimension() 00202 start = end 00203 end += 4 00204 (length,) = _struct_I.unpack(str[start:end]) 00205 start = end 00206 end += length 00207 val1.label = str[start:end] 00208 _x = val1 00209 start = end 00210 end += 8 00211 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00212 self.actual_forces.layout.dim.append(val1) 00213 start = end 00214 end += 4 00215 (self.actual_forces.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00216 start = end 00217 end += 4 00218 (length,) = _struct_I.unpack(str[start:end]) 00219 pattern = '<%sh'%length 00220 start = end 00221 end += struct.calcsize(pattern) 00222 self.actual_forces.data = struct.unpack(pattern, str[start:end]) 00223 start = end 00224 end += 4 00225 (length,) = _struct_I.unpack(str[start:end]) 00226 self.time_to_stop.layout.dim = [] 00227 for i in range(0, length): 00228 val1 = std_msgs.msg.MultiArrayDimension() 00229 start = end 00230 end += 4 00231 (length,) = _struct_I.unpack(str[start:end]) 00232 start = end 00233 end += length 00234 val1.label = str[start:end] 00235 _x = val1 00236 start = end 00237 end += 8 00238 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00239 self.time_to_stop.layout.dim.append(val1) 00240 start = end 00241 end += 4 00242 (self.time_to_stop.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00243 start = end 00244 end += 4 00245 (length,) = _struct_I.unpack(str[start:end]) 00246 pattern = '<%sf'%length 00247 start = end 00248 end += struct.calcsize(pattern) 00249 self.time_to_stop.data = struct.unpack(pattern, str[start:end]) 00250 return self 00251 except struct.error as e: 00252 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00253 00254 00255 def serialize_numpy(self, buff, numpy): 00256 """ 00257 serialize message with numpy array types into buffer 00258 @param buff: buffer 00259 @type buff: StringIO 00260 @param numpy: numpy python module 00261 @type numpy module 00262 """ 00263 try: 00264 length = len(self.actual_joint_values.layout.dim) 00265 buff.write(_struct_I.pack(length)) 00266 for val1 in self.actual_joint_values.layout.dim: 00267 _x = val1.label 00268 length = len(_x) 00269 buff.write(struct.pack('<I%ss'%length, length, _x)) 00270 _x = val1 00271 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00272 buff.write(_struct_I.pack(self.actual_joint_values.layout.data_offset)) 00273 length = len(self.actual_joint_values.data) 00274 buff.write(_struct_I.pack(length)) 00275 pattern = '<%sf'%length 00276 buff.write(self.actual_joint_values.data.tostring()) 00277 length = len(self.actual_forces.layout.dim) 00278 buff.write(_struct_I.pack(length)) 00279 for val1 in self.actual_forces.layout.dim: 00280 _x = val1.label 00281 length = len(_x) 00282 buff.write(struct.pack('<I%ss'%length, length, _x)) 00283 _x = val1 00284 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00285 buff.write(_struct_I.pack(self.actual_forces.layout.data_offset)) 00286 length = len(self.actual_forces.data) 00287 buff.write(_struct_I.pack(length)) 00288 pattern = '<%sh'%length 00289 buff.write(self.actual_forces.data.tostring()) 00290 length = len(self.time_to_stop.layout.dim) 00291 buff.write(_struct_I.pack(length)) 00292 for val1 in self.time_to_stop.layout.dim: 00293 _x = val1.label 00294 length = len(_x) 00295 buff.write(struct.pack('<I%ss'%length, length, _x)) 00296 _x = val1 00297 buff.write(_struct_2I.pack(_x.size, _x.stride)) 00298 buff.write(_struct_I.pack(self.time_to_stop.layout.data_offset)) 00299 length = len(self.time_to_stop.data) 00300 buff.write(_struct_I.pack(length)) 00301 pattern = '<%sf'%length 00302 buff.write(self.time_to_stop.data.tostring()) 00303 except struct.error as se: self._check_types(se) 00304 except TypeError as te: self._check_types(te) 00305 00306 def deserialize_numpy(self, str, numpy): 00307 """ 00308 unpack serialized message in str into this message instance using numpy for array types 00309 @param str: byte array of serialized message 00310 @type str: str 00311 @param numpy: numpy python module 00312 @type numpy: module 00313 """ 00314 try: 00315 if self.actual_joint_values is None: 00316 self.actual_joint_values = std_msgs.msg.Float32MultiArray() 00317 if self.actual_forces is None: 00318 self.actual_forces = std_msgs.msg.Int16MultiArray() 00319 if self.time_to_stop is None: 00320 self.time_to_stop = std_msgs.msg.Float32MultiArray() 00321 end = 0 00322 start = end 00323 end += 4 00324 (length,) = _struct_I.unpack(str[start:end]) 00325 self.actual_joint_values.layout.dim = [] 00326 for i in range(0, length): 00327 val1 = std_msgs.msg.MultiArrayDimension() 00328 start = end 00329 end += 4 00330 (length,) = _struct_I.unpack(str[start:end]) 00331 start = end 00332 end += length 00333 val1.label = str[start:end] 00334 _x = val1 00335 start = end 00336 end += 8 00337 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00338 self.actual_joint_values.layout.dim.append(val1) 00339 start = end 00340 end += 4 00341 (self.actual_joint_values.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00342 start = end 00343 end += 4 00344 (length,) = _struct_I.unpack(str[start:end]) 00345 pattern = '<%sf'%length 00346 start = end 00347 end += struct.calcsize(pattern) 00348 self.actual_joint_values.data = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00349 start = end 00350 end += 4 00351 (length,) = _struct_I.unpack(str[start:end]) 00352 self.actual_forces.layout.dim = [] 00353 for i in range(0, length): 00354 val1 = std_msgs.msg.MultiArrayDimension() 00355 start = end 00356 end += 4 00357 (length,) = _struct_I.unpack(str[start:end]) 00358 start = end 00359 end += length 00360 val1.label = str[start:end] 00361 _x = val1 00362 start = end 00363 end += 8 00364 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00365 self.actual_forces.layout.dim.append(val1) 00366 start = end 00367 end += 4 00368 (self.actual_forces.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00369 start = end 00370 end += 4 00371 (length,) = _struct_I.unpack(str[start:end]) 00372 pattern = '<%sh'%length 00373 start = end 00374 end += struct.calcsize(pattern) 00375 self.actual_forces.data = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00376 start = end 00377 end += 4 00378 (length,) = _struct_I.unpack(str[start:end]) 00379 self.time_to_stop.layout.dim = [] 00380 for i in range(0, length): 00381 val1 = std_msgs.msg.MultiArrayDimension() 00382 start = end 00383 end += 4 00384 (length,) = _struct_I.unpack(str[start:end]) 00385 start = end 00386 end += length 00387 val1.label = str[start:end] 00388 _x = val1 00389 start = end 00390 end += 8 00391 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end]) 00392 self.time_to_stop.layout.dim.append(val1) 00393 start = end 00394 end += 4 00395 (self.time_to_stop.layout.data_offset,) = _struct_I.unpack(str[start:end]) 00396 start = end 00397 end += 4 00398 (length,) = _struct_I.unpack(str[start:end]) 00399 pattern = '<%sf'%length 00400 start = end 00401 end += struct.calcsize(pattern) 00402 self.time_to_stop.data = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00403 return self 00404 except struct.error as e: 00405 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00406 00407 _struct_I = roslib.message.struct_I 00408 _struct_2I = struct.Struct("<2I")