$search
00001 """autogenerated by genmsg_py from JointAnglesWithSpeed.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class JointAnglesWithSpeed(roslib.message.Message): 00008 _md5sum = "052ca11f74a00ad6745dfff6ebc2b4d8" 00009 _type = "nao_msgs/JointAnglesWithSpeed" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 00013 # A list of joint names, corresponding to their names in the Nao docs. 00014 # This must be either the same lenght of joint_angles or 1 if it's a 00015 # keyword such as 'Body' (for all angles) 00016 string[] joint_names 00017 float32[] joint_angles 00018 00019 #fraction of max joint velocity [0:1] 00020 float32 speed 00021 00022 # Absolute angle(=0, default) or relative change 00023 uint8 relative 00024 00025 ================================================================================ 00026 MSG: std_msgs/Header 00027 # Standard metadata for higher-level stamped data types. 00028 # This is generally used to communicate timestamped data 00029 # in a particular coordinate frame. 00030 # 00031 # sequence ID: consecutively increasing ID 00032 uint32 seq 00033 #Two-integer timestamp that is expressed as: 00034 # * stamp.secs: seconds (stamp_secs) since epoch 00035 # * stamp.nsecs: nanoseconds since stamp_secs 00036 # time-handling sugar is provided by the client library 00037 time stamp 00038 #Frame this data is associated with 00039 # 0: no frame 00040 # 1: global frame 00041 string frame_id 00042 00043 """ 00044 __slots__ = ['header','joint_names','joint_angles','speed','relative'] 00045 _slot_types = ['Header','string[]','float32[]','float32','uint8'] 00046 00047 def __init__(self, *args, **kwds): 00048 """ 00049 Constructor. Any message fields that are implicitly/explicitly 00050 set to None will be assigned a default value. The recommend 00051 use is keyword arguments as this is more robust to future message 00052 changes. You cannot mix in-order arguments and keyword arguments. 00053 00054 The available fields are: 00055 header,joint_names,joint_angles,speed,relative 00056 00057 @param args: complete set of field values, in .msg order 00058 @param kwds: use keyword arguments corresponding to message field names 00059 to set specific fields. 00060 """ 00061 if args or kwds: 00062 super(JointAnglesWithSpeed, self).__init__(*args, **kwds) 00063 #message fields cannot be None, assign default values for those that are 00064 if self.header is None: 00065 self.header = std_msgs.msg._Header.Header() 00066 if self.joint_names is None: 00067 self.joint_names = [] 00068 if self.joint_angles is None: 00069 self.joint_angles = [] 00070 if self.speed is None: 00071 self.speed = 0. 00072 if self.relative is None: 00073 self.relative = 0 00074 else: 00075 self.header = std_msgs.msg._Header.Header() 00076 self.joint_names = [] 00077 self.joint_angles = [] 00078 self.speed = 0. 00079 self.relative = 0 00080 00081 def _get_types(self): 00082 """ 00083 internal API method 00084 """ 00085 return self._slot_types 00086 00087 def serialize(self, buff): 00088 """ 00089 serialize message into buffer 00090 @param buff: buffer 00091 @type buff: StringIO 00092 """ 00093 try: 00094 _x = self 00095 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00096 _x = self.header.frame_id 00097 length = len(_x) 00098 buff.write(struct.pack('<I%ss'%length, length, _x)) 00099 length = len(self.joint_names) 00100 buff.write(_struct_I.pack(length)) 00101 for val1 in self.joint_names: 00102 length = len(val1) 00103 buff.write(struct.pack('<I%ss'%length, length, val1)) 00104 length = len(self.joint_angles) 00105 buff.write(_struct_I.pack(length)) 00106 pattern = '<%sf'%length 00107 buff.write(struct.pack(pattern, *self.joint_angles)) 00108 _x = self 00109 buff.write(_struct_fB.pack(_x.speed, _x.relative)) 00110 except struct.error as se: self._check_types(se) 00111 except TypeError as te: self._check_types(te) 00112 00113 def deserialize(self, str): 00114 """ 00115 unpack serialized message in str into this message instance 00116 @param str: byte array of serialized message 00117 @type str: str 00118 """ 00119 try: 00120 if self.header is None: 00121 self.header = std_msgs.msg._Header.Header() 00122 end = 0 00123 _x = self 00124 start = end 00125 end += 12 00126 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00127 start = end 00128 end += 4 00129 (length,) = _struct_I.unpack(str[start:end]) 00130 start = end 00131 end += length 00132 self.header.frame_id = str[start:end] 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 = '<%sf'%length 00149 start = end 00150 end += struct.calcsize(pattern) 00151 self.joint_angles = struct.unpack(pattern, str[start:end]) 00152 _x = self 00153 start = end 00154 end += 5 00155 (_x.speed, _x.relative,) = _struct_fB.unpack(str[start:end]) 00156 return self 00157 except struct.error as e: 00158 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00159 00160 00161 def serialize_numpy(self, buff, numpy): 00162 """ 00163 serialize message with numpy array types into buffer 00164 @param buff: buffer 00165 @type buff: StringIO 00166 @param numpy: numpy python module 00167 @type numpy module 00168 """ 00169 try: 00170 _x = self 00171 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00172 _x = self.header.frame_id 00173 length = len(_x) 00174 buff.write(struct.pack('<I%ss'%length, length, _x)) 00175 length = len(self.joint_names) 00176 buff.write(_struct_I.pack(length)) 00177 for val1 in self.joint_names: 00178 length = len(val1) 00179 buff.write(struct.pack('<I%ss'%length, length, val1)) 00180 length = len(self.joint_angles) 00181 buff.write(_struct_I.pack(length)) 00182 pattern = '<%sf'%length 00183 buff.write(self.joint_angles.tostring()) 00184 _x = self 00185 buff.write(_struct_fB.pack(_x.speed, _x.relative)) 00186 except struct.error as se: self._check_types(se) 00187 except TypeError as te: self._check_types(te) 00188 00189 def deserialize_numpy(self, str, numpy): 00190 """ 00191 unpack serialized message in str into this message instance using numpy for array types 00192 @param str: byte array of serialized message 00193 @type str: str 00194 @param numpy: numpy python module 00195 @type numpy: module 00196 """ 00197 try: 00198 if self.header is None: 00199 self.header = std_msgs.msg._Header.Header() 00200 end = 0 00201 _x = self 00202 start = end 00203 end += 12 00204 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00205 start = end 00206 end += 4 00207 (length,) = _struct_I.unpack(str[start:end]) 00208 start = end 00209 end += length 00210 self.header.frame_id = str[start:end] 00211 start = end 00212 end += 4 00213 (length,) = _struct_I.unpack(str[start:end]) 00214 self.joint_names = [] 00215 for i in range(0, length): 00216 start = end 00217 end += 4 00218 (length,) = _struct_I.unpack(str[start:end]) 00219 start = end 00220 end += length 00221 val1 = str[start:end] 00222 self.joint_names.append(val1) 00223 start = end 00224 end += 4 00225 (length,) = _struct_I.unpack(str[start:end]) 00226 pattern = '<%sf'%length 00227 start = end 00228 end += struct.calcsize(pattern) 00229 self.joint_angles = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00230 _x = self 00231 start = end 00232 end += 5 00233 (_x.speed, _x.relative,) = _struct_fB.unpack(str[start:end]) 00234 return self 00235 except struct.error as e: 00236 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00237 00238 _struct_I = roslib.message.struct_I 00239 _struct_3I = struct.Struct("<3I") 00240 _struct_fB = struct.Struct("<fB")