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


spline_smoother
Author(s): Mrinal Kalakrishnan / mail@mrinal.net
autogenerated on Thu Dec 12 2013 11:09:50