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


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