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