_PressureInfoElement.py
Go to the documentation of this file.
00001 """autogenerated by genpy from fingertip_pressure/PressureInfoElement.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 geometry_msgs.msg
00008 
00009 class PressureInfoElement(genpy.Message):
00010   _md5sum = "1cb486bb542ab85e1ff8d84fe9cc899f"
00011   _type = "fingertip_pressure/PressureInfoElement"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """string frame_id # Frame ID
00014 geometry_msgs/Vector3[] center # Corner of sensor (meters)
00015 geometry_msgs/Vector3[] halfside1 # Half of one edge of sensor (meters)
00016 geometry_msgs/Vector3[] halfside2 # Half of perpendicular edge of sensor (meters)
00017 # Sensor corners are at center+-halfside1+-halfside2
00018 # Cross product of halfside1 and halfside2 points out
00019 float64[] force_per_unit # Multiply this by the raw sensor value to get a force
00020 
00021 ================================================================================
00022 MSG: geometry_msgs/Vector3
00023 # This represents a vector in free space. 
00024 
00025 float64 x
00026 float64 y
00027 float64 z
00028 """
00029   __slots__ = ['frame_id','center','halfside1','halfside2','force_per_unit']
00030   _slot_types = ['string','geometry_msgs/Vector3[]','geometry_msgs/Vector3[]','geometry_msgs/Vector3[]','float64[]']
00031 
00032   def __init__(self, *args, **kwds):
00033     """
00034     Constructor. Any message fields that are implicitly/explicitly
00035     set to None will be assigned a default value. The recommend
00036     use is keyword arguments as this is more robust to future message
00037     changes.  You cannot mix in-order arguments and keyword arguments.
00038 
00039     The available fields are:
00040        frame_id,center,halfside1,halfside2,force_per_unit
00041 
00042     :param args: complete set of field values, in .msg order
00043     :param kwds: use keyword arguments corresponding to message field names
00044     to set specific fields.
00045     """
00046     if args or kwds:
00047       super(PressureInfoElement, self).__init__(*args, **kwds)
00048       #message fields cannot be None, assign default values for those that are
00049       if self.frame_id is None:
00050         self.frame_id = ''
00051       if self.center is None:
00052         self.center = []
00053       if self.halfside1 is None:
00054         self.halfside1 = []
00055       if self.halfside2 is None:
00056         self.halfside2 = []
00057       if self.force_per_unit is None:
00058         self.force_per_unit = []
00059     else:
00060       self.frame_id = ''
00061       self.center = []
00062       self.halfside1 = []
00063       self.halfside2 = []
00064       self.force_per_unit = []
00065 
00066   def _get_types(self):
00067     """
00068     internal API method
00069     """
00070     return self._slot_types
00071 
00072   def serialize(self, buff):
00073     """
00074     serialize message into buffer
00075     :param buff: buffer, ``StringIO``
00076     """
00077     try:
00078       _x = self.frame_id
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084       length = len(self.center)
00085       buff.write(_struct_I.pack(length))
00086       for val1 in self.center:
00087         _x = val1
00088         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00089       length = len(self.halfside1)
00090       buff.write(_struct_I.pack(length))
00091       for val1 in self.halfside1:
00092         _x = val1
00093         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00094       length = len(self.halfside2)
00095       buff.write(_struct_I.pack(length))
00096       for val1 in self.halfside2:
00097         _x = val1
00098         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00099       length = len(self.force_per_unit)
00100       buff.write(_struct_I.pack(length))
00101       pattern = '<%sd'%length
00102       buff.write(struct.pack(pattern, *self.force_per_unit))
00103     except struct.error as se: self._check_types(se)
00104     except TypeError as te: self._check_types(te)
00105 
00106   def deserialize(self, str):
00107     """
00108     unpack serialized message in str into this message instance
00109     :param str: byte array of serialized message, ``str``
00110     """
00111     try:
00112       if self.center is None:
00113         self.center = None
00114       if self.halfside1 is None:
00115         self.halfside1 = None
00116       if self.halfside2 is None:
00117         self.halfside2 = None
00118       end = 0
00119       start = end
00120       end += 4
00121       (length,) = _struct_I.unpack(str[start:end])
00122       start = end
00123       end += length
00124       if python3:
00125         self.frame_id = str[start:end].decode('utf-8')
00126       else:
00127         self.frame_id = str[start:end]
00128       start = end
00129       end += 4
00130       (length,) = _struct_I.unpack(str[start:end])
00131       self.center = []
00132       for i in range(0, length):
00133         val1 = geometry_msgs.msg.Vector3()
00134         _x = val1
00135         start = end
00136         end += 24
00137         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00138         self.center.append(val1)
00139       start = end
00140       end += 4
00141       (length,) = _struct_I.unpack(str[start:end])
00142       self.halfside1 = []
00143       for i in range(0, length):
00144         val1 = geometry_msgs.msg.Vector3()
00145         _x = val1
00146         start = end
00147         end += 24
00148         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00149         self.halfside1.append(val1)
00150       start = end
00151       end += 4
00152       (length,) = _struct_I.unpack(str[start:end])
00153       self.halfside2 = []
00154       for i in range(0, length):
00155         val1 = geometry_msgs.msg.Vector3()
00156         _x = val1
00157         start = end
00158         end += 24
00159         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00160         self.halfside2.append(val1)
00161       start = end
00162       end += 4
00163       (length,) = _struct_I.unpack(str[start:end])
00164       pattern = '<%sd'%length
00165       start = end
00166       end += struct.calcsize(pattern)
00167       self.force_per_unit = struct.unpack(pattern, str[start:end])
00168       return self
00169     except struct.error as e:
00170       raise genpy.DeserializationError(e) #most likely buffer underfill
00171 
00172 
00173   def serialize_numpy(self, buff, numpy):
00174     """
00175     serialize message with numpy array types into buffer
00176     :param buff: buffer, ``StringIO``
00177     :param numpy: numpy python module
00178     """
00179     try:
00180       _x = self.frame_id
00181       length = len(_x)
00182       if python3 or type(_x) == unicode:
00183         _x = _x.encode('utf-8')
00184         length = len(_x)
00185       buff.write(struct.pack('<I%ss'%length, length, _x))
00186       length = len(self.center)
00187       buff.write(_struct_I.pack(length))
00188       for val1 in self.center:
00189         _x = val1
00190         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00191       length = len(self.halfside1)
00192       buff.write(_struct_I.pack(length))
00193       for val1 in self.halfside1:
00194         _x = val1
00195         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00196       length = len(self.halfside2)
00197       buff.write(_struct_I.pack(length))
00198       for val1 in self.halfside2:
00199         _x = val1
00200         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00201       length = len(self.force_per_unit)
00202       buff.write(_struct_I.pack(length))
00203       pattern = '<%sd'%length
00204       buff.write(self.force_per_unit.tostring())
00205     except struct.error as se: self._check_types(se)
00206     except TypeError as te: self._check_types(te)
00207 
00208   def deserialize_numpy(self, str, numpy):
00209     """
00210     unpack serialized message in str into this message instance using numpy for array types
00211     :param str: byte array of serialized message, ``str``
00212     :param numpy: numpy python module
00213     """
00214     try:
00215       if self.center is None:
00216         self.center = None
00217       if self.halfside1 is None:
00218         self.halfside1 = None
00219       if self.halfside2 is None:
00220         self.halfside2 = None
00221       end = 0
00222       start = end
00223       end += 4
00224       (length,) = _struct_I.unpack(str[start:end])
00225       start = end
00226       end += length
00227       if python3:
00228         self.frame_id = str[start:end].decode('utf-8')
00229       else:
00230         self.frame_id = str[start:end]
00231       start = end
00232       end += 4
00233       (length,) = _struct_I.unpack(str[start:end])
00234       self.center = []
00235       for i in range(0, length):
00236         val1 = geometry_msgs.msg.Vector3()
00237         _x = val1
00238         start = end
00239         end += 24
00240         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00241         self.center.append(val1)
00242       start = end
00243       end += 4
00244       (length,) = _struct_I.unpack(str[start:end])
00245       self.halfside1 = []
00246       for i in range(0, length):
00247         val1 = geometry_msgs.msg.Vector3()
00248         _x = val1
00249         start = end
00250         end += 24
00251         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00252         self.halfside1.append(val1)
00253       start = end
00254       end += 4
00255       (length,) = _struct_I.unpack(str[start:end])
00256       self.halfside2 = []
00257       for i in range(0, length):
00258         val1 = geometry_msgs.msg.Vector3()
00259         _x = val1
00260         start = end
00261         end += 24
00262         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00263         self.halfside2.append(val1)
00264       start = end
00265       end += 4
00266       (length,) = _struct_I.unpack(str[start:end])
00267       pattern = '<%sd'%length
00268       start = end
00269       end += struct.calcsize(pattern)
00270       self.force_per_unit = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00271       return self
00272     except struct.error as e:
00273       raise genpy.DeserializationError(e) #most likely buffer underfill
00274 
00275 _struct_I = genpy.struct_I
00276 _struct_3d = struct.Struct("<3d")


fingertip_pressure
Author(s): Blaise Gassend/blaise@willowgarage.com
autogenerated on Thu Jan 2 2014 11:39:26