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