$search
00001 """autogenerated by genmsg_py from PerceptionAction.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import srs_knowledge.msg 00006 00007 class PerceptionAction(roslib.message.Message): 00008 _md5sum = "815ae920af48073fc94b8835cc3d5ea6" 00009 _type = "srs_knowledge/PerceptionAction" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# if detect an object or a class: object:class:none 00012 string detectType 00013 00014 ABoxObject aboxObject 00015 TBoxObject tboxClass 00016 ================================================================================ 00017 MSG: srs_knowledge/ABoxObject 00018 int32 object_id 00019 string name 00020 string description 00021 00022 ================================================================================ 00023 MSG: srs_knowledge/TBoxObject 00024 int32 class_id 00025 string name 00026 string description 00027 string[] properties 00028 int32[] subjects 00029 """ 00030 __slots__ = ['detectType','aboxObject','tboxClass'] 00031 _slot_types = ['string','srs_knowledge/ABoxObject','srs_knowledge/TBoxObject'] 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 detectType,aboxObject,tboxClass 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(PerceptionAction, self).__init__(*args, **kwds) 00049 #message fields cannot be None, assign default values for those that are 00050 if self.detectType is None: 00051 self.detectType = '' 00052 if self.aboxObject is None: 00053 self.aboxObject = srs_knowledge.msg.ABoxObject() 00054 if self.tboxClass is None: 00055 self.tboxClass = srs_knowledge.msg.TBoxObject() 00056 else: 00057 self.detectType = '' 00058 self.aboxObject = srs_knowledge.msg.ABoxObject() 00059 self.tboxClass = srs_knowledge.msg.TBoxObject() 00060 00061 def _get_types(self): 00062 """ 00063 internal API method 00064 """ 00065 return self._slot_types 00066 00067 def serialize(self, buff): 00068 """ 00069 serialize message into buffer 00070 @param buff: buffer 00071 @type buff: StringIO 00072 """ 00073 try: 00074 _x = self.detectType 00075 length = len(_x) 00076 buff.write(struct.pack('<I%ss'%length, length, _x)) 00077 buff.write(_struct_i.pack(self.aboxObject.object_id)) 00078 _x = self.aboxObject.name 00079 length = len(_x) 00080 buff.write(struct.pack('<I%ss'%length, length, _x)) 00081 _x = self.aboxObject.description 00082 length = len(_x) 00083 buff.write(struct.pack('<I%ss'%length, length, _x)) 00084 buff.write(_struct_i.pack(self.tboxClass.class_id)) 00085 _x = self.tboxClass.name 00086 length = len(_x) 00087 buff.write(struct.pack('<I%ss'%length, length, _x)) 00088 _x = self.tboxClass.description 00089 length = len(_x) 00090 buff.write(struct.pack('<I%ss'%length, length, _x)) 00091 length = len(self.tboxClass.properties) 00092 buff.write(_struct_I.pack(length)) 00093 for val1 in self.tboxClass.properties: 00094 length = len(val1) 00095 buff.write(struct.pack('<I%ss'%length, length, val1)) 00096 length = len(self.tboxClass.subjects) 00097 buff.write(_struct_I.pack(length)) 00098 pattern = '<%si'%length 00099 buff.write(struct.pack(pattern, *self.tboxClass.subjects)) 00100 except struct.error as se: self._check_types(se) 00101 except TypeError as te: self._check_types(te) 00102 00103 def deserialize(self, str): 00104 """ 00105 unpack serialized message in str into this message instance 00106 @param str: byte array of serialized message 00107 @type str: str 00108 """ 00109 try: 00110 if self.aboxObject is None: 00111 self.aboxObject = srs_knowledge.msg.ABoxObject() 00112 if self.tboxClass is None: 00113 self.tboxClass = srs_knowledge.msg.TBoxObject() 00114 end = 0 00115 start = end 00116 end += 4 00117 (length,) = _struct_I.unpack(str[start:end]) 00118 start = end 00119 end += length 00120 self.detectType = str[start:end] 00121 start = end 00122 end += 4 00123 (self.aboxObject.object_id,) = _struct_i.unpack(str[start:end]) 00124 start = end 00125 end += 4 00126 (length,) = _struct_I.unpack(str[start:end]) 00127 start = end 00128 end += length 00129 self.aboxObject.name = 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.aboxObject.description = str[start:end] 00136 start = end 00137 end += 4 00138 (self.tboxClass.class_id,) = _struct_i.unpack(str[start:end]) 00139 start = end 00140 end += 4 00141 (length,) = _struct_I.unpack(str[start:end]) 00142 start = end 00143 end += length 00144 self.tboxClass.name = str[start:end] 00145 start = end 00146 end += 4 00147 (length,) = _struct_I.unpack(str[start:end]) 00148 start = end 00149 end += length 00150 self.tboxClass.description = str[start:end] 00151 start = end 00152 end += 4 00153 (length,) = _struct_I.unpack(str[start:end]) 00154 self.tboxClass.properties = [] 00155 for i in range(0, length): 00156 start = end 00157 end += 4 00158 (length,) = _struct_I.unpack(str[start:end]) 00159 start = end 00160 end += length 00161 val1 = str[start:end] 00162 self.tboxClass.properties.append(val1) 00163 start = end 00164 end += 4 00165 (length,) = _struct_I.unpack(str[start:end]) 00166 pattern = '<%si'%length 00167 start = end 00168 end += struct.calcsize(pattern) 00169 self.tboxClass.subjects = struct.unpack(pattern, str[start:end]) 00170 return self 00171 except struct.error as e: 00172 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00173 00174 00175 def serialize_numpy(self, buff, numpy): 00176 """ 00177 serialize message with numpy array types into buffer 00178 @param buff: buffer 00179 @type buff: StringIO 00180 @param numpy: numpy python module 00181 @type numpy module 00182 """ 00183 try: 00184 _x = self.detectType 00185 length = len(_x) 00186 buff.write(struct.pack('<I%ss'%length, length, _x)) 00187 buff.write(_struct_i.pack(self.aboxObject.object_id)) 00188 _x = self.aboxObject.name 00189 length = len(_x) 00190 buff.write(struct.pack('<I%ss'%length, length, _x)) 00191 _x = self.aboxObject.description 00192 length = len(_x) 00193 buff.write(struct.pack('<I%ss'%length, length, _x)) 00194 buff.write(_struct_i.pack(self.tboxClass.class_id)) 00195 _x = self.tboxClass.name 00196 length = len(_x) 00197 buff.write(struct.pack('<I%ss'%length, length, _x)) 00198 _x = self.tboxClass.description 00199 length = len(_x) 00200 buff.write(struct.pack('<I%ss'%length, length, _x)) 00201 length = len(self.tboxClass.properties) 00202 buff.write(_struct_I.pack(length)) 00203 for val1 in self.tboxClass.properties: 00204 length = len(val1) 00205 buff.write(struct.pack('<I%ss'%length, length, val1)) 00206 length = len(self.tboxClass.subjects) 00207 buff.write(_struct_I.pack(length)) 00208 pattern = '<%si'%length 00209 buff.write(self.tboxClass.subjects.tostring()) 00210 except struct.error as se: self._check_types(se) 00211 except TypeError as te: self._check_types(te) 00212 00213 def deserialize_numpy(self, str, numpy): 00214 """ 00215 unpack serialized message in str into this message instance using numpy for array types 00216 @param str: byte array of serialized message 00217 @type str: str 00218 @param numpy: numpy python module 00219 @type numpy: module 00220 """ 00221 try: 00222 if self.aboxObject is None: 00223 self.aboxObject = srs_knowledge.msg.ABoxObject() 00224 if self.tboxClass is None: 00225 self.tboxClass = srs_knowledge.msg.TBoxObject() 00226 end = 0 00227 start = end 00228 end += 4 00229 (length,) = _struct_I.unpack(str[start:end]) 00230 start = end 00231 end += length 00232 self.detectType = str[start:end] 00233 start = end 00234 end += 4 00235 (self.aboxObject.object_id,) = _struct_i.unpack(str[start:end]) 00236 start = end 00237 end += 4 00238 (length,) = _struct_I.unpack(str[start:end]) 00239 start = end 00240 end += length 00241 self.aboxObject.name = str[start:end] 00242 start = end 00243 end += 4 00244 (length,) = _struct_I.unpack(str[start:end]) 00245 start = end 00246 end += length 00247 self.aboxObject.description = str[start:end] 00248 start = end 00249 end += 4 00250 (self.tboxClass.class_id,) = _struct_i.unpack(str[start:end]) 00251 start = end 00252 end += 4 00253 (length,) = _struct_I.unpack(str[start:end]) 00254 start = end 00255 end += length 00256 self.tboxClass.name = str[start:end] 00257 start = end 00258 end += 4 00259 (length,) = _struct_I.unpack(str[start:end]) 00260 start = end 00261 end += length 00262 self.tboxClass.description = str[start:end] 00263 start = end 00264 end += 4 00265 (length,) = _struct_I.unpack(str[start:end]) 00266 self.tboxClass.properties = [] 00267 for i in range(0, length): 00268 start = end 00269 end += 4 00270 (length,) = _struct_I.unpack(str[start:end]) 00271 start = end 00272 end += length 00273 val1 = str[start:end] 00274 self.tboxClass.properties.append(val1) 00275 start = end 00276 end += 4 00277 (length,) = _struct_I.unpack(str[start:end]) 00278 pattern = '<%si'%length 00279 start = end 00280 end += struct.calcsize(pattern) 00281 self.tboxClass.subjects = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length) 00282 return self 00283 except struct.error as e: 00284 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00285 00286 _struct_I = roslib.message.struct_I 00287 _struct_i = struct.Struct("<i")