Go to the documentation of this file.00001 """autogenerated by genpy from chomp_motion_planner/JointVelocityArray.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 JointVelocityArray(genpy.Message):
00009 _md5sum = "cff01edca22ca4ffb45fd471f505b4c9"
00010 _type = "chomp_motion_planner/JointVelocityArray"
00011 _has_header = False
00012 _full_text = """# A list of joint names
00013 string[] joint_names
00014
00015 # Velocity for each of the above joints
00016 float64[] velocities
00017
00018 """
00019 __slots__ = ['joint_names','velocities']
00020 _slot_types = ['string[]','float64[]']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 joint_names,velocities
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(JointVelocityArray, self).__init__(*args, **kwds)
00038
00039 if self.joint_names is None:
00040 self.joint_names = []
00041 if self.velocities is None:
00042 self.velocities = []
00043 else:
00044 self.joint_names = []
00045 self.velocities = []
00046
00047 def _get_types(self):
00048 """
00049 internal API method
00050 """
00051 return self._slot_types
00052
00053 def serialize(self, buff):
00054 """
00055 serialize message into buffer
00056 :param buff: buffer, ``StringIO``
00057 """
00058 try:
00059 length = len(self.joint_names)
00060 buff.write(_struct_I.pack(length))
00061 for val1 in self.joint_names:
00062 length = len(val1)
00063 if python3 or type(val1) == unicode:
00064 val1 = val1.encode('utf-8')
00065 length = len(val1)
00066 buff.write(struct.pack('<I%ss'%length, length, val1))
00067 length = len(self.velocities)
00068 buff.write(_struct_I.pack(length))
00069 pattern = '<%sd'%length
00070 buff.write(struct.pack(pattern, *self.velocities))
00071 except struct.error as se: self._check_types(se)
00072 except TypeError as te: self._check_types(te)
00073
00074 def deserialize(self, str):
00075 """
00076 unpack serialized message in str into this message instance
00077 :param str: byte array of serialized message, ``str``
00078 """
00079 try:
00080 end = 0
00081 start = end
00082 end += 4
00083 (length,) = _struct_I.unpack(str[start:end])
00084 self.joint_names = []
00085 for i in range(0, length):
00086 start = end
00087 end += 4
00088 (length,) = _struct_I.unpack(str[start:end])
00089 start = end
00090 end += length
00091 if python3:
00092 val1 = str[start:end].decode('utf-8')
00093 else:
00094 val1 = str[start:end]
00095 self.joint_names.append(val1)
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 self.velocities = struct.unpack(pattern, str[start:end])
00103 return self
00104 except struct.error as e:
00105 raise genpy.DeserializationError(e)
00106
00107
00108 def serialize_numpy(self, buff, numpy):
00109 """
00110 serialize message with numpy array types into buffer
00111 :param buff: buffer, ``StringIO``
00112 :param numpy: numpy python module
00113 """
00114 try:
00115 length = len(self.joint_names)
00116 buff.write(_struct_I.pack(length))
00117 for val1 in self.joint_names:
00118 length = len(val1)
00119 if python3 or type(val1) == unicode:
00120 val1 = val1.encode('utf-8')
00121 length = len(val1)
00122 buff.write(struct.pack('<I%ss'%length, length, val1))
00123 length = len(self.velocities)
00124 buff.write(_struct_I.pack(length))
00125 pattern = '<%sd'%length
00126 buff.write(self.velocities.tostring())
00127 except struct.error as se: self._check_types(se)
00128 except TypeError as te: self._check_types(te)
00129
00130 def deserialize_numpy(self, str, numpy):
00131 """
00132 unpack serialized message in str into this message instance using numpy for array types
00133 :param str: byte array of serialized message, ``str``
00134 :param numpy: numpy python module
00135 """
00136 try:
00137 end = 0
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 self.joint_names = []
00142 for i in range(0, length):
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 start = end
00147 end += length
00148 if python3:
00149 val1 = str[start:end].decode('utf-8')
00150 else:
00151 val1 = str[start:end]
00152 self.joint_names.append(val1)
00153 start = end
00154 end += 4
00155 (length,) = _struct_I.unpack(str[start:end])
00156 pattern = '<%sd'%length
00157 start = end
00158 end += struct.calcsize(pattern)
00159 self.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00160 return self
00161 except struct.error as e:
00162 raise genpy.DeserializationError(e)
00163
00164 _struct_I = genpy.struct_I