_RawData.py
Go to the documentation of this file.
00001 """autogenerated by genpy from applanix_msgs/RawData.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 applanix_msgs.msg
00008 
00009 class RawData(genpy.Message):
00010   _md5sum = "4422a864e3d230d8a0aeaca79366f060"
00011   _type = "applanix_msgs/RawData"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Groups 23, 24, 10001, 10007, 10008, 10011, 10012
00014 TimeDistance td
00015 
00016 uint16 receiver_type
00017 uint32 reserved
00018 
00019 uint8[] message
00020 
00021 ================================================================================
00022 MSG: applanix_msgs/TimeDistance
00023 float64 time1
00024 float64 time2
00025 float64 distance
00026 uint8 time_types
00027 uint8 distance_type
00028 
00029 """
00030   __slots__ = ['td','receiver_type','reserved','message']
00031   _slot_types = ['applanix_msgs/TimeDistance','uint16','uint32','uint8[]']
00032 
00033   def __init__(self, *args, **kwds):
00034     """
00035     Constructor. Any message fields that are implicitly/explicitly
00036     set to None will be assigned a default value. The recommend
00037     use is keyword arguments as this is more robust to future message
00038     changes.  You cannot mix in-order arguments and keyword arguments.
00039 
00040     The available fields are:
00041        td,receiver_type,reserved,message
00042 
00043     :param args: complete set of field values, in .msg order
00044     :param kwds: use keyword arguments corresponding to message field names
00045     to set specific fields.
00046     """
00047     if args or kwds:
00048       super(RawData, self).__init__(*args, **kwds)
00049       #message fields cannot be None, assign default values for those that are
00050       if self.td is None:
00051         self.td = applanix_msgs.msg.TimeDistance()
00052       if self.receiver_type is None:
00053         self.receiver_type = 0
00054       if self.reserved is None:
00055         self.reserved = 0
00056       if self.message is None:
00057         self.message = ''
00058     else:
00059       self.td = applanix_msgs.msg.TimeDistance()
00060       self.receiver_type = 0
00061       self.reserved = 0
00062       self.message = ''
00063 
00064   def _get_types(self):
00065     """
00066     internal API method
00067     """
00068     return self._slot_types
00069 
00070   def serialize(self, buff):
00071     """
00072     serialize message into buffer
00073     :param buff: buffer, ``StringIO``
00074     """
00075     try:
00076       _x = self
00077       buff.write(_struct_3d2BHI.pack(_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type, _x.receiver_type, _x.reserved))
00078       _x = self.message
00079       length = len(_x)
00080       # - if encoded as a list instead, serialize as bytes instead of string
00081       if type(_x) in [list, tuple]:
00082         buff.write(struct.pack('<I%sB'%length, length, *_x))
00083       else:
00084         buff.write(struct.pack('<I%ss'%length, length, _x))
00085     except struct.error as se: self._check_types(se)
00086     except TypeError as te: self._check_types(te)
00087 
00088   def deserialize(self, str):
00089     """
00090     unpack serialized message in str into this message instance
00091     :param str: byte array of serialized message, ``str``
00092     """
00093     try:
00094       if self.td is None:
00095         self.td = applanix_msgs.msg.TimeDistance()
00096       end = 0
00097       _x = self
00098       start = end
00099       end += 32
00100       (_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type, _x.receiver_type, _x.reserved,) = _struct_3d2BHI.unpack(str[start:end])
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       start = end
00105       end += length
00106       if python3:
00107         self.message = str[start:end].decode('utf-8')
00108       else:
00109         self.message = str[start:end]
00110       return self
00111     except struct.error as e:
00112       raise genpy.DeserializationError(e) #most likely buffer underfill
00113 
00114 
00115   def serialize_numpy(self, buff, numpy):
00116     """
00117     serialize message with numpy array types into buffer
00118     :param buff: buffer, ``StringIO``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       _x = self
00123       buff.write(_struct_3d2BHI.pack(_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type, _x.receiver_type, _x.reserved))
00124       _x = self.message
00125       length = len(_x)
00126       # - if encoded as a list instead, serialize as bytes instead of string
00127       if type(_x) in [list, tuple]:
00128         buff.write(struct.pack('<I%sB'%length, length, *_x))
00129       else:
00130         buff.write(struct.pack('<I%ss'%length, length, _x))
00131     except struct.error as se: self._check_types(se)
00132     except TypeError as te: self._check_types(te)
00133 
00134   def deserialize_numpy(self, str, numpy):
00135     """
00136     unpack serialized message in str into this message instance using numpy for array types
00137     :param str: byte array of serialized message, ``str``
00138     :param numpy: numpy python module
00139     """
00140     try:
00141       if self.td is None:
00142         self.td = applanix_msgs.msg.TimeDistance()
00143       end = 0
00144       _x = self
00145       start = end
00146       end += 32
00147       (_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type, _x.receiver_type, _x.reserved,) = _struct_3d2BHI.unpack(str[start:end])
00148       start = end
00149       end += 4
00150       (length,) = _struct_I.unpack(str[start:end])
00151       start = end
00152       end += length
00153       if python3:
00154         self.message = str[start:end].decode('utf-8')
00155       else:
00156         self.message = str[start:end]
00157       return self
00158     except struct.error as e:
00159       raise genpy.DeserializationError(e) #most likely buffer underfill
00160 
00161 _struct_I = genpy.struct_I
00162 _struct_3d2BHI = struct.Struct("<3d2BHI")


applanix_msgs
Author(s): Mike Purvis
autogenerated on Thu Jan 2 2014 11:04:51