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


nao_msgs
Author(s): Armin Hornung, Stefan Osswald, Daniel Maier
autogenerated on Tue Oct 15 2013 10:05:22