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


r2_msgs
Author(s): Paul Dinh
autogenerated on Fri Jan 3 2014 11:33:55