_TemporalAction.py
Go to the documentation of this file.
00001 """autogenerated by genpy from continual_planning_executive/TemporalAction.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 TemporalAction(genpy.Message):
00009   _md5sum = "4459ed42ceee13751cbc59af8668f073"
00010   _type = "continual_planning_executive/TemporalAction"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string name
00013 string[] parameters
00014 float64 start_time
00015 float64 duration
00016 
00017 """
00018   __slots__ = ['name','parameters','start_time','duration']
00019   _slot_types = ['string','string[]','float64','float64']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        name,parameters,start_time,duration
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(TemporalAction, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.name is None:
00039         self.name = ''
00040       if self.parameters is None:
00041         self.parameters = []
00042       if self.start_time is None:
00043         self.start_time = 0.
00044       if self.duration is None:
00045         self.duration = 0.
00046     else:
00047       self.name = ''
00048       self.parameters = []
00049       self.start_time = 0.
00050       self.duration = 0.
00051 
00052   def _get_types(self):
00053     """
00054     internal API method
00055     """
00056     return self._slot_types
00057 
00058   def serialize(self, buff):
00059     """
00060     serialize message into buffer
00061     :param buff: buffer, ``StringIO``
00062     """
00063     try:
00064       _x = self.name
00065       length = len(_x)
00066       if python3 or type(_x) == unicode:
00067         _x = _x.encode('utf-8')
00068         length = len(_x)
00069       buff.write(struct.pack('<I%ss'%length, length, _x))
00070       length = len(self.parameters)
00071       buff.write(_struct_I.pack(length))
00072       for val1 in self.parameters:
00073         length = len(val1)
00074         if python3 or type(val1) == unicode:
00075           val1 = val1.encode('utf-8')
00076           length = len(val1)
00077         buff.write(struct.pack('<I%ss'%length, length, val1))
00078       _x = self
00079       buff.write(_struct_2d.pack(_x.start_time, _x.duration))
00080     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00081     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00082 
00083   def deserialize(self, str):
00084     """
00085     unpack serialized message in str into this message instance
00086     :param str: byte array of serialized message, ``str``
00087     """
00088     try:
00089       end = 0
00090       start = end
00091       end += 4
00092       (length,) = _struct_I.unpack(str[start:end])
00093       start = end
00094       end += length
00095       if python3:
00096         self.name = str[start:end].decode('utf-8')
00097       else:
00098         self.name = str[start:end]
00099       start = end
00100       end += 4
00101       (length,) = _struct_I.unpack(str[start:end])
00102       self.parameters = []
00103       for i in range(0, length):
00104         start = end
00105         end += 4
00106         (length,) = _struct_I.unpack(str[start:end])
00107         start = end
00108         end += length
00109         if python3:
00110           val1 = str[start:end].decode('utf-8')
00111         else:
00112           val1 = str[start:end]
00113         self.parameters.append(val1)
00114       _x = self
00115       start = end
00116       end += 16
00117       (_x.start_time, _x.duration,) = _struct_2d.unpack(str[start:end])
00118       return self
00119     except struct.error as e:
00120       raise genpy.DeserializationError(e) #most likely buffer underfill
00121 
00122 
00123   def serialize_numpy(self, buff, numpy):
00124     """
00125     serialize message with numpy array types into buffer
00126     :param buff: buffer, ``StringIO``
00127     :param numpy: numpy python module
00128     """
00129     try:
00130       _x = self.name
00131       length = len(_x)
00132       if python3 or type(_x) == unicode:
00133         _x = _x.encode('utf-8')
00134         length = len(_x)
00135       buff.write(struct.pack('<I%ss'%length, length, _x))
00136       length = len(self.parameters)
00137       buff.write(_struct_I.pack(length))
00138       for val1 in self.parameters:
00139         length = len(val1)
00140         if python3 or type(val1) == unicode:
00141           val1 = val1.encode('utf-8')
00142           length = len(val1)
00143         buff.write(struct.pack('<I%ss'%length, length, val1))
00144       _x = self
00145       buff.write(_struct_2d.pack(_x.start_time, _x.duration))
00146     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148 
00149   def deserialize_numpy(self, str, numpy):
00150     """
00151     unpack serialized message in str into this message instance using numpy for array types
00152     :param str: byte array of serialized message, ``str``
00153     :param numpy: numpy python module
00154     """
00155     try:
00156       end = 0
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       start = end
00161       end += length
00162       if python3:
00163         self.name = str[start:end].decode('utf-8')
00164       else:
00165         self.name = str[start:end]
00166       start = end
00167       end += 4
00168       (length,) = _struct_I.unpack(str[start:end])
00169       self.parameters = []
00170       for i in range(0, length):
00171         start = end
00172         end += 4
00173         (length,) = _struct_I.unpack(str[start:end])
00174         start = end
00175         end += length
00176         if python3:
00177           val1 = str[start:end].decode('utf-8')
00178         else:
00179           val1 = str[start:end]
00180         self.parameters.append(val1)
00181       _x = self
00182       start = end
00183       end += 16
00184       (_x.start_time, _x.duration,) = _struct_2d.unpack(str[start:end])
00185       return self
00186     except struct.error as e:
00187       raise genpy.DeserializationError(e) #most likely buffer underfill
00188 
00189 _struct_I = genpy.struct_I
00190 _struct_2d = struct.Struct("<2d")


continual_planning_executive
Author(s): Christian Dornhege
autogenerated on Mon Oct 6 2014 07:51:56