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