00001 """autogenerated by genpy from pddl_msgs/PDDLProblem.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 pddl_msgs.msg
00008
00009 class PDDLProblem(genpy.Message):
00010 _md5sum = "7216b7591930e96836a3288534e695f6"
00011 _type = "pddl_msgs/PDDLProblem"
00012 _has_header = False
00013 _full_text = """string name # name of problem
00014 string domain # name of domain to use
00015 pddl_msgs/PDDLObject[] objects # how to represent type?
00016 string[] initial # initial condition
00017 string goal # goal conjunction
00018
00019 ================================================================================
00020 MSG: pddl_msgs/PDDLObject
00021 # definition of PDDLObject
00022 string name
00023 string type
00024
00025 """
00026 __slots__ = ['name','domain','objects','initial','goal']
00027 _slot_types = ['string','string','pddl_msgs/PDDLObject[]','string[]','string']
00028
00029 def __init__(self, *args, **kwds):
00030 """
00031 Constructor. Any message fields that are implicitly/explicitly
00032 set to None will be assigned a default value. The recommend
00033 use is keyword arguments as this is more robust to future message
00034 changes. You cannot mix in-order arguments and keyword arguments.
00035
00036 The available fields are:
00037 name,domain,objects,initial,goal
00038
00039 :param args: complete set of field values, in .msg order
00040 :param kwds: use keyword arguments corresponding to message field names
00041 to set specific fields.
00042 """
00043 if args or kwds:
00044 super(PDDLProblem, self).__init__(*args, **kwds)
00045
00046 if self.name is None:
00047 self.name = ''
00048 if self.domain is None:
00049 self.domain = ''
00050 if self.objects is None:
00051 self.objects = []
00052 if self.initial is None:
00053 self.initial = []
00054 if self.goal is None:
00055 self.goal = ''
00056 else:
00057 self.name = ''
00058 self.domain = ''
00059 self.objects = []
00060 self.initial = []
00061 self.goal = ''
00062
00063 def _get_types(self):
00064 """
00065 internal API method
00066 """
00067 return self._slot_types
00068
00069 def serialize(self, buff):
00070 """
00071 serialize message into buffer
00072 :param buff: buffer, ``StringIO``
00073 """
00074 try:
00075 _x = self.name
00076 length = len(_x)
00077 if python3 or type(_x) == unicode:
00078 _x = _x.encode('utf-8')
00079 length = len(_x)
00080 buff.write(struct.pack('<I%ss'%length, length, _x))
00081 _x = self.domain
00082 length = len(_x)
00083 if python3 or type(_x) == unicode:
00084 _x = _x.encode('utf-8')
00085 length = len(_x)
00086 buff.write(struct.pack('<I%ss'%length, length, _x))
00087 length = len(self.objects)
00088 buff.write(_struct_I.pack(length))
00089 for val1 in self.objects:
00090 _x = val1.name
00091 length = len(_x)
00092 if python3 or type(_x) == unicode:
00093 _x = _x.encode('utf-8')
00094 length = len(_x)
00095 buff.write(struct.pack('<I%ss'%length, length, _x))
00096 _x = val1.type
00097 length = len(_x)
00098 if python3 or type(_x) == unicode:
00099 _x = _x.encode('utf-8')
00100 length = len(_x)
00101 buff.write(struct.pack('<I%ss'%length, length, _x))
00102 length = len(self.initial)
00103 buff.write(_struct_I.pack(length))
00104 for val1 in self.initial:
00105 length = len(val1)
00106 if python3 or type(val1) == unicode:
00107 val1 = val1.encode('utf-8')
00108 length = len(val1)
00109 buff.write(struct.pack('<I%ss'%length, length, val1))
00110 _x = self.goal
00111 length = len(_x)
00112 if python3 or type(_x) == unicode:
00113 _x = _x.encode('utf-8')
00114 length = len(_x)
00115 buff.write(struct.pack('<I%ss'%length, length, _x))
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, ``str``
00123 """
00124 try:
00125 if self.objects is None:
00126 self.objects = None
00127 end = 0
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.name = str[start:end].decode('utf-8')
00135 else:
00136 self.name = str[start:end]
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 start = end
00141 end += length
00142 if python3:
00143 self.domain = str[start:end].decode('utf-8')
00144 else:
00145 self.domain = str[start:end]
00146 start = end
00147 end += 4
00148 (length,) = _struct_I.unpack(str[start:end])
00149 self.objects = []
00150 for i in range(0, length):
00151 val1 = pddl_msgs.msg.PDDLObject()
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 val1.name = str[start:end].decode('utf-8')
00159 else:
00160 val1.name = str[start:end]
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 start = end
00165 end += length
00166 if python3:
00167 val1.type = str[start:end].decode('utf-8')
00168 else:
00169 val1.type = str[start:end]
00170 self.objects.append(val1)
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 self.initial = []
00175 for i in range(0, length):
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 start = end
00180 end += length
00181 if python3:
00182 val1 = str[start:end].decode('utf-8')
00183 else:
00184 val1 = str[start:end]
00185 self.initial.append(val1)
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 start = end
00190 end += length
00191 if python3:
00192 self.goal = str[start:end].decode('utf-8')
00193 else:
00194 self.goal = str[start:end]
00195 return self
00196 except struct.error as e:
00197 raise genpy.DeserializationError(e)
00198
00199
00200 def serialize_numpy(self, buff, numpy):
00201 """
00202 serialize message with numpy array types into buffer
00203 :param buff: buffer, ``StringIO``
00204 :param numpy: numpy python module
00205 """
00206 try:
00207 _x = self.name
00208 length = len(_x)
00209 if python3 or type(_x) == unicode:
00210 _x = _x.encode('utf-8')
00211 length = len(_x)
00212 buff.write(struct.pack('<I%ss'%length, length, _x))
00213 _x = self.domain
00214 length = len(_x)
00215 if python3 or type(_x) == unicode:
00216 _x = _x.encode('utf-8')
00217 length = len(_x)
00218 buff.write(struct.pack('<I%ss'%length, length, _x))
00219 length = len(self.objects)
00220 buff.write(_struct_I.pack(length))
00221 for val1 in self.objects:
00222 _x = val1.name
00223 length = len(_x)
00224 if python3 or type(_x) == unicode:
00225 _x = _x.encode('utf-8')
00226 length = len(_x)
00227 buff.write(struct.pack('<I%ss'%length, length, _x))
00228 _x = val1.type
00229 length = len(_x)
00230 if python3 or type(_x) == unicode:
00231 _x = _x.encode('utf-8')
00232 length = len(_x)
00233 buff.write(struct.pack('<I%ss'%length, length, _x))
00234 length = len(self.initial)
00235 buff.write(_struct_I.pack(length))
00236 for val1 in self.initial:
00237 length = len(val1)
00238 if python3 or type(val1) == unicode:
00239 val1 = val1.encode('utf-8')
00240 length = len(val1)
00241 buff.write(struct.pack('<I%ss'%length, length, val1))
00242 _x = self.goal
00243 length = len(_x)
00244 if python3 or type(_x) == unicode:
00245 _x = _x.encode('utf-8')
00246 length = len(_x)
00247 buff.write(struct.pack('<I%ss'%length, length, _x))
00248 except struct.error as se: self._check_types(se)
00249 except TypeError as te: self._check_types(te)
00250
00251 def deserialize_numpy(self, str, numpy):
00252 """
00253 unpack serialized message in str into this message instance using numpy for array types
00254 :param str: byte array of serialized message, ``str``
00255 :param numpy: numpy python module
00256 """
00257 try:
00258 if self.objects is None:
00259 self.objects = None
00260 end = 0
00261 start = end
00262 end += 4
00263 (length,) = _struct_I.unpack(str[start:end])
00264 start = end
00265 end += length
00266 if python3:
00267 self.name = str[start:end].decode('utf-8')
00268 else:
00269 self.name = str[start:end]
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 start = end
00274 end += length
00275 if python3:
00276 self.domain = str[start:end].decode('utf-8')
00277 else:
00278 self.domain = str[start:end]
00279 start = end
00280 end += 4
00281 (length,) = _struct_I.unpack(str[start:end])
00282 self.objects = []
00283 for i in range(0, length):
00284 val1 = pddl_msgs.msg.PDDLObject()
00285 start = end
00286 end += 4
00287 (length,) = _struct_I.unpack(str[start:end])
00288 start = end
00289 end += length
00290 if python3:
00291 val1.name = str[start:end].decode('utf-8')
00292 else:
00293 val1.name = str[start:end]
00294 start = end
00295 end += 4
00296 (length,) = _struct_I.unpack(str[start:end])
00297 start = end
00298 end += length
00299 if python3:
00300 val1.type = str[start:end].decode('utf-8')
00301 else:
00302 val1.type = str[start:end]
00303 self.objects.append(val1)
00304 start = end
00305 end += 4
00306 (length,) = _struct_I.unpack(str[start:end])
00307 self.initial = []
00308 for i in range(0, length):
00309 start = end
00310 end += 4
00311 (length,) = _struct_I.unpack(str[start:end])
00312 start = end
00313 end += length
00314 if python3:
00315 val1 = str[start:end].decode('utf-8')
00316 else:
00317 val1 = str[start:end]
00318 self.initial.append(val1)
00319 start = end
00320 end += 4
00321 (length,) = _struct_I.unpack(str[start:end])
00322 start = end
00323 end += length
00324 if python3:
00325 self.goal = str[start:end].decode('utf-8')
00326 else:
00327 self.goal = str[start:end]
00328 return self
00329 except struct.error as e:
00330 raise genpy.DeserializationError(e)
00331
00332 _struct_I = genpy.struct_I