00001 """autogenerated by genmsg_py from LaserScan.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class LaserScan(roslib.message.Message):
00008 _md5sum = "90c7ef2dc6895d81024acba2ac42f369"
00009 _type = "sensor_msgs/LaserScan"
00010 _has_header = True
00011 _full_text = """# Single scan from a planar laser range-finder
00012 #
00013 # If you have another ranging device with different behavior (e.g. a sonar
00014 # array), please find or create a different message, since applications
00015 # will make fairly laser-specific assumptions about this data
00016
00017 Header header # timestamp in the header is the acquisition time of
00018 # the first ray in the scan.
00019 #
00020 # in frame frame_id, angles are measured around
00021 # the positive Z axis (counterclockwise, if Z is up)
00022 # with zero angle being forward along the x axis
00023
00024 float32 angle_min # start angle of the scan [rad]
00025 float32 angle_max # end angle of the scan [rad]
00026 float32 angle_increment # angular distance between measurements [rad]
00027
00028 float32 time_increment # time between measurements [seconds] - if your scanner
00029 # is moving, this will be used in interpolating position
00030 # of 3d points
00031 float32 scan_time # time between scans [seconds]
00032
00033 float32 range_min # minimum range value [m]
00034 float32 range_max # maximum range value [m]
00035
00036 float32[] ranges # range data [m] (Note: values < range_min or > range_max should be discarded)
00037 float32[] intensities # intensity data [device-specific units]. If your
00038 # device does not provide intensities, please leave
00039 # the array empty.
00040
00041 ================================================================================
00042 MSG: std_msgs/Header
00043 # Standard metadata for higher-level stamped data types.
00044 # This is generally used to communicate timestamped data
00045 # in a particular coordinate frame.
00046 #
00047 # sequence ID: consecutively increasing ID
00048 uint32 seq
00049 #Two-integer timestamp that is expressed as:
00050 # * stamp.secs: seconds (stamp_secs) since epoch
00051 # * stamp.nsecs: nanoseconds since stamp_secs
00052 # time-handling sugar is provided by the client library
00053 time stamp
00054 #Frame this data is associated with
00055 # 0: no frame
00056 # 1: global frame
00057 string frame_id
00058
00059 """
00060 __slots__ = ['header','angle_min','angle_max','angle_increment','time_increment','scan_time','range_min','range_max','ranges','intensities']
00061 _slot_types = ['Header','float32','float32','float32','float32','float32','float32','float32','float32[]','float32[]']
00062
00063 def __init__(self, *args, **kwds):
00064 """
00065 Constructor. Any message fields that are implicitly/explicitly
00066 set to None will be assigned a default value. The recommend
00067 use is keyword arguments as this is more robust to future message
00068 changes. You cannot mix in-order arguments and keyword arguments.
00069
00070 The available fields are:
00071 header,angle_min,angle_max,angle_increment,time_increment,scan_time,range_min,range_max,ranges,intensities
00072
00073 @param args: complete set of field values, in .msg order
00074 @param kwds: use keyword arguments corresponding to message field names
00075 to set specific fields.
00076 """
00077 if args or kwds:
00078 super(LaserScan, self).__init__(*args, **kwds)
00079
00080 if self.header is None:
00081 self.header = std_msgs.msg._Header.Header()
00082 if self.angle_min is None:
00083 self.angle_min = 0.
00084 if self.angle_max is None:
00085 self.angle_max = 0.
00086 if self.angle_increment is None:
00087 self.angle_increment = 0.
00088 if self.time_increment is None:
00089 self.time_increment = 0.
00090 if self.scan_time is None:
00091 self.scan_time = 0.
00092 if self.range_min is None:
00093 self.range_min = 0.
00094 if self.range_max is None:
00095 self.range_max = 0.
00096 if self.ranges is None:
00097 self.ranges = []
00098 if self.intensities is None:
00099 self.intensities = []
00100 else:
00101 self.header = std_msgs.msg._Header.Header()
00102 self.angle_min = 0.
00103 self.angle_max = 0.
00104 self.angle_increment = 0.
00105 self.time_increment = 0.
00106 self.scan_time = 0.
00107 self.range_min = 0.
00108 self.range_max = 0.
00109 self.ranges = []
00110 self.intensities = []
00111
00112 def _get_types(self):
00113 """
00114 internal API method
00115 """
00116 return self._slot_types
00117
00118 def serialize(self, buff):
00119 """
00120 serialize message into buffer
00121 @param buff: buffer
00122 @type buff: StringIO
00123 """
00124 try:
00125 _x = self
00126 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00127 _x = self.header.frame_id
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 _x = self
00131 buff.write(_struct_7f.pack(_x.angle_min, _x.angle_max, _x.angle_increment, _x.time_increment, _x.scan_time, _x.range_min, _x.range_max))
00132 length = len(self.ranges)
00133 buff.write(_struct_I.pack(length))
00134 pattern = '<%sf'%length
00135 buff.write(struct.pack(pattern, *self.ranges))
00136 length = len(self.intensities)
00137 buff.write(_struct_I.pack(length))
00138 pattern = '<%sf'%length
00139 buff.write(struct.pack(pattern, *self.intensities))
00140 except struct.error as se: self._check_types(se)
00141 except TypeError as te: self._check_types(te)
00142
00143 def deserialize(self, str):
00144 """
00145 unpack serialized message in str into this message instance
00146 @param str: byte array of serialized message
00147 @type str: str
00148 """
00149 try:
00150 if self.header is None:
00151 self.header = std_msgs.msg._Header.Header()
00152 end = 0
00153 _x = self
00154 start = end
00155 end += 12
00156 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00157 start = end
00158 end += 4
00159 (length,) = _struct_I.unpack(str[start:end])
00160 start = end
00161 end += length
00162 self.header.frame_id = str[start:end]
00163 _x = self
00164 start = end
00165 end += 28
00166 (_x.angle_min, _x.angle_max, _x.angle_increment, _x.time_increment, _x.scan_time, _x.range_min, _x.range_max,) = _struct_7f.unpack(str[start:end])
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 pattern = '<%sf'%length
00171 start = end
00172 end += struct.calcsize(pattern)
00173 self.ranges = struct.unpack(pattern, str[start:end])
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 pattern = '<%sf'%length
00178 start = end
00179 end += struct.calcsize(pattern)
00180 self.intensities = struct.unpack(pattern, str[start:end])
00181 return self
00182 except struct.error as e:
00183 raise roslib.message.DeserializationError(e)
00184
00185
00186 def serialize_numpy(self, buff, numpy):
00187 """
00188 serialize message with numpy array types into buffer
00189 @param buff: buffer
00190 @type buff: StringIO
00191 @param numpy: numpy python module
00192 @type numpy module
00193 """
00194 try:
00195 _x = self
00196 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00197 _x = self.header.frame_id
00198 length = len(_x)
00199 buff.write(struct.pack('<I%ss'%length, length, _x))
00200 _x = self
00201 buff.write(_struct_7f.pack(_x.angle_min, _x.angle_max, _x.angle_increment, _x.time_increment, _x.scan_time, _x.range_min, _x.range_max))
00202 length = len(self.ranges)
00203 buff.write(_struct_I.pack(length))
00204 pattern = '<%sf'%length
00205 buff.write(self.ranges.tostring())
00206 length = len(self.intensities)
00207 buff.write(_struct_I.pack(length))
00208 pattern = '<%sf'%length
00209 buff.write(self.intensities.tostring())
00210 except struct.error as se: self._check_types(se)
00211 except TypeError as te: self._check_types(te)
00212
00213 def deserialize_numpy(self, str, numpy):
00214 """
00215 unpack serialized message in str into this message instance using numpy for array types
00216 @param str: byte array of serialized message
00217 @type str: str
00218 @param numpy: numpy python module
00219 @type numpy: module
00220 """
00221 try:
00222 if self.header is None:
00223 self.header = std_msgs.msg._Header.Header()
00224 end = 0
00225 _x = self
00226 start = end
00227 end += 12
00228 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 self.header.frame_id = str[start:end]
00235 _x = self
00236 start = end
00237 end += 28
00238 (_x.angle_min, _x.angle_max, _x.angle_increment, _x.time_increment, _x.scan_time, _x.range_min, _x.range_max,) = _struct_7f.unpack(str[start:end])
00239 start = end
00240 end += 4
00241 (length,) = _struct_I.unpack(str[start:end])
00242 pattern = '<%sf'%length
00243 start = end
00244 end += struct.calcsize(pattern)
00245 self.ranges = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00246 start = end
00247 end += 4
00248 (length,) = _struct_I.unpack(str[start:end])
00249 pattern = '<%sf'%length
00250 start = end
00251 end += struct.calcsize(pattern)
00252 self.intensities = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00253 return self
00254 except struct.error as e:
00255 raise roslib.message.DeserializationError(e)
00256
00257 _struct_I = roslib.message.struct_I
00258 _struct_7f = struct.Struct("<7f")
00259 _struct_3I = struct.Struct("<3I")