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


dynamixel_msgs
Author(s): Antons Rebguns
autogenerated on Fri Jan 3 2014 11:19:44