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