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


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