00001 """autogenerated by genpy from art_msgs/ObservationArray.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 art_msgs.msg
00008 import std_msgs.msg
00009
00010 class ObservationArray(genpy.Message):
00011 _md5sum = "b5eeab09687abc64c329078cb1e9065a"
00012 _type = "art_msgs/ObservationArray"
00013 _has_header = True
00014 _full_text = """# Observations from a set of observers
00015 # $Id: ObservationArray.msg 1628 2011-08-09 21:51:35Z jack.oquin $
00016
00017 Header header
00018 Observation[] obs # vector of observations
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: art_msgs/Observation
00040 # result returned from a single observer
00041 # $Id: Observation.msg 1614 2011-08-06 21:02:59Z jack.oquin $
00042
00043 # possible observer ID values
00044 int32 Nearest_forward = 0 # current or closest lane
00045 int32 Nearest_backward = 1
00046 int32 Adjacent_left = 2 # adjacent left or right lane
00047 int32 Adjacent_right = 3
00048 int32 All_left = 4 # all left or right lanes
00049 int32 All_right = 5
00050 int32 Merge_into_nearest = 6 # merge into nearest lane on diff seg
00051 int32 Merge_across_all = 7 # merge across all lanes on diff seg
00052 int32 Intersection = 8 # stop sign intersection precedence
00053 int32 N_Observers = 9
00054
00055 int32 oid # observer ID
00056 string name # observer name
00057
00058 bool applicable # true if obseravation is applicable
00059 bool clear # true if clear to go
00060
00061 # optional time and distance to nearest obstacle
00062 # (only reported by some observers)
00063 float32 time
00064 float32 distance
00065 float32 velocity
00066 int32 nobjects # number of objects
00067
00068 """
00069 __slots__ = ['header','obs']
00070 _slot_types = ['std_msgs/Header','art_msgs/Observation[]']
00071
00072 def __init__(self, *args, **kwds):
00073 """
00074 Constructor. Any message fields that are implicitly/explicitly
00075 set to None will be assigned a default value. The recommend
00076 use is keyword arguments as this is more robust to future message
00077 changes. You cannot mix in-order arguments and keyword arguments.
00078
00079 The available fields are:
00080 header,obs
00081
00082 :param args: complete set of field values, in .msg order
00083 :param kwds: use keyword arguments corresponding to message field names
00084 to set specific fields.
00085 """
00086 if args or kwds:
00087 super(ObservationArray, self).__init__(*args, **kwds)
00088
00089 if self.header is None:
00090 self.header = std_msgs.msg.Header()
00091 if self.obs is None:
00092 self.obs = []
00093 else:
00094 self.header = std_msgs.msg.Header()
00095 self.obs = []
00096
00097 def _get_types(self):
00098 """
00099 internal API method
00100 """
00101 return self._slot_types
00102
00103 def serialize(self, buff):
00104 """
00105 serialize message into buffer
00106 :param buff: buffer, ``StringIO``
00107 """
00108 try:
00109 _x = self
00110 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00111 _x = self.header.frame_id
00112 length = len(_x)
00113 if python3 or type(_x) == unicode:
00114 _x = _x.encode('utf-8')
00115 length = len(_x)
00116 buff.write(struct.pack('<I%ss'%length, length, _x))
00117 length = len(self.obs)
00118 buff.write(_struct_I.pack(length))
00119 for val1 in self.obs:
00120 buff.write(_struct_i.pack(val1.oid))
00121 _x = val1.name
00122 length = len(_x)
00123 if python3 or type(_x) == unicode:
00124 _x = _x.encode('utf-8')
00125 length = len(_x)
00126 buff.write(struct.pack('<I%ss'%length, length, _x))
00127 _x = val1
00128 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00129 except struct.error as se: self._check_types(se)
00130 except TypeError as te: self._check_types(te)
00131
00132 def deserialize(self, str):
00133 """
00134 unpack serialized message in str into this message instance
00135 :param str: byte array of serialized message, ``str``
00136 """
00137 try:
00138 if self.header is None:
00139 self.header = std_msgs.msg.Header()
00140 if self.obs is None:
00141 self.obs = None
00142 end = 0
00143 _x = self
00144 start = end
00145 end += 12
00146 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 start = end
00151 end += length
00152 if python3:
00153 self.header.frame_id = str[start:end].decode('utf-8')
00154 else:
00155 self.header.frame_id = str[start:end]
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 self.obs = []
00160 for i in range(0, length):
00161 val1 = art_msgs.msg.Observation()
00162 start = end
00163 end += 4
00164 (val1.oid,) = _struct_i.unpack(str[start:end])
00165 start = end
00166 end += 4
00167 (length,) = _struct_I.unpack(str[start:end])
00168 start = end
00169 end += length
00170 if python3:
00171 val1.name = str[start:end].decode('utf-8')
00172 else:
00173 val1.name = str[start:end]
00174 _x = val1
00175 start = end
00176 end += 18
00177 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00178 val1.applicable = bool(val1.applicable)
00179 val1.clear = bool(val1.clear)
00180 self.obs.append(val1)
00181 return self
00182 except struct.error as e:
00183 raise genpy.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, ``StringIO``
00190 :param numpy: numpy python module
00191 """
00192 try:
00193 _x = self
00194 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00195 _x = self.header.frame_id
00196 length = len(_x)
00197 if python3 or type(_x) == unicode:
00198 _x = _x.encode('utf-8')
00199 length = len(_x)
00200 buff.write(struct.pack('<I%ss'%length, length, _x))
00201 length = len(self.obs)
00202 buff.write(_struct_I.pack(length))
00203 for val1 in self.obs:
00204 buff.write(_struct_i.pack(val1.oid))
00205 _x = val1.name
00206 length = len(_x)
00207 if python3 or type(_x) == unicode:
00208 _x = _x.encode('utf-8')
00209 length = len(_x)
00210 buff.write(struct.pack('<I%ss'%length, length, _x))
00211 _x = val1
00212 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00213 except struct.error as se: self._check_types(se)
00214 except TypeError as te: self._check_types(te)
00215
00216 def deserialize_numpy(self, str, numpy):
00217 """
00218 unpack serialized message in str into this message instance using numpy for array types
00219 :param str: byte array of serialized message, ``str``
00220 :param numpy: numpy python module
00221 """
00222 try:
00223 if self.header is None:
00224 self.header = std_msgs.msg.Header()
00225 if self.obs is None:
00226 self.obs = None
00227 end = 0
00228 _x = self
00229 start = end
00230 end += 12
00231 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00232 start = end
00233 end += 4
00234 (length,) = _struct_I.unpack(str[start:end])
00235 start = end
00236 end += length
00237 if python3:
00238 self.header.frame_id = str[start:end].decode('utf-8')
00239 else:
00240 self.header.frame_id = str[start:end]
00241 start = end
00242 end += 4
00243 (length,) = _struct_I.unpack(str[start:end])
00244 self.obs = []
00245 for i in range(0, length):
00246 val1 = art_msgs.msg.Observation()
00247 start = end
00248 end += 4
00249 (val1.oid,) = _struct_i.unpack(str[start:end])
00250 start = end
00251 end += 4
00252 (length,) = _struct_I.unpack(str[start:end])
00253 start = end
00254 end += length
00255 if python3:
00256 val1.name = str[start:end].decode('utf-8')
00257 else:
00258 val1.name = str[start:end]
00259 _x = val1
00260 start = end
00261 end += 18
00262 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00263 val1.applicable = bool(val1.applicable)
00264 val1.clear = bool(val1.clear)
00265 self.obs.append(val1)
00266 return self
00267 except struct.error as e:
00268 raise genpy.DeserializationError(e)
00269
00270 _struct_I = genpy.struct_I
00271 _struct_i = struct.Struct("<i")
00272 _struct_3I = struct.Struct("<3I")
00273 _struct_2B3fi = struct.Struct("<2B3fi")