_JointState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from dynamixel_hardware_interface/JointState.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 JointState(genpy.Message):
00010   _md5sum = "0fab1cf305c2bcc21c2d79dd7bcae0a9"
00011   _type = "dynamixel_hardware_interface/JointState"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 string name             # joint name
00015 float64 target_position # commanded position (in radians)
00016 float64 target_velocity # commanded position (in radians per second)
00017 float64 position        # current joint position (in radians)
00018 float64 velocity        # current joint speed (in radians per second)
00019 float64 load            # current load
00020 bool    moving          # is joint currently in motion
00021 
00022 
00023 ================================================================================
00024 MSG: std_msgs/Header
00025 # Standard metadata for higher-level stamped data types.
00026 # This is generally used to communicate timestamped data 
00027 # in a particular coordinate frame.
00028 # 
00029 # sequence ID: consecutively increasing ID 
00030 uint32 seq
00031 #Two-integer timestamp that is expressed as:
00032 # * stamp.secs: seconds (stamp_secs) since epoch
00033 # * stamp.nsecs: nanoseconds since stamp_secs
00034 # time-handling sugar is provided by the client library
00035 time stamp
00036 #Frame this data is associated with
00037 # 0: no frame
00038 # 1: global frame
00039 string frame_id
00040 
00041 """
00042   __slots__ = ['header','name','target_position','target_velocity','position','velocity','load','moving']
00043   _slot_types = ['std_msgs/Header','string','float64','float64','float64','float64','float64','bool']
00044 
00045   def __init__(self, *args, **kwds):
00046     """
00047     Constructor. Any message fields that are implicitly/explicitly
00048     set to None will be assigned a default value. The recommend
00049     use is keyword arguments as this is more robust to future message
00050     changes.  You cannot mix in-order arguments and keyword arguments.
00051 
00052     The available fields are:
00053        header,name,target_position,target_velocity,position,velocity,load,moving
00054 
00055     :param args: complete set of field values, in .msg order
00056     :param kwds: use keyword arguments corresponding to message field names
00057     to set specific fields.
00058     """
00059     if args or kwds:
00060       super(JointState, self).__init__(*args, **kwds)
00061       #message fields cannot be None, assign default values for those that are
00062       if self.header is None:
00063         self.header = std_msgs.msg.Header()
00064       if self.name is None:
00065         self.name = ''
00066       if self.target_position is None:
00067         self.target_position = 0.
00068       if self.target_velocity is None:
00069         self.target_velocity = 0.
00070       if self.position is None:
00071         self.position = 0.
00072       if self.velocity is None:
00073         self.velocity = 0.
00074       if self.load is None:
00075         self.load = 0.
00076       if self.moving is None:
00077         self.moving = False
00078     else:
00079       self.header = std_msgs.msg.Header()
00080       self.name = ''
00081       self.target_position = 0.
00082       self.target_velocity = 0.
00083       self.position = 0.
00084       self.velocity = 0.
00085       self.load = 0.
00086       self.moving = False
00087 
00088   def _get_types(self):
00089     """
00090     internal API method
00091     """
00092     return self._slot_types
00093 
00094   def serialize(self, buff):
00095     """
00096     serialize message into buffer
00097     :param buff: buffer, ``StringIO``
00098     """
00099     try:
00100       _x = self
00101       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00102       _x = self.header.frame_id
00103       length = len(_x)
00104       if python3 or type(_x) == unicode:
00105         _x = _x.encode('utf-8')
00106         length = len(_x)
00107       buff.write(struct.pack('<I%ss'%length, length, _x))
00108       _x = self.name
00109       length = len(_x)
00110       if python3 or type(_x) == unicode:
00111         _x = _x.encode('utf-8')
00112         length = len(_x)
00113       buff.write(struct.pack('<I%ss'%length, length, _x))
00114       _x = self
00115       buff.write(_struct_5dB.pack(_x.target_position, _x.target_velocity, _x.position, _x.velocity, _x.load, _x.moving))
00116     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00117     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00118 
00119   def deserialize(self, str):
00120     """
00121     unpack serialized message in str into this message instance
00122     :param str: byte array of serialized message, ``str``
00123     """
00124     try:
00125       if self.header is None:
00126         self.header = std_msgs.msg.Header()
00127       end = 0
00128       _x = self
00129       start = end
00130       end += 12
00131       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00132       start = end
00133       end += 4
00134       (length,) = _struct_I.unpack(str[start:end])
00135       start = end
00136       end += length
00137       if python3:
00138         self.header.frame_id = str[start:end].decode('utf-8')
00139       else:
00140         self.header.frame_id = str[start:end]
00141       start = end
00142       end += 4
00143       (length,) = _struct_I.unpack(str[start:end])
00144       start = end
00145       end += length
00146       if python3:
00147         self.name = str[start:end].decode('utf-8')
00148       else:
00149         self.name = str[start:end]
00150       _x = self
00151       start = end
00152       end += 41
00153       (_x.target_position, _x.target_velocity, _x.position, _x.velocity, _x.load, _x.moving,) = _struct_5dB.unpack(str[start:end])
00154       self.moving = bool(self.moving)
00155       return self
00156     except struct.error as e:
00157       raise genpy.DeserializationError(e) #most likely buffer underfill
00158 
00159 
00160   def serialize_numpy(self, buff, numpy):
00161     """
00162     serialize message with numpy array types into buffer
00163     :param buff: buffer, ``StringIO``
00164     :param numpy: numpy python module
00165     """
00166     try:
00167       _x = self
00168       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00169       _x = self.header.frame_id
00170       length = len(_x)
00171       if python3 or type(_x) == unicode:
00172         _x = _x.encode('utf-8')
00173         length = len(_x)
00174       buff.write(struct.pack('<I%ss'%length, length, _x))
00175       _x = self.name
00176       length = len(_x)
00177       if python3 or type(_x) == unicode:
00178         _x = _x.encode('utf-8')
00179         length = len(_x)
00180       buff.write(struct.pack('<I%ss'%length, length, _x))
00181       _x = self
00182       buff.write(_struct_5dB.pack(_x.target_position, _x.target_velocity, _x.position, _x.velocity, _x.load, _x.moving))
00183     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00184     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00185 
00186   def deserialize_numpy(self, str, numpy):
00187     """
00188     unpack serialized message in str into this message instance using numpy for array types
00189     :param str: byte array of serialized message, ``str``
00190     :param numpy: numpy python module
00191     """
00192     try:
00193       if self.header is None:
00194         self.header = std_msgs.msg.Header()
00195       end = 0
00196       _x = self
00197       start = end
00198       end += 12
00199       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00200       start = end
00201       end += 4
00202       (length,) = _struct_I.unpack(str[start:end])
00203       start = end
00204       end += length
00205       if python3:
00206         self.header.frame_id = str[start:end].decode('utf-8')
00207       else:
00208         self.header.frame_id = str[start:end]
00209       start = end
00210       end += 4
00211       (length,) = _struct_I.unpack(str[start:end])
00212       start = end
00213       end += length
00214       if python3:
00215         self.name = str[start:end].decode('utf-8')
00216       else:
00217         self.name = str[start:end]
00218       _x = self
00219       start = end
00220       end += 41
00221       (_x.target_position, _x.target_velocity, _x.position, _x.velocity, _x.load, _x.moving,) = _struct_5dB.unpack(str[start:end])
00222       self.moving = bool(self.moving)
00223       return self
00224     except struct.error as e:
00225       raise genpy.DeserializationError(e) #most likely buffer underfill
00226 
00227 _struct_I = genpy.struct_I
00228 _struct_5dB = struct.Struct("<5dB")
00229 _struct_3I = struct.Struct("<3I")


dynamixel_hardware_interface
Author(s): Antons Rebguns
autogenerated on Sun Oct 5 2014 23:33:10