$search
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 = "50804fc9533a0e579e6322c04ae70566" 00011 _type = "velodyne_msgs/VelodyneScan" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """# Velodyne LIDAR scan packets. 00014 00015 Header header # standard ROS message header 00016 VelodynePacket[] packets # vector of raw packets 00017 00018 ================================================================================ 00019 MSG: std_msgs/Header 00020 # Standard metadata for higher-level stamped data types. 00021 # This is generally used to communicate timestamped data 00022 # in a particular coordinate frame. 00023 # 00024 # sequence ID: consecutively increasing ID 00025 uint32 seq 00026 #Two-integer timestamp that is expressed as: 00027 # * stamp.secs: seconds (stamp_secs) since epoch 00028 # * stamp.nsecs: nanoseconds since stamp_secs 00029 # time-handling sugar is provided by the client library 00030 time stamp 00031 #Frame this data is associated with 00032 # 0: no frame 00033 # 1: global frame 00034 string frame_id 00035 00036 ================================================================================ 00037 MSG: velodyne_msgs/VelodynePacket 00038 # Raw Velodyne LIDAR packet. 00039 00040 time stamp # packet timestamp 00041 uint8[1206] data # packet contents 00042 00043 00044 """ 00045 __slots__ = ['header','packets'] 00046 _slot_types = ['Header','velodyne_msgs/VelodynePacket[]'] 00047 00048 def __init__(self, *args, **kwds): 00049 """ 00050 Constructor. Any message fields that are implicitly/explicitly 00051 set to None will be assigned a default value. The recommend 00052 use is keyword arguments as this is more robust to future message 00053 changes. You cannot mix in-order arguments and keyword arguments. 00054 00055 The available fields are: 00056 header,packets 00057 00058 @param args: complete set of field values, in .msg order 00059 @param kwds: use keyword arguments corresponding to message field names 00060 to set specific fields. 00061 """ 00062 if args or kwds: 00063 super(VelodyneScan, self).__init__(*args, **kwds) 00064 #message fields cannot be None, assign default values for those that are 00065 if self.header is None: 00066 self.header = std_msgs.msg._Header.Header() 00067 if self.packets is None: 00068 self.packets = [] 00069 else: 00070 self.header = std_msgs.msg._Header.Header() 00071 self.packets = [] 00072 00073 def _get_types(self): 00074 """ 00075 internal API method 00076 """ 00077 return self._slot_types 00078 00079 def serialize(self, buff): 00080 """ 00081 serialize message into buffer 00082 @param buff: buffer 00083 @type buff: StringIO 00084 """ 00085 try: 00086 _x = self 00087 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00088 _x = self.header.frame_id 00089 length = len(_x) 00090 buff.write(struct.pack('<I%ss'%length, length, _x)) 00091 length = len(self.packets) 00092 buff.write(_struct_I.pack(length)) 00093 for val1 in self.packets: 00094 _v1 = val1.stamp 00095 _x = _v1 00096 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00097 _x = val1.data 00098 # - if encoded as a list instead, serialize as bytes instead of string 00099 if type(_x) in [list, tuple]: 00100 buff.write(_struct_1206B.pack(*_x)) 00101 else: 00102 buff.write(_struct_1206s.pack(_x)) 00103 except struct.error as se: self._check_types(se) 00104 except TypeError as te: self._check_types(te) 00105 00106 def deserialize(self, str): 00107 """ 00108 unpack serialized message in str into this message instance 00109 @param str: byte array of serialized message 00110 @type str: str 00111 """ 00112 try: 00113 if self.header is None: 00114 self.header = std_msgs.msg._Header.Header() 00115 end = 0 00116 _x = self 00117 start = end 00118 end += 12 00119 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.header.frame_id = str[start:end] 00126 start = end 00127 end += 4 00128 (length,) = _struct_I.unpack(str[start:end]) 00129 self.packets = [] 00130 for i in range(0, length): 00131 val1 = velodyne_msgs.msg.VelodynePacket() 00132 _v2 = val1.stamp 00133 _x = _v2 00134 start = end 00135 end += 8 00136 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00137 start = end 00138 end += 1206 00139 val1.data = str[start:end] 00140 self.packets.append(val1) 00141 return self 00142 except struct.error as e: 00143 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00144 00145 00146 def serialize_numpy(self, buff, numpy): 00147 """ 00148 serialize message with numpy array types into buffer 00149 @param buff: buffer 00150 @type buff: StringIO 00151 @param numpy: numpy python module 00152 @type numpy module 00153 """ 00154 try: 00155 _x = self 00156 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00157 _x = self.header.frame_id 00158 length = len(_x) 00159 buff.write(struct.pack('<I%ss'%length, length, _x)) 00160 length = len(self.packets) 00161 buff.write(_struct_I.pack(length)) 00162 for val1 in self.packets: 00163 _v3 = val1.stamp 00164 _x = _v3 00165 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 00166 _x = val1.data 00167 # - if encoded as a list instead, serialize as bytes instead of string 00168 if type(_x) in [list, tuple]: 00169 buff.write(_struct_1206B.pack(*_x)) 00170 else: 00171 buff.write(_struct_1206s.pack(_x)) 00172 except struct.error as se: self._check_types(se) 00173 except TypeError as te: self._check_types(te) 00174 00175 def deserialize_numpy(self, str, numpy): 00176 """ 00177 unpack serialized message in str into this message instance using numpy for array types 00178 @param str: byte array of serialized message 00179 @type str: str 00180 @param numpy: numpy python module 00181 @type numpy: module 00182 """ 00183 try: 00184 if self.header is None: 00185 self.header = std_msgs.msg._Header.Header() 00186 end = 0 00187 _x = self 00188 start = end 00189 end += 12 00190 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00191 start = end 00192 end += 4 00193 (length,) = _struct_I.unpack(str[start:end]) 00194 start = end 00195 end += length 00196 self.header.frame_id = str[start:end] 00197 start = end 00198 end += 4 00199 (length,) = _struct_I.unpack(str[start:end]) 00200 self.packets = [] 00201 for i in range(0, length): 00202 val1 = velodyne_msgs.msg.VelodynePacket() 00203 _v4 = val1.stamp 00204 _x = _v4 00205 start = end 00206 end += 8 00207 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 00208 start = end 00209 end += 1206 00210 val1.data = str[start:end] 00211 self.packets.append(val1) 00212 return self 00213 except struct.error as e: 00214 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00215 00216 _struct_I = roslib.message.struct_I 00217 _struct_1206s = struct.Struct("<1206s") 00218 _struct_3I = struct.Struct("<3I") 00219 _struct_1206B = struct.Struct("<1206B") 00220 _struct_2I = struct.Struct("<2I")