_JointControl.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/JointControl.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 JointControl(genpy.Message):
00009   _md5sum = "e38c02f4ffdedb57646a4576b7e0ccf6"
00010   _type = "nasa_r2_common_msgs/JointControl"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string publisher
00013 float64 timeStamp
00014 string joint
00015 uint32 registerValue
00016 bool enableBridge
00017 bool enableMotor
00018 bool releaseBrake
00019 bool embeddedMotCom
00020 uint16 controlMode
00021 bool clearFaults
00022 
00023 """
00024   __slots__ = ['publisher','timeStamp','joint','registerValue','enableBridge','enableMotor','releaseBrake','embeddedMotCom','controlMode','clearFaults']
00025   _slot_types = ['string','float64','string','uint32','bool','bool','bool','bool','uint16','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,timeStamp,joint,registerValue,enableBridge,enableMotor,releaseBrake,embeddedMotCom,controlMode,clearFaults
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(JointControl, 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.timeStamp is None:
00047         self.timeStamp = 0.
00048       if self.joint is None:
00049         self.joint = ''
00050       if self.registerValue is None:
00051         self.registerValue = 0
00052       if self.enableBridge is None:
00053         self.enableBridge = False
00054       if self.enableMotor is None:
00055         self.enableMotor = False
00056       if self.releaseBrake is None:
00057         self.releaseBrake = False
00058       if self.embeddedMotCom is None:
00059         self.embeddedMotCom = False
00060       if self.controlMode is None:
00061         self.controlMode = 0
00062       if self.clearFaults is None:
00063         self.clearFaults = False
00064     else:
00065       self.publisher = ''
00066       self.timeStamp = 0.
00067       self.joint = ''
00068       self.registerValue = 0
00069       self.enableBridge = False
00070       self.enableMotor = False
00071       self.releaseBrake = False
00072       self.embeddedMotCom = False
00073       self.controlMode = 0
00074       self.clearFaults = 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       buff.write(_struct_d.pack(self.timeStamp))
00095       _x = self.joint
00096       length = len(_x)
00097       if python3 or type(_x) == unicode:
00098         _x = _x.encode('utf-8')
00099         length = len(_x)
00100       buff.write(struct.pack('<I%ss'%length, length, _x))
00101       _x = self
00102       buff.write(_struct_I4BHB.pack(_x.registerValue, _x.enableBridge, _x.enableMotor, _x.releaseBrake, _x.embeddedMotCom, _x.controlMode, _x.clearFaults))
00103     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00104     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00105 
00106   def deserialize(self, str):
00107     """
00108     unpack serialized message in str into this message instance
00109     :param str: byte array of serialized message, ``str``
00110     """
00111     try:
00112       end = 0
00113       start = end
00114       end += 4
00115       (length,) = _struct_I.unpack(str[start:end])
00116       start = end
00117       end += length
00118       if python3:
00119         self.publisher = str[start:end].decode('utf-8')
00120       else:
00121         self.publisher = str[start:end]
00122       start = end
00123       end += 8
00124       (self.timeStamp,) = _struct_d.unpack(str[start:end])
00125       start = end
00126       end += 4
00127       (length,) = _struct_I.unpack(str[start:end])
00128       start = end
00129       end += length
00130       if python3:
00131         self.joint = str[start:end].decode('utf-8')
00132       else:
00133         self.joint = str[start:end]
00134       _x = self
00135       start = end
00136       end += 11
00137       (_x.registerValue, _x.enableBridge, _x.enableMotor, _x.releaseBrake, _x.embeddedMotCom, _x.controlMode, _x.clearFaults,) = _struct_I4BHB.unpack(str[start:end])
00138       self.enableBridge = bool(self.enableBridge)
00139       self.enableMotor = bool(self.enableMotor)
00140       self.releaseBrake = bool(self.releaseBrake)
00141       self.embeddedMotCom = bool(self.embeddedMotCom)
00142       self.clearFaults = bool(self.clearFaults)
00143       return self
00144     except struct.error as e:
00145       raise genpy.DeserializationError(e) #most likely buffer underfill
00146 
00147 
00148   def serialize_numpy(self, buff, numpy):
00149     """
00150     serialize message with numpy array types into buffer
00151     :param buff: buffer, ``StringIO``
00152     :param numpy: numpy python module
00153     """
00154     try:
00155       _x = self.publisher
00156       length = len(_x)
00157       if python3 or type(_x) == unicode:
00158         _x = _x.encode('utf-8')
00159         length = len(_x)
00160       buff.write(struct.pack('<I%ss'%length, length, _x))
00161       buff.write(_struct_d.pack(self.timeStamp))
00162       _x = self.joint
00163       length = len(_x)
00164       if python3 or type(_x) == unicode:
00165         _x = _x.encode('utf-8')
00166         length = len(_x)
00167       buff.write(struct.pack('<I%ss'%length, length, _x))
00168       _x = self
00169       buff.write(_struct_I4BHB.pack(_x.registerValue, _x.enableBridge, _x.enableMotor, _x.releaseBrake, _x.embeddedMotCom, _x.controlMode, _x.clearFaults))
00170     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00171     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00172 
00173   def deserialize_numpy(self, str, numpy):
00174     """
00175     unpack serialized message in str into this message instance using numpy for array types
00176     :param str: byte array of serialized message, ``str``
00177     :param numpy: numpy python module
00178     """
00179     try:
00180       end = 0
00181       start = end
00182       end += 4
00183       (length,) = _struct_I.unpack(str[start:end])
00184       start = end
00185       end += length
00186       if python3:
00187         self.publisher = str[start:end].decode('utf-8')
00188       else:
00189         self.publisher = str[start:end]
00190       start = end
00191       end += 8
00192       (self.timeStamp,) = _struct_d.unpack(str[start:end])
00193       start = end
00194       end += 4
00195       (length,) = _struct_I.unpack(str[start:end])
00196       start = end
00197       end += length
00198       if python3:
00199         self.joint = str[start:end].decode('utf-8')
00200       else:
00201         self.joint = str[start:end]
00202       _x = self
00203       start = end
00204       end += 11
00205       (_x.registerValue, _x.enableBridge, _x.enableMotor, _x.releaseBrake, _x.embeddedMotCom, _x.controlMode, _x.clearFaults,) = _struct_I4BHB.unpack(str[start:end])
00206       self.enableBridge = bool(self.enableBridge)
00207       self.enableMotor = bool(self.enableMotor)
00208       self.releaseBrake = bool(self.releaseBrake)
00209       self.embeddedMotCom = bool(self.embeddedMotCom)
00210       self.clearFaults = bool(self.clearFaults)
00211       return self
00212     except struct.error as e:
00213       raise genpy.DeserializationError(e) #most likely buffer underfill
00214 
00215 _struct_I = genpy.struct_I
00216 _struct_I4BHB = struct.Struct("<I4BHB")
00217 _struct_d = struct.Struct("<d")


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