00001 """autogenerated by genpy from velodyne_msgs/VelodyneScan.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 import velodyne_msgs.msg
00009 import std_msgs.msg
00010
00011 class VelodyneScan(genpy.Message):
00012 _md5sum = "50804fc9533a0e579e6322c04ae70566"
00013 _type = "velodyne_msgs/VelodyneScan"
00014 _has_header = True
00015 _full_text = """# Velodyne LIDAR scan packets.
00016
00017 Header header # standard ROS message header
00018 VelodynePacket[] packets # vector of raw packets
00019
00020 ================================================================================
00021 MSG: std_msgs/Header
00022 # Standard metadata for higher-level stamped data types.
00023 # This is generally used to communicate timestamped data
00024 # in a particular coordinate frame.
00025 #
00026 # sequence ID: consecutively increasing ID
00027 uint32 seq
00028 #Two-integer timestamp that is expressed as:
00029 # * stamp.secs: seconds (stamp_secs) since epoch
00030 # * stamp.nsecs: nanoseconds since stamp_secs
00031 # time-handling sugar is provided by the client library
00032 time stamp
00033 #Frame this data is associated with
00034 # 0: no frame
00035 # 1: global frame
00036 string frame_id
00037
00038 ================================================================================
00039 MSG: velodyne_msgs/VelodynePacket
00040 # Raw Velodyne LIDAR packet.
00041
00042 time stamp # packet timestamp
00043 uint8[1206] data # packet contents
00044
00045
00046 """
00047 __slots__ = ['header','packets']
00048 _slot_types = ['std_msgs/Header','velodyne_msgs/VelodynePacket[]']
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,packets
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(VelodyneScan, self).__init__(*args, **kwds)
00066
00067 if self.header is None:
00068 self.header = std_msgs.msg.Header()
00069 if self.packets is None:
00070 self.packets = []
00071 else:
00072 self.header = std_msgs.msg.Header()
00073 self.packets = []
00074
00075 def _get_types(self):
00076 """
00077 internal API method
00078 """
00079 return self._slot_types
00080
00081 def serialize(self, buff):
00082 """
00083 serialize message into buffer
00084 :param buff: buffer, ``StringIO``
00085 """
00086 try:
00087 _x = self
00088 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00089 _x = self.header.frame_id
00090 length = len(_x)
00091 if python3 or type(_x) == unicode:
00092 _x = _x.encode('utf-8')
00093 length = len(_x)
00094 buff.write(struct.pack('<I%ss'%length, length, _x))
00095 length = len(self.packets)
00096 buff.write(_struct_I.pack(length))
00097 for val1 in self.packets:
00098 _v1 = val1.stamp
00099 _x = _v1
00100 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00101 _x = val1.data
00102
00103 if type(_x) in [list, tuple]:
00104 buff.write(_struct_1206B.pack(*_x))
00105 else:
00106 buff.write(_struct_1206s.pack(_x))
00107 except struct.error as se: self._check_types(se)
00108 except TypeError as te: self._check_types(te)
00109
00110 def deserialize(self, str):
00111 """
00112 unpack serialized message in str into this message instance
00113 :param str: byte array of serialized message, ``str``
00114 """
00115 try:
00116 if self.header is None:
00117 self.header = std_msgs.msg.Header()
00118 if self.packets is None:
00119 self.packets = None
00120 end = 0
00121 _x = self
00122 start = end
00123 end += 12
00124 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00125 start = end
00126 end += 4
00127 (length,) = _struct_I.unpack(str[start:end])
00128 start = end
00129 end += length
00130 if python3:
00131 self.header.frame_id = str[start:end].decode('utf-8')
00132 else:
00133 self.header.frame_id = str[start:end]
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 self.packets = []
00138 for i in range(0, length):
00139 val1 = velodyne_msgs.msg.VelodynePacket()
00140 _v2 = val1.stamp
00141 _x = _v2
00142 start = end
00143 end += 8
00144 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00145 start = end
00146 end += 1206
00147 val1.data = str[start:end]
00148 self.packets.append(val1)
00149 return self
00150 except struct.error as e:
00151 raise genpy.DeserializationError(e)
00152
00153
00154 def serialize_numpy(self, buff, numpy):
00155 """
00156 serialize message with numpy array types into buffer
00157 :param buff: buffer, ``StringIO``
00158 :param numpy: numpy python module
00159 """
00160 try:
00161 _x = self
00162 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00163 _x = self.header.frame_id
00164 length = len(_x)
00165 if python3 or type(_x) == unicode:
00166 _x = _x.encode('utf-8')
00167 length = len(_x)
00168 buff.write(struct.pack('<I%ss'%length, length, _x))
00169 length = len(self.packets)
00170 buff.write(_struct_I.pack(length))
00171 for val1 in self.packets:
00172 _v3 = val1.stamp
00173 _x = _v3
00174 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00175 _x = val1.data
00176
00177 if type(_x) in [list, tuple]:
00178 buff.write(_struct_1206B.pack(*_x))
00179 else:
00180 buff.write(_struct_1206s.pack(_x))
00181 except struct.error as se: self._check_types(se)
00182 except TypeError as te: self._check_types(te)
00183
00184 def deserialize_numpy(self, str, numpy):
00185 """
00186 unpack serialized message in str into this message instance using numpy for array types
00187 :param str: byte array of serialized message, ``str``
00188 :param numpy: numpy python module
00189 """
00190 try:
00191 if self.header is None:
00192 self.header = std_msgs.msg.Header()
00193 if self.packets is None:
00194 self.packets = None
00195 end = 0
00196 _x = self
00197 start = end
00198 end += 12
00199 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00200 start = end
00201 end += 4
00202 (length,) = _struct_I.unpack(str[start:end])
00203 start = end
00204 end += length
00205 if python3:
00206 self.header.frame_id = str[start:end].decode('utf-8')
00207 else:
00208 self.header.frame_id = str[start:end]
00209 start = end
00210 end += 4
00211 (length,) = _struct_I.unpack(str[start:end])
00212 self.packets = []
00213 for i in range(0, length):
00214 val1 = velodyne_msgs.msg.VelodynePacket()
00215 _v4 = val1.stamp
00216 _x = _v4
00217 start = end
00218 end += 8
00219 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00220 start = end
00221 end += 1206
00222 val1.data = str[start:end]
00223 self.packets.append(val1)
00224 return self
00225 except struct.error as e:
00226 raise genpy.DeserializationError(e)
00227
00228 _struct_I = genpy.struct_I
00229 _struct_1206s = struct.Struct("<1206s")
00230 _struct_3I = struct.Struct("<3I")
00231 _struct_1206B = struct.Struct("<1206B")
00232 _struct_2I = struct.Struct("<2I")