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