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


srs_msgs
Author(s): renxi
autogenerated on Sun Jan 5 2014 12:00:23