_Trajectory.py
Go to the documentation of this file.
00001 """autogenerated by genpy from openraveros/Trajectory.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 openraveros.msg
00008 
00009 class Trajectory(genpy.Message):
00010   _md5sum = "56e2013b47eeba891e94a2ed372e1604"
00011   _type = "openraveros/Trajectory"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """ConfigurationSpecification spec
00014 float64[] points
00015 string xmlid
00016 
00017 ================================================================================
00018 MSG: openraveros/ConfigurationSpecification
00019 ConfigurationSpecificationGroup[] groups
00020 
00021 ================================================================================
00022 MSG: openraveros/ConfigurationSpecificationGroup
00023 int32 offset
00024 int32 dof
00025 string name
00026 string interpolation
00027 
00028 """
00029   __slots__ = ['spec','points','xmlid']
00030   _slot_types = ['openraveros/ConfigurationSpecification','float64[]','string']
00031 
00032   def __init__(self, *args, **kwds):
00033     """
00034     Constructor. Any message fields that are implicitly/explicitly
00035     set to None will be assigned a default value. The recommend
00036     use is keyword arguments as this is more robust to future message
00037     changes.  You cannot mix in-order arguments and keyword arguments.
00038 
00039     The available fields are:
00040        spec,points,xmlid
00041 
00042     :param args: complete set of field values, in .msg order
00043     :param kwds: use keyword arguments corresponding to message field names
00044     to set specific fields.
00045     """
00046     if args or kwds:
00047       super(Trajectory, self).__init__(*args, **kwds)
00048       #message fields cannot be None, assign default values for those that are
00049       if self.spec is None:
00050         self.spec = openraveros.msg.ConfigurationSpecification()
00051       if self.points is None:
00052         self.points = []
00053       if self.xmlid is None:
00054         self.xmlid = ''
00055     else:
00056       self.spec = openraveros.msg.ConfigurationSpecification()
00057       self.points = []
00058       self.xmlid = ''
00059 
00060   def _get_types(self):
00061     """
00062     internal API method
00063     """
00064     return self._slot_types
00065 
00066   def serialize(self, buff):
00067     """
00068     serialize message into buffer
00069     :param buff: buffer, ``StringIO``
00070     """
00071     try:
00072       length = len(self.spec.groups)
00073       buff.write(_struct_I.pack(length))
00074       for val1 in self.spec.groups:
00075         _x = val1
00076         buff.write(_struct_2i.pack(_x.offset, _x.dof))
00077         _x = val1.name
00078         length = len(_x)
00079         if python3 or type(_x) == unicode:
00080           _x = _x.encode('utf-8')
00081           length = len(_x)
00082         buff.write(struct.pack('<I%ss'%length, length, _x))
00083         _x = val1.interpolation
00084         length = len(_x)
00085         if python3 or type(_x) == unicode:
00086           _x = _x.encode('utf-8')
00087           length = len(_x)
00088         buff.write(struct.pack('<I%ss'%length, length, _x))
00089       length = len(self.points)
00090       buff.write(_struct_I.pack(length))
00091       pattern = '<%sd'%length
00092       buff.write(struct.pack(pattern, *self.points))
00093       _x = self.xmlid
00094       length = len(_x)
00095       if python3 or type(_x) == unicode:
00096         _x = _x.encode('utf-8')
00097         length = len(_x)
00098       buff.write(struct.pack('<I%ss'%length, length, _x))
00099     except struct.error as se: self._check_types(se)
00100     except TypeError as te: self._check_types(te)
00101 
00102   def deserialize(self, str):
00103     """
00104     unpack serialized message in str into this message instance
00105     :param str: byte array of serialized message, ``str``
00106     """
00107     try:
00108       if self.spec is None:
00109         self.spec = openraveros.msg.ConfigurationSpecification()
00110       end = 0
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       self.spec.groups = []
00115       for i in range(0, length):
00116         val1 = openraveros.msg.ConfigurationSpecificationGroup()
00117         _x = val1
00118         start = end
00119         end += 8
00120         (_x.offset, _x.dof,) = _struct_2i.unpack(str[start:end])
00121         start = end
00122         end += 4
00123         (length,) = _struct_I.unpack(str[start:end])
00124         start = end
00125         end += length
00126         if python3:
00127           val1.name = str[start:end].decode('utf-8')
00128         else:
00129           val1.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         if python3:
00136           val1.interpolation = str[start:end].decode('utf-8')
00137         else:
00138           val1.interpolation = str[start:end]
00139         self.spec.groups.append(val1)
00140       start = end
00141       end += 4
00142       (length,) = _struct_I.unpack(str[start:end])
00143       pattern = '<%sd'%length
00144       start = end
00145       end += struct.calcsize(pattern)
00146       self.points = struct.unpack(pattern, str[start:end])
00147       start = end
00148       end += 4
00149       (length,) = _struct_I.unpack(str[start:end])
00150       start = end
00151       end += length
00152       if python3:
00153         self.xmlid = str[start:end].decode('utf-8')
00154       else:
00155         self.xmlid = str[start:end]
00156       return self
00157     except struct.error as e:
00158       raise genpy.DeserializationError(e) #most likely buffer underfill
00159 
00160 
00161   def serialize_numpy(self, buff, numpy):
00162     """
00163     serialize message with numpy array types into buffer
00164     :param buff: buffer, ``StringIO``
00165     :param numpy: numpy python module
00166     """
00167     try:
00168       length = len(self.spec.groups)
00169       buff.write(_struct_I.pack(length))
00170       for val1 in self.spec.groups:
00171         _x = val1
00172         buff.write(_struct_2i.pack(_x.offset, _x.dof))
00173         _x = val1.name
00174         length = len(_x)
00175         if python3 or type(_x) == unicode:
00176           _x = _x.encode('utf-8')
00177           length = len(_x)
00178         buff.write(struct.pack('<I%ss'%length, length, _x))
00179         _x = val1.interpolation
00180         length = len(_x)
00181         if python3 or type(_x) == unicode:
00182           _x = _x.encode('utf-8')
00183           length = len(_x)
00184         buff.write(struct.pack('<I%ss'%length, length, _x))
00185       length = len(self.points)
00186       buff.write(_struct_I.pack(length))
00187       pattern = '<%sd'%length
00188       buff.write(self.points.tostring())
00189       _x = self.xmlid
00190       length = len(_x)
00191       if python3 or type(_x) == unicode:
00192         _x = _x.encode('utf-8')
00193         length = len(_x)
00194       buff.write(struct.pack('<I%ss'%length, length, _x))
00195     except struct.error as se: self._check_types(se)
00196     except TypeError as te: self._check_types(te)
00197 
00198   def deserialize_numpy(self, str, numpy):
00199     """
00200     unpack serialized message in str into this message instance using numpy for array types
00201     :param str: byte array of serialized message, ``str``
00202     :param numpy: numpy python module
00203     """
00204     try:
00205       if self.spec is None:
00206         self.spec = openraveros.msg.ConfigurationSpecification()
00207       end = 0
00208       start = end
00209       end += 4
00210       (length,) = _struct_I.unpack(str[start:end])
00211       self.spec.groups = []
00212       for i in range(0, length):
00213         val1 = openraveros.msg.ConfigurationSpecificationGroup()
00214         _x = val1
00215         start = end
00216         end += 8
00217         (_x.offset, _x.dof,) = _struct_2i.unpack(str[start:end])
00218         start = end
00219         end += 4
00220         (length,) = _struct_I.unpack(str[start:end])
00221         start = end
00222         end += length
00223         if python3:
00224           val1.name = str[start:end].decode('utf-8')
00225         else:
00226           val1.name = str[start:end]
00227         start = end
00228         end += 4
00229         (length,) = _struct_I.unpack(str[start:end])
00230         start = end
00231         end += length
00232         if python3:
00233           val1.interpolation = str[start:end].decode('utf-8')
00234         else:
00235           val1.interpolation = str[start:end]
00236         self.spec.groups.append(val1)
00237       start = end
00238       end += 4
00239       (length,) = _struct_I.unpack(str[start:end])
00240       pattern = '<%sd'%length
00241       start = end
00242       end += struct.calcsize(pattern)
00243       self.points = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00244       start = end
00245       end += 4
00246       (length,) = _struct_I.unpack(str[start:end])
00247       start = end
00248       end += length
00249       if python3:
00250         self.xmlid = str[start:end].decode('utf-8')
00251       else:
00252         self.xmlid = str[start:end]
00253       return self
00254     except struct.error as e:
00255       raise genpy.DeserializationError(e) #most likely buffer underfill
00256 
00257 _struct_I = genpy.struct_I
00258 _struct_2i = struct.Struct("<2i")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


openraveros
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 22:15:39