Go to the documentation of this file.00001 """autogenerated by genpy from dmp/DMPPoint.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 DMPPoint(genpy.Message):
00009 _md5sum = "f32a98450510f8ae05fae28f45d6e99a"
00010 _type = "dmp/DMPPoint"
00011 _has_header = False
00012 _full_text = """# Positions and velocities of DOFs
00013 #Velocity is only used for movement plans, not for giving demonstrations.
00014 float64[] positions
00015 float64[] velocities
00016
00017
00018
00019 """
00020 __slots__ = ['positions','velocities']
00021 _slot_types = ['float64[]','float64[]']
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 positions,velocities
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(DMPPoint, self).__init__(*args, **kwds)
00039
00040 if self.positions is None:
00041 self.positions = []
00042 if self.velocities is None:
00043 self.velocities = []
00044 else:
00045 self.positions = []
00046 self.velocities = []
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, ``StringIO``
00058 """
00059 try:
00060 length = len(self.positions)
00061 buff.write(_struct_I.pack(length))
00062 pattern = '<%sd'%length
00063 buff.write(struct.pack(pattern, *self.positions))
00064 length = len(self.velocities)
00065 buff.write(_struct_I.pack(length))
00066 pattern = '<%sd'%length
00067 buff.write(struct.pack(pattern, *self.velocities))
00068 except struct.error as se: self._check_types(se)
00069 except TypeError as te: self._check_types(te)
00070
00071 def deserialize(self, str):
00072 """
00073 unpack serialized message in str into this message instance
00074 :param str: byte array of serialized message, ``str``
00075 """
00076 try:
00077 end = 0
00078 start = end
00079 end += 4
00080 (length,) = _struct_I.unpack(str[start:end])
00081 pattern = '<%sd'%length
00082 start = end
00083 end += struct.calcsize(pattern)
00084 self.positions = struct.unpack(pattern, str[start:end])
00085 start = end
00086 end += 4
00087 (length,) = _struct_I.unpack(str[start:end])
00088 pattern = '<%sd'%length
00089 start = end
00090 end += struct.calcsize(pattern)
00091 self.velocities = struct.unpack(pattern, str[start:end])
00092 return self
00093 except struct.error as e:
00094 raise genpy.DeserializationError(e)
00095
00096
00097 def serialize_numpy(self, buff, numpy):
00098 """
00099 serialize message with numpy array types into buffer
00100 :param buff: buffer, ``StringIO``
00101 :param numpy: numpy python module
00102 """
00103 try:
00104 length = len(self.positions)
00105 buff.write(_struct_I.pack(length))
00106 pattern = '<%sd'%length
00107 buff.write(self.positions.tostring())
00108 length = len(self.velocities)
00109 buff.write(_struct_I.pack(length))
00110 pattern = '<%sd'%length
00111 buff.write(self.velocities.tostring())
00112 except struct.error as se: self._check_types(se)
00113 except TypeError as te: self._check_types(te)
00114
00115 def deserialize_numpy(self, str, numpy):
00116 """
00117 unpack serialized message in str into this message instance using numpy for array types
00118 :param str: byte array of serialized message, ``str``
00119 :param numpy: numpy python module
00120 """
00121 try:
00122 end = 0
00123 start = end
00124 end += 4
00125 (length,) = _struct_I.unpack(str[start:end])
00126 pattern = '<%sd'%length
00127 start = end
00128 end += struct.calcsize(pattern)
00129 self.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00130 start = end
00131 end += 4
00132 (length,) = _struct_I.unpack(str[start:end])
00133 pattern = '<%sd'%length
00134 start = end
00135 end += struct.calcsize(pattern)
00136 self.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00137 return self
00138 except struct.error as e:
00139 raise genpy.DeserializationError(e)
00140
00141 _struct_I = genpy.struct_I