00001 """autogenerated by genmsg_py from VelodyneScan.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006 import velodyne_msgs.msg
00007 import std_msgs.msg
00008
00009 class VelodyneScan(roslib.message.Message):
00010 _md5sum = "9e3f252cfbc1351977f97c0549b33f49"
00011 _type = "velodyne_msgs/VelodyneScan"
00012 _has_header = True
00013 _full_text = """# Velodyne LIDAR scan packets.
00014
00015 uint32 PACKETS_PER_REVOLUTION = 260
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
00048 PACKETS_PER_REVOLUTION = 260
00049
00050 __slots__ = ['header','packets']
00051 _slot_types = ['Header','velodyne_msgs/VelodynePacket[]']
00052
00053 def __init__(self, *args, **kwds):
00054 """
00055 Constructor. Any message fields that are implicitly/explicitly
00056 set to None will be assigned a default value. The recommend
00057 use is keyword arguments as this is more robust to future message
00058 changes. You cannot mix in-order arguments and keyword arguments.
00059
00060 The available fields are:
00061 header,packets
00062
00063 @param args: complete set of field values, in .msg order
00064 @param kwds: use keyword arguments corresponding to message field names
00065 to set specific fields.
00066 """
00067 if args or kwds:
00068 super(VelodyneScan, self).__init__(*args, **kwds)
00069
00070 if self.header is None:
00071 self.header = std_msgs.msg._Header.Header()
00072 if self.packets is None:
00073 self.packets = []
00074 else:
00075 self.header = std_msgs.msg._Header.Header()
00076 self.packets = []
00077
00078 def _get_types(self):
00079 """
00080 internal API method
00081 """
00082 return self._slot_types
00083
00084 def serialize(self, buff):
00085 """
00086 serialize message into buffer
00087 @param buff: buffer
00088 @type buff: StringIO
00089 """
00090 try:
00091 _x = self
00092 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00093 _x = self.header.frame_id
00094 length = len(_x)
00095 buff.write(struct.pack('<I%ss'%length, length, _x))
00096 length = len(self.packets)
00097 buff.write(_struct_I.pack(length))
00098 for val1 in self.packets:
00099 _v1 = val1.stamp
00100 _x = _v1
00101 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00102 _x = val1.data
00103
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, se: self._check_types(se)
00109 except TypeError, te: self._check_types(te)
00110
00111 def deserialize(self, str):
00112 """
00113 unpack serialized message in str into this message instance
00114 @param str: byte array of serialized message
00115 @type str: str
00116 """
00117 try:
00118 if self.header is None:
00119 self.header = std_msgs.msg._Header.Header()
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 self.header.frame_id = str[start:end]
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 self.packets = []
00135 for i in xrange(0, length):
00136 val1 = velodyne_msgs.msg.VelodynePacket()
00137 _v2 = val1.stamp
00138 _x = _v2
00139 start = end
00140 end += 8
00141 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00142 start = end
00143 end += 1206
00144 val1.data = str[start:end]
00145 self.packets.append(val1)
00146 return self
00147 except struct.error, e:
00148 raise roslib.message.DeserializationError(e)
00149
00150
00151 def serialize_numpy(self, buff, numpy):
00152 """
00153 serialize message with numpy array types into buffer
00154 @param buff: buffer
00155 @type buff: StringIO
00156 @param numpy: numpy python module
00157 @type numpy module
00158 """
00159 try:
00160 _x = self
00161 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00162 _x = self.header.frame_id
00163 length = len(_x)
00164 buff.write(struct.pack('<I%ss'%length, length, _x))
00165 length = len(self.packets)
00166 buff.write(_struct_I.pack(length))
00167 for val1 in self.packets:
00168 _v3 = val1.stamp
00169 _x = _v3
00170 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00171 _x = val1.data
00172
00173 if type(_x) in [list, tuple]:
00174 buff.write(_struct_1206B.pack(*_x))
00175 else:
00176 buff.write(_struct_1206s.pack(_x))
00177 except struct.error, se: self._check_types(se)
00178 except TypeError, te: self._check_types(te)
00179
00180 def deserialize_numpy(self, str, numpy):
00181 """
00182 unpack serialized message in str into this message instance using numpy for array types
00183 @param str: byte array of serialized message
00184 @type str: str
00185 @param numpy: numpy python module
00186 @type numpy: module
00187 """
00188 try:
00189 if self.header is None:
00190 self.header = std_msgs.msg._Header.Header()
00191 end = 0
00192 _x = self
00193 start = end
00194 end += 12
00195 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00196 start = end
00197 end += 4
00198 (length,) = _struct_I.unpack(str[start:end])
00199 start = end
00200 end += length
00201 self.header.frame_id = str[start:end]
00202 start = end
00203 end += 4
00204 (length,) = _struct_I.unpack(str[start:end])
00205 self.packets = []
00206 for i in xrange(0, length):
00207 val1 = velodyne_msgs.msg.VelodynePacket()
00208 _v4 = val1.stamp
00209 _x = _v4
00210 start = end
00211 end += 8
00212 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00213 start = end
00214 end += 1206
00215 val1.data = str[start:end]
00216 self.packets.append(val1)
00217 return self
00218 except struct.error, e:
00219 raise roslib.message.DeserializationError(e)
00220
00221 _struct_I = roslib.message.struct_I
00222 _struct_1206s = struct.Struct("<1206s")
00223 _struct_3I = struct.Struct("<3I")
00224 _struct_1206B = struct.Struct("<1206B")
00225 _struct_2I = struct.Struct("<2I")