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