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


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34