$search
00001 """autogenerated by genmsg_py from PerceptInfo.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class PerceptInfo(roslib.message.Message): 00007 _md5sum = "6d276cf0fa6b560cbfd07a3f9eab88b5" 00008 _type = "worldmodel_msgs/PerceptInfo" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# This message contains information about the estimated class and object identity 00011 00012 # A string identifying the object's class (all objects of a class look the same) 00013 string class_id 00014 00015 # The class association support of the observation 00016 # The support is the log odd likelihood ratio given by log(p(y/observation y belongs to object of class class_id) / p(y/observation y is a false positive)) 00017 float32 class_support 00018 00019 # A string identifying a specific object 00020 string object_id 00021 00022 # The object association support of the observation 00023 # The support is the log odd likelihood ratio given by log(p(observation belongs to object object_id) / p(observation is false positive or belongs to another object)) 00024 float32 object_support 00025 00026 # A string that contains the name or a description of the specific object 00027 string name 00028 00029 """ 00030 __slots__ = ['class_id','class_support','object_id','object_support','name'] 00031 _slot_types = ['string','float32','string','float32','string'] 00032 00033 def __init__(self, *args, **kwds): 00034 """ 00035 Constructor. Any message fields that are implicitly/explicitly 00036 set to None will be assigned a default value. The recommend 00037 use is keyword arguments as this is more robust to future message 00038 changes. You cannot mix in-order arguments and keyword arguments. 00039 00040 The available fields are: 00041 class_id,class_support,object_id,object_support,name 00042 00043 @param args: complete set of field values, in .msg order 00044 @param kwds: use keyword arguments corresponding to message field names 00045 to set specific fields. 00046 """ 00047 if args or kwds: 00048 super(PerceptInfo, self).__init__(*args, **kwds) 00049 #message fields cannot be None, assign default values for those that are 00050 if self.class_id is None: 00051 self.class_id = '' 00052 if self.class_support is None: 00053 self.class_support = 0. 00054 if self.object_id is None: 00055 self.object_id = '' 00056 if self.object_support is None: 00057 self.object_support = 0. 00058 if self.name is None: 00059 self.name = '' 00060 else: 00061 self.class_id = '' 00062 self.class_support = 0. 00063 self.object_id = '' 00064 self.object_support = 0. 00065 self.name = '' 00066 00067 def _get_types(self): 00068 """ 00069 internal API method 00070 """ 00071 return self._slot_types 00072 00073 def serialize(self, buff): 00074 """ 00075 serialize message into buffer 00076 @param buff: buffer 00077 @type buff: StringIO 00078 """ 00079 try: 00080 _x = self.class_id 00081 length = len(_x) 00082 buff.write(struct.pack('<I%ss'%length, length, _x)) 00083 buff.write(_struct_f.pack(self.class_support)) 00084 _x = self.object_id 00085 length = len(_x) 00086 buff.write(struct.pack('<I%ss'%length, length, _x)) 00087 buff.write(_struct_f.pack(self.object_support)) 00088 _x = self.name 00089 length = len(_x) 00090 buff.write(struct.pack('<I%ss'%length, length, _x)) 00091 except struct.error as se: self._check_types(se) 00092 except TypeError as te: self._check_types(te) 00093 00094 def deserialize(self, str): 00095 """ 00096 unpack serialized message in str into this message instance 00097 @param str: byte array of serialized message 00098 @type str: str 00099 """ 00100 try: 00101 end = 0 00102 start = end 00103 end += 4 00104 (length,) = _struct_I.unpack(str[start:end]) 00105 start = end 00106 end += length 00107 self.class_id = str[start:end] 00108 start = end 00109 end += 4 00110 (self.class_support,) = _struct_f.unpack(str[start:end]) 00111 start = end 00112 end += 4 00113 (length,) = _struct_I.unpack(str[start:end]) 00114 start = end 00115 end += length 00116 self.object_id = str[start:end] 00117 start = end 00118 end += 4 00119 (self.object_support,) = _struct_f.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.name = str[start:end] 00126 return self 00127 except struct.error as e: 00128 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00129 00130 00131 def serialize_numpy(self, buff, numpy): 00132 """ 00133 serialize message with numpy array types into buffer 00134 @param buff: buffer 00135 @type buff: StringIO 00136 @param numpy: numpy python module 00137 @type numpy module 00138 """ 00139 try: 00140 _x = self.class_id 00141 length = len(_x) 00142 buff.write(struct.pack('<I%ss'%length, length, _x)) 00143 buff.write(_struct_f.pack(self.class_support)) 00144 _x = self.object_id 00145 length = len(_x) 00146 buff.write(struct.pack('<I%ss'%length, length, _x)) 00147 buff.write(_struct_f.pack(self.object_support)) 00148 _x = self.name 00149 length = len(_x) 00150 buff.write(struct.pack('<I%ss'%length, length, _x)) 00151 except struct.error as se: self._check_types(se) 00152 except TypeError as te: self._check_types(te) 00153 00154 def deserialize_numpy(self, str, numpy): 00155 """ 00156 unpack serialized message in str into this message instance using numpy for array types 00157 @param str: byte array of serialized message 00158 @type str: str 00159 @param numpy: numpy python module 00160 @type numpy: module 00161 """ 00162 try: 00163 end = 0 00164 start = end 00165 end += 4 00166 (length,) = _struct_I.unpack(str[start:end]) 00167 start = end 00168 end += length 00169 self.class_id = str[start:end] 00170 start = end 00171 end += 4 00172 (self.class_support,) = _struct_f.unpack(str[start:end]) 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 start = end 00177 end += length 00178 self.object_id = str[start:end] 00179 start = end 00180 end += 4 00181 (self.object_support,) = _struct_f.unpack(str[start:end]) 00182 start = end 00183 end += 4 00184 (length,) = _struct_I.unpack(str[start:end]) 00185 start = end 00186 end += length 00187 self.name = str[start:end] 00188 return self 00189 except struct.error as e: 00190 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00191 00192 _struct_I = roslib.message.struct_I 00193 _struct_f = struct.Struct("<f")