_JointStatus.py
Go to the documentation of this file.
00001 """autogenerated by genpy from r2_msgs/JointStatus.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class JointStatus(genpy.Message):
00009   _md5sum = "03efe3c55d2652ccbab38921d83a5f63"
00010   _type = "r2_msgs/JointStatus"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string publisher
00013 string joint
00014 uint32 registerValue
00015 bool bridgeEnabled
00016 bool motorEnabled
00017 bool brakeReleased
00018 bool motorPowerDetected
00019 bool embeddedMotCom
00020 bool jointFaulted
00021 
00022 """
00023   __slots__ = ['publisher','joint','registerValue','bridgeEnabled','motorEnabled','brakeReleased','motorPowerDetected','embeddedMotCom','jointFaulted']
00024   _slot_types = ['string','string','uint32','bool','bool','bool','bool','bool','bool']
00025 
00026   def __init__(self, *args, **kwds):
00027     """
00028     Constructor. Any message fields that are implicitly/explicitly
00029     set to None will be assigned a default value. The recommend
00030     use is keyword arguments as this is more robust to future message
00031     changes.  You cannot mix in-order arguments and keyword arguments.
00032 
00033     The available fields are:
00034        publisher,joint,registerValue,bridgeEnabled,motorEnabled,brakeReleased,motorPowerDetected,embeddedMotCom,jointFaulted
00035 
00036     :param args: complete set of field values, in .msg order
00037     :param kwds: use keyword arguments corresponding to message field names
00038     to set specific fields.
00039     """
00040     if args or kwds:
00041       super(JointStatus, self).__init__(*args, **kwds)
00042       #message fields cannot be None, assign default values for those that are
00043       if self.publisher is None:
00044         self.publisher = ''
00045       if self.joint is None:
00046         self.joint = ''
00047       if self.registerValue is None:
00048         self.registerValue = 0
00049       if self.bridgeEnabled is None:
00050         self.bridgeEnabled = False
00051       if self.motorEnabled is None:
00052         self.motorEnabled = False
00053       if self.brakeReleased is None:
00054         self.brakeReleased = False
00055       if self.motorPowerDetected is None:
00056         self.motorPowerDetected = False
00057       if self.embeddedMotCom is None:
00058         self.embeddedMotCom = False
00059       if self.jointFaulted is None:
00060         self.jointFaulted = False
00061     else:
00062       self.publisher = ''
00063       self.joint = ''
00064       self.registerValue = 0
00065       self.bridgeEnabled = False
00066       self.motorEnabled = False
00067       self.brakeReleased = False
00068       self.motorPowerDetected = False
00069       self.embeddedMotCom = False
00070       self.jointFaulted = False
00071 
00072   def _get_types(self):
00073     """
00074     internal API method
00075     """
00076     return self._slot_types
00077 
00078   def serialize(self, buff):
00079     """
00080     serialize message into buffer
00081     :param buff: buffer, ``StringIO``
00082     """
00083     try:
00084       _x = self.publisher
00085       length = len(_x)
00086       if python3 or type(_x) == unicode:
00087         _x = _x.encode('utf-8')
00088         length = len(_x)
00089       buff.write(struct.pack('<I%ss'%length, length, _x))
00090       _x = self.joint
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       _x = self
00097       buff.write(_struct_I6B.pack(_x.registerValue, _x.bridgeEnabled, _x.motorEnabled, _x.brakeReleased, _x.motorPowerDetected, _x.embeddedMotCom, _x.jointFaulted))
00098     except struct.error as se: self._check_types(se)
00099     except TypeError as te: self._check_types(te)
00100 
00101   def deserialize(self, str):
00102     """
00103     unpack serialized message in str into this message instance
00104     :param str: byte array of serialized message, ``str``
00105     """
00106     try:
00107       end = 0
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       start = end
00112       end += length
00113       if python3:
00114         self.publisher = str[start:end].decode('utf-8')
00115       else:
00116         self.publisher = str[start:end]
00117       start = end
00118       end += 4
00119       (length,) = _struct_I.unpack(str[start:end])
00120       start = end
00121       end += length
00122       if python3:
00123         self.joint = str[start:end].decode('utf-8')
00124       else:
00125         self.joint = str[start:end]
00126       _x = self
00127       start = end
00128       end += 10
00129       (_x.registerValue, _x.bridgeEnabled, _x.motorEnabled, _x.brakeReleased, _x.motorPowerDetected, _x.embeddedMotCom, _x.jointFaulted,) = _struct_I6B.unpack(str[start:end])
00130       self.bridgeEnabled = bool(self.bridgeEnabled)
00131       self.motorEnabled = bool(self.motorEnabled)
00132       self.brakeReleased = bool(self.brakeReleased)
00133       self.motorPowerDetected = bool(self.motorPowerDetected)
00134       self.embeddedMotCom = bool(self.embeddedMotCom)
00135       self.jointFaulted = bool(self.jointFaulted)
00136       return self
00137     except struct.error as e:
00138       raise genpy.DeserializationError(e) #most likely buffer underfill
00139 
00140 
00141   def serialize_numpy(self, buff, numpy):
00142     """
00143     serialize message with numpy array types into buffer
00144     :param buff: buffer, ``StringIO``
00145     :param numpy: numpy python module
00146     """
00147     try:
00148       _x = self.publisher
00149       length = len(_x)
00150       if python3 or type(_x) == unicode:
00151         _x = _x.encode('utf-8')
00152         length = len(_x)
00153       buff.write(struct.pack('<I%ss'%length, length, _x))
00154       _x = self.joint
00155       length = len(_x)
00156       if python3 or type(_x) == unicode:
00157         _x = _x.encode('utf-8')
00158         length = len(_x)
00159       buff.write(struct.pack('<I%ss'%length, length, _x))
00160       _x = self
00161       buff.write(_struct_I6B.pack(_x.registerValue, _x.bridgeEnabled, _x.motorEnabled, _x.brakeReleased, _x.motorPowerDetected, _x.embeddedMotCom, _x.jointFaulted))
00162     except struct.error as se: self._check_types(se)
00163     except TypeError as te: self._check_types(te)
00164 
00165   def deserialize_numpy(self, str, numpy):
00166     """
00167     unpack serialized message in str into this message instance using numpy for array types
00168     :param str: byte array of serialized message, ``str``
00169     :param numpy: numpy python module
00170     """
00171     try:
00172       end = 0
00173       start = end
00174       end += 4
00175       (length,) = _struct_I.unpack(str[start:end])
00176       start = end
00177       end += length
00178       if python3:
00179         self.publisher = str[start:end].decode('utf-8')
00180       else:
00181         self.publisher = str[start:end]
00182       start = end
00183       end += 4
00184       (length,) = _struct_I.unpack(str[start:end])
00185       start = end
00186       end += length
00187       if python3:
00188         self.joint = str[start:end].decode('utf-8')
00189       else:
00190         self.joint = str[start:end]
00191       _x = self
00192       start = end
00193       end += 10
00194       (_x.registerValue, _x.bridgeEnabled, _x.motorEnabled, _x.brakeReleased, _x.motorPowerDetected, _x.embeddedMotCom, _x.jointFaulted,) = _struct_I6B.unpack(str[start:end])
00195       self.bridgeEnabled = bool(self.bridgeEnabled)
00196       self.motorEnabled = bool(self.motorEnabled)
00197       self.brakeReleased = bool(self.brakeReleased)
00198       self.motorPowerDetected = bool(self.motorPowerDetected)
00199       self.embeddedMotCom = bool(self.embeddedMotCom)
00200       self.jointFaulted = bool(self.jointFaulted)
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 _struct_I = genpy.struct_I
00206 _struct_I6B = struct.Struct("<I6B")


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