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