00001 """autogenerated by genpy from art_msgs/Observation.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Observation(genpy.Message):
00009 _md5sum = "6c2160774352970d1e5208366926f25e"
00010 _type = "art_msgs/Observation"
00011 _has_header = False
00012 _full_text = """# result returned from a single observer
00013 # $Id: Observation.msg 1614 2011-08-06 21:02:59Z jack.oquin $
00014
00015 # possible observer ID values
00016 int32 Nearest_forward = 0 # current or closest lane
00017 int32 Nearest_backward = 1
00018 int32 Adjacent_left = 2 # adjacent left or right lane
00019 int32 Adjacent_right = 3
00020 int32 All_left = 4 # all left or right lanes
00021 int32 All_right = 5
00022 int32 Merge_into_nearest = 6 # merge into nearest lane on diff seg
00023 int32 Merge_across_all = 7 # merge across all lanes on diff seg
00024 int32 Intersection = 8 # stop sign intersection precedence
00025 int32 N_Observers = 9
00026
00027 int32 oid # observer ID
00028 string name # observer name
00029
00030 bool applicable # true if obseravation is applicable
00031 bool clear # true if clear to go
00032
00033 # optional time and distance to nearest obstacle
00034 # (only reported by some observers)
00035 float32 time
00036 float32 distance
00037 float32 velocity
00038 int32 nobjects # number of objects
00039
00040 """
00041
00042 Nearest_forward = 0
00043 Nearest_backward = 1
00044 Adjacent_left = 2
00045 Adjacent_right = 3
00046 All_left = 4
00047 All_right = 5
00048 Merge_into_nearest = 6
00049 Merge_across_all = 7
00050 Intersection = 8
00051 N_Observers = 9
00052
00053 __slots__ = ['oid','name','applicable','clear','time','distance','velocity','nobjects']
00054 _slot_types = ['int32','string','bool','bool','float32','float32','float32','int32']
00055
00056 def __init__(self, *args, **kwds):
00057 """
00058 Constructor. Any message fields that are implicitly/explicitly
00059 set to None will be assigned a default value. The recommend
00060 use is keyword arguments as this is more robust to future message
00061 changes. You cannot mix in-order arguments and keyword arguments.
00062
00063 The available fields are:
00064 oid,name,applicable,clear,time,distance,velocity,nobjects
00065
00066 :param args: complete set of field values, in .msg order
00067 :param kwds: use keyword arguments corresponding to message field names
00068 to set specific fields.
00069 """
00070 if args or kwds:
00071 super(Observation, self).__init__(*args, **kwds)
00072
00073 if self.oid is None:
00074 self.oid = 0
00075 if self.name is None:
00076 self.name = ''
00077 if self.applicable is None:
00078 self.applicable = False
00079 if self.clear is None:
00080 self.clear = False
00081 if self.time is None:
00082 self.time = 0.
00083 if self.distance is None:
00084 self.distance = 0.
00085 if self.velocity is None:
00086 self.velocity = 0.
00087 if self.nobjects is None:
00088 self.nobjects = 0
00089 else:
00090 self.oid = 0
00091 self.name = ''
00092 self.applicable = False
00093 self.clear = False
00094 self.time = 0.
00095 self.distance = 0.
00096 self.velocity = 0.
00097 self.nobjects = 0
00098
00099 def _get_types(self):
00100 """
00101 internal API method
00102 """
00103 return self._slot_types
00104
00105 def serialize(self, buff):
00106 """
00107 serialize message into buffer
00108 :param buff: buffer, ``StringIO``
00109 """
00110 try:
00111 buff.write(_struct_i.pack(self.oid))
00112 _x = self.name
00113 length = len(_x)
00114 if python3 or type(_x) == unicode:
00115 _x = _x.encode('utf-8')
00116 length = len(_x)
00117 buff.write(struct.pack('<I%ss'%length, length, _x))
00118 _x = self
00119 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00120 except struct.error as se: self._check_types(se)
00121 except TypeError as te: self._check_types(te)
00122
00123 def deserialize(self, str):
00124 """
00125 unpack serialized message in str into this message instance
00126 :param str: byte array of serialized message, ``str``
00127 """
00128 try:
00129 end = 0
00130 start = end
00131 end += 4
00132 (self.oid,) = _struct_i.unpack(str[start:end])
00133 start = end
00134 end += 4
00135 (length,) = _struct_I.unpack(str[start:end])
00136 start = end
00137 end += length
00138 if python3:
00139 self.name = str[start:end].decode('utf-8')
00140 else:
00141 self.name = str[start:end]
00142 _x = self
00143 start = end
00144 end += 18
00145 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00146 self.applicable = bool(self.applicable)
00147 self.clear = bool(self.clear)
00148 return self
00149 except struct.error as e:
00150 raise genpy.DeserializationError(e)
00151
00152
00153 def serialize_numpy(self, buff, numpy):
00154 """
00155 serialize message with numpy array types into buffer
00156 :param buff: buffer, ``StringIO``
00157 :param numpy: numpy python module
00158 """
00159 try:
00160 buff.write(_struct_i.pack(self.oid))
00161 _x = self.name
00162 length = len(_x)
00163 if python3 or type(_x) == unicode:
00164 _x = _x.encode('utf-8')
00165 length = len(_x)
00166 buff.write(struct.pack('<I%ss'%length, length, _x))
00167 _x = self
00168 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00169 except struct.error as se: self._check_types(se)
00170 except TypeError as te: self._check_types(te)
00171
00172 def deserialize_numpy(self, str, numpy):
00173 """
00174 unpack serialized message in str into this message instance using numpy for array types
00175 :param str: byte array of serialized message, ``str``
00176 :param numpy: numpy python module
00177 """
00178 try:
00179 end = 0
00180 start = end
00181 end += 4
00182 (self.oid,) = _struct_i.unpack(str[start:end])
00183 start = end
00184 end += 4
00185 (length,) = _struct_I.unpack(str[start:end])
00186 start = end
00187 end += length
00188 if python3:
00189 self.name = str[start:end].decode('utf-8')
00190 else:
00191 self.name = str[start:end]
00192 _x = self
00193 start = end
00194 end += 18
00195 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00196 self.applicable = bool(self.applicable)
00197 self.clear = bool(self.clear)
00198 return self
00199 except struct.error as e:
00200 raise genpy.DeserializationError(e)
00201
00202 _struct_I = genpy.struct_I
00203 _struct_i = struct.Struct("<i")
00204 _struct_2B3fi = struct.Struct("<2B3fi")