_VelodynePacket.py
Go to the documentation of this file.
00001 """autogenerated by genpy from velodyne_msgs/VelodynePacket.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 
00009 class VelodynePacket(genpy.Message):
00010   _md5sum = "ae4f90a23256f44e82baa08dd45c3456"
00011   _type = "velodyne_msgs/VelodynePacket"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Raw Velodyne LIDAR packet.
00014 
00015 time stamp              # packet timestamp
00016 uint8[1206] data        # packet contents
00017 
00018 
00019 """
00020   __slots__ = ['stamp','data']
00021   _slot_types = ['time','uint8[1206]']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        stamp,data
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(VelodynePacket, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.stamp is None:
00041         self.stamp = genpy.Time()
00042       if self.data is None:
00043         self.data = chr(0)*1206
00044     else:
00045       self.stamp = genpy.Time()
00046       self.data = chr(0)*1206
00047 
00048   def _get_types(self):
00049     """
00050     internal API method
00051     """
00052     return self._slot_types
00053 
00054   def serialize(self, buff):
00055     """
00056     serialize message into buffer
00057     :param buff: buffer, ``StringIO``
00058     """
00059     try:
00060       _x = self
00061       buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
00062       _x = self.data
00063       # - if encoded as a list instead, serialize as bytes instead of string
00064       if type(_x) in [list, tuple]:
00065         buff.write(_struct_1206B.pack(*_x))
00066       else:
00067         buff.write(_struct_1206s.pack(_x))
00068     except struct.error as se: self._check_types(se)
00069     except TypeError as te: self._check_types(te)
00070 
00071   def deserialize(self, str):
00072     """
00073     unpack serialized message in str into this message instance
00074     :param str: byte array of serialized message, ``str``
00075     """
00076     try:
00077       if self.stamp is None:
00078         self.stamp = genpy.Time()
00079       end = 0
00080       _x = self
00081       start = end
00082       end += 8
00083       (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00084       start = end
00085       end += 1206
00086       self.data = str[start:end]
00087       self.stamp.canon()
00088       return self
00089     except struct.error as e:
00090       raise genpy.DeserializationError(e) #most likely buffer underfill
00091 
00092 
00093   def serialize_numpy(self, buff, numpy):
00094     """
00095     serialize message with numpy array types into buffer
00096     :param buff: buffer, ``StringIO``
00097     :param numpy: numpy python module
00098     """
00099     try:
00100       _x = self
00101       buff.write(_struct_2I.pack(_x.stamp.secs, _x.stamp.nsecs))
00102       _x = self.data
00103       # - if encoded as a list instead, serialize as bytes instead of string
00104       if type(_x) in [list, tuple]:
00105         buff.write(_struct_1206B.pack(*_x))
00106       else:
00107         buff.write(_struct_1206s.pack(_x))
00108     except struct.error as se: self._check_types(se)
00109     except TypeError as te: self._check_types(te)
00110 
00111   def deserialize_numpy(self, str, numpy):
00112     """
00113     unpack serialized message in str into this message instance using numpy for array types
00114     :param str: byte array of serialized message, ``str``
00115     :param numpy: numpy python module
00116     """
00117     try:
00118       if self.stamp is None:
00119         self.stamp = genpy.Time()
00120       end = 0
00121       _x = self
00122       start = end
00123       end += 8
00124       (_x.stamp.secs, _x.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00125       start = end
00126       end += 1206
00127       self.data = str[start:end]
00128       self.stamp.canon()
00129       return self
00130     except struct.error as e:
00131       raise genpy.DeserializationError(e) #most likely buffer underfill
00132 
00133 _struct_I = genpy.struct_I
00134 _struct_1206B = struct.Struct("<1206B")
00135 _struct_1206s = struct.Struct("<1206s")
00136 _struct_2I = struct.Struct("<2I")


velodyne_msgs
Author(s): Jack O'Quin
autogenerated on Fri Jan 3 2014 12:11:03