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


srs_assisted_grasping_msgs
Author(s): Zdenek Materna
autogenerated on Mon Oct 6 2014 07:57:12