00001 """autogenerated by genpy from erratic_player/RangeArray.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 std_msgs.msg
00008 import sensor_msgs.msg
00009
00010 class RangeArray(genpy.Message):
00011 _md5sum = "b72db098d4ed346ce682a1d5e70d327c"
00012 _type = "erratic_player/RangeArray"
00013 _has_header = False
00014 _full_text = """sensor_msgs/Range[] ranges
00015
00016 ================================================================================
00017 MSG: sensor_msgs/Range
00018 # Single range reading from an active ranger that emits energy and reports
00019 # one range reading that is valid along an arc at the distance measured.
00020 # This message is not appropriate for laser scanners. See the LaserScan
00021 # message if you are working with a laser scanner.
00022
00023 # This message also can represent a fixed-distance (binary) ranger. This
00024 # sensor will have min_range===max_range===distance of detection.
00025 # These sensors follow REP 117 and will output -Inf if the object is detected
00026 # and +Inf if the object is outside of the detection range.
00027
00028 Header header # timestamp in the header is the time the ranger
00029 # returned the distance reading
00030
00031 # Radiation type enums
00032 # If you want a value added to this list, send an email to the ros-users list
00033 uint8 ULTRASOUND=0
00034 uint8 INFRARED=1
00035
00036 uint8 radiation_type # the type of radiation used by the sensor
00037 # (sound, IR, etc) [enum]
00038
00039 float32 field_of_view # the size of the arc that the distance reading is
00040 # valid for [rad]
00041 # the object causing the range reading may have
00042 # been anywhere within -field_of_view/2 and
00043 # field_of_view/2 at the measured range.
00044 # 0 angle corresponds to the x-axis of the sensor.
00045
00046 float32 min_range # minimum range value [m]
00047 float32 max_range # maximum range value [m]
00048 # Fixed distance rangers require min_range==max_range
00049
00050 float32 range # range data [m]
00051 # (Note: values < range_min or > range_max
00052 # should be discarded)
00053 # Fixed distance rangers only output -Inf or +Inf.
00054 # -Inf represents a detection within fixed distance.
00055 # (Detection too close to the sensor to quantify)
00056 # +Inf represents no detection within the fixed distance.
00057 # (Object out of range)
00058 ================================================================================
00059 MSG: std_msgs/Header
00060 # Standard metadata for higher-level stamped data types.
00061 # This is generally used to communicate timestamped data
00062 # in a particular coordinate frame.
00063 #
00064 # sequence ID: consecutively increasing ID
00065 uint32 seq
00066 #Two-integer timestamp that is expressed as:
00067 # * stamp.secs: seconds (stamp_secs) since epoch
00068 # * stamp.nsecs: nanoseconds since stamp_secs
00069 # time-handling sugar is provided by the client library
00070 time stamp
00071 #Frame this data is associated with
00072 # 0: no frame
00073 # 1: global frame
00074 string frame_id
00075
00076 """
00077 __slots__ = ['ranges']
00078 _slot_types = ['sensor_msgs/Range[]']
00079
00080 def __init__(self, *args, **kwds):
00081 """
00082 Constructor. Any message fields that are implicitly/explicitly
00083 set to None will be assigned a default value. The recommend
00084 use is keyword arguments as this is more robust to future message
00085 changes. You cannot mix in-order arguments and keyword arguments.
00086
00087 The available fields are:
00088 ranges
00089
00090 :param args: complete set of field values, in .msg order
00091 :param kwds: use keyword arguments corresponding to message field names
00092 to set specific fields.
00093 """
00094 if args or kwds:
00095 super(RangeArray, self).__init__(*args, **kwds)
00096
00097 if self.ranges is None:
00098 self.ranges = []
00099 else:
00100 self.ranges = []
00101
00102 def _get_types(self):
00103 """
00104 internal API method
00105 """
00106 return self._slot_types
00107
00108 def serialize(self, buff):
00109 """
00110 serialize message into buffer
00111 :param buff: buffer, ``StringIO``
00112 """
00113 try:
00114 length = len(self.ranges)
00115 buff.write(_struct_I.pack(length))
00116 for val1 in self.ranges:
00117 _v1 = val1.header
00118 buff.write(_struct_I.pack(_v1.seq))
00119 _v2 = _v1.stamp
00120 _x = _v2
00121 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00122 _x = _v1.frame_id
00123 length = len(_x)
00124 if python3 or type(_x) == unicode:
00125 _x = _x.encode('utf-8')
00126 length = len(_x)
00127 buff.write(struct.pack('<I%ss'%length, length, _x))
00128 _x = val1
00129 buff.write(_struct_B4f.pack(_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range))
00130 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00131 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00132
00133 def deserialize(self, str):
00134 """
00135 unpack serialized message in str into this message instance
00136 :param str: byte array of serialized message, ``str``
00137 """
00138 try:
00139 if self.ranges is None:
00140 self.ranges = None
00141 end = 0
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 self.ranges = []
00146 for i in range(0, length):
00147 val1 = sensor_msgs.msg.Range()
00148 _v3 = val1.header
00149 start = end
00150 end += 4
00151 (_v3.seq,) = _struct_I.unpack(str[start:end])
00152 _v4 = _v3.stamp
00153 _x = _v4
00154 start = end
00155 end += 8
00156 (_x.secs, _x.nsecs,) = _struct_2I.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 if python3:
00163 _v3.frame_id = str[start:end].decode('utf-8')
00164 else:
00165 _v3.frame_id = str[start:end]
00166 _x = val1
00167 start = end
00168 end += 17
00169 (_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range,) = _struct_B4f.unpack(str[start:end])
00170 self.ranges.append(val1)
00171 return self
00172 except struct.error as e:
00173 raise genpy.DeserializationError(e)
00174
00175
00176 def serialize_numpy(self, buff, numpy):
00177 """
00178 serialize message with numpy array types into buffer
00179 :param buff: buffer, ``StringIO``
00180 :param numpy: numpy python module
00181 """
00182 try:
00183 length = len(self.ranges)
00184 buff.write(_struct_I.pack(length))
00185 for val1 in self.ranges:
00186 _v5 = val1.header
00187 buff.write(_struct_I.pack(_v5.seq))
00188 _v6 = _v5.stamp
00189 _x = _v6
00190 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00191 _x = _v5.frame_id
00192 length = len(_x)
00193 if python3 or type(_x) == unicode:
00194 _x = _x.encode('utf-8')
00195 length = len(_x)
00196 buff.write(struct.pack('<I%ss'%length, length, _x))
00197 _x = val1
00198 buff.write(_struct_B4f.pack(_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range))
00199 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00200 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00201
00202 def deserialize_numpy(self, str, numpy):
00203 """
00204 unpack serialized message in str into this message instance using numpy for array types
00205 :param str: byte array of serialized message, ``str``
00206 :param numpy: numpy python module
00207 """
00208 try:
00209 if self.ranges is None:
00210 self.ranges = None
00211 end = 0
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 self.ranges = []
00216 for i in range(0, length):
00217 val1 = sensor_msgs.msg.Range()
00218 _v7 = val1.header
00219 start = end
00220 end += 4
00221 (_v7.seq,) = _struct_I.unpack(str[start:end])
00222 _v8 = _v7.stamp
00223 _x = _v8
00224 start = end
00225 end += 8
00226 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00227 start = end
00228 end += 4
00229 (length,) = _struct_I.unpack(str[start:end])
00230 start = end
00231 end += length
00232 if python3:
00233 _v7.frame_id = str[start:end].decode('utf-8')
00234 else:
00235 _v7.frame_id = str[start:end]
00236 _x = val1
00237 start = end
00238 end += 17
00239 (_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range,) = _struct_B4f.unpack(str[start:end])
00240 self.ranges.append(val1)
00241 return self
00242 except struct.error as e:
00243 raise genpy.DeserializationError(e)
00244
00245 _struct_I = genpy.struct_I
00246 _struct_B4f = struct.Struct("<B4f")
00247 _struct_2I = struct.Struct("<2I")