00001 """autogenerated by genmsg_py from SplineTrajectorySegment.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006 import spline_smoother.msg
00007
00008 class SplineTrajectorySegment(roslib.message.Message):
00009 _md5sum = "1c95257e91547459aede67dd02a209d6"
00010 _type = "spline_smoother/SplineTrajectorySegment"
00011 _has_header = False
00012 _full_text = """duration duration
00013 SplineCoefficients[] joints
00014
00015 ================================================================================
00016 MSG: spline_smoother/SplineCoefficients
00017 float64[] coefficients
00018
00019 """
00020 __slots__ = ['duration','joints']
00021 _slot_types = ['duration','spline_smoother/SplineCoefficients[]']
00022
00023 def __init__(self, *args, **kwds):
00024 """
00025 Constructor. Any message fields that are implicitly/explicitly
00026 set to None will be assigned a default value. The recommend
00027 use is keyword arguments as this is more robust to future message
00028 changes. You cannot mix in-order arguments and keyword arguments.
00029
00030 The available fields are:
00031 duration,joints
00032
00033 @param args: complete set of field values, in .msg order
00034 @param kwds: use keyword arguments corresponding to message field names
00035 to set specific fields.
00036 """
00037 if args or kwds:
00038 super(SplineTrajectorySegment, self).__init__(*args, **kwds)
00039
00040 if self.duration is None:
00041 self.duration = roslib.rostime.Duration()
00042 if self.joints is None:
00043 self.joints = []
00044 else:
00045 self.duration = roslib.rostime.Duration()
00046 self.joints = []
00047
00048 def _get_types(self):
00049 """
00050 internal API method
00051 """
00052 return self._slot_types
00053
00054 def serialize(self, buff):
00055 """
00056 serialize message into buffer
00057 @param buff: buffer
00058 @type buff: StringIO
00059 """
00060 try:
00061 _x = self
00062 buff.write(_struct_2i.pack(_x.duration.secs, _x.duration.nsecs))
00063 length = len(self.joints)
00064 buff.write(_struct_I.pack(length))
00065 for val1 in self.joints:
00066 length = len(val1.coefficients)
00067 buff.write(_struct_I.pack(length))
00068 pattern = '<%sd'%length
00069 buff.write(struct.pack(pattern, *val1.coefficients))
00070 except struct.error, se: self._check_types(se)
00071 except TypeError, te: self._check_types(te)
00072
00073 def deserialize(self, str):
00074 """
00075 unpack serialized message in str into this message instance
00076 @param str: byte array of serialized message
00077 @type str: str
00078 """
00079 try:
00080 if self.duration is None:
00081 self.duration = roslib.rostime.Duration()
00082 end = 0
00083 _x = self
00084 start = end
00085 end += 8
00086 (_x.duration.secs, _x.duration.nsecs,) = _struct_2i.unpack(str[start:end])
00087 start = end
00088 end += 4
00089 (length,) = _struct_I.unpack(str[start:end])
00090 self.joints = []
00091 for i in xrange(0, length):
00092 val1 = spline_smoother.msg.SplineCoefficients()
00093 start = end
00094 end += 4
00095 (length,) = _struct_I.unpack(str[start:end])
00096 pattern = '<%sd'%length
00097 start = end
00098 end += struct.calcsize(pattern)
00099 val1.coefficients = struct.unpack(pattern, str[start:end])
00100 self.joints.append(val1)
00101 self.duration.canon()
00102 return self
00103 except struct.error, e:
00104 raise roslib.message.DeserializationError(e)
00105
00106
00107 def serialize_numpy(self, buff, numpy):
00108 """
00109 serialize message with numpy array types into buffer
00110 @param buff: buffer
00111 @type buff: StringIO
00112 @param numpy: numpy python module
00113 @type numpy 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, se: self._check_types(se)
00126 except TypeError, 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
00132 @type str: str
00133 @param numpy: numpy python module
00134 @type numpy: module
00135 """
00136 try:
00137 if self.duration is None:
00138 self.duration = roslib.rostime.Duration()
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 xrange(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, e:
00161 raise roslib.message.DeserializationError(e)
00162
00163 _struct_I = roslib.message.struct_I
00164 _struct_2i = struct.Struct("<2i")