_JointData.py
Go to the documentation of this file.
00001 """autogenerated by genpy from joint_qualification_controllers/JointData.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 JointData(genpy.Message):
00009   _md5sum = "191610564bf935172c9424c803ed6939"
00010   _type = "joint_qualification_controllers/JointData"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int16 index
00013 string name
00014 byte is_cal
00015 byte has_safety
00016 string type
00017 
00018 
00019 """
00020   __slots__ = ['index','name','is_cal','has_safety','type']
00021   _slot_types = ['int16','string','byte','byte','string']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        index,name,is_cal,has_safety,type
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(JointData, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.index is None:
00041         self.index = 0
00042       if self.name is None:
00043         self.name = ''
00044       if self.is_cal is None:
00045         self.is_cal = 0
00046       if self.has_safety is None:
00047         self.has_safety = 0
00048       if self.type is None:
00049         self.type = ''
00050     else:
00051       self.index = 0
00052       self.name = ''
00053       self.is_cal = 0
00054       self.has_safety = 0
00055       self.type = ''
00056 
00057   def _get_types(self):
00058     """
00059     internal API method
00060     """
00061     return self._slot_types
00062 
00063   def serialize(self, buff):
00064     """
00065     serialize message into buffer
00066     :param buff: buffer, ``StringIO``
00067     """
00068     try:
00069       buff.write(_struct_h.pack(self.index))
00070       _x = self.name
00071       length = len(_x)
00072       if python3 or type(_x) == unicode:
00073         _x = _x.encode('utf-8')
00074         length = len(_x)
00075       buff.write(struct.pack('<I%ss'%length, length, _x))
00076       _x = self
00077       buff.write(_struct_2b.pack(_x.is_cal, _x.has_safety))
00078       _x = self.type
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00085     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00086 
00087   def deserialize(self, str):
00088     """
00089     unpack serialized message in str into this message instance
00090     :param str: byte array of serialized message, ``str``
00091     """
00092     try:
00093       end = 0
00094       start = end
00095       end += 2
00096       (self.index,) = _struct_h.unpack(str[start:end])
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       start = end
00101       end += length
00102       if python3:
00103         self.name = str[start:end].decode('utf-8')
00104       else:
00105         self.name = str[start:end]
00106       _x = self
00107       start = end
00108       end += 2
00109       (_x.is_cal, _x.has_safety,) = _struct_2b.unpack(str[start:end])
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       start = end
00114       end += length
00115       if python3:
00116         self.type = str[start:end].decode('utf-8')
00117       else:
00118         self.type = str[start:end]
00119       return self
00120     except struct.error as e:
00121       raise genpy.DeserializationError(e) #most likely buffer underfill
00122 
00123 
00124   def serialize_numpy(self, buff, numpy):
00125     """
00126     serialize message with numpy array types into buffer
00127     :param buff: buffer, ``StringIO``
00128     :param numpy: numpy python module
00129     """
00130     try:
00131       buff.write(_struct_h.pack(self.index))
00132       _x = self.name
00133       length = len(_x)
00134       if python3 or type(_x) == unicode:
00135         _x = _x.encode('utf-8')
00136         length = len(_x)
00137       buff.write(struct.pack('<I%ss'%length, length, _x))
00138       _x = self
00139       buff.write(_struct_2b.pack(_x.is_cal, _x.has_safety))
00140       _x = self.type
00141       length = len(_x)
00142       if python3 or type(_x) == unicode:
00143         _x = _x.encode('utf-8')
00144         length = len(_x)
00145       buff.write(struct.pack('<I%ss'%length, length, _x))
00146     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148 
00149   def deserialize_numpy(self, str, numpy):
00150     """
00151     unpack serialized message in str into this message instance using numpy for array types
00152     :param str: byte array of serialized message, ``str``
00153     :param numpy: numpy python module
00154     """
00155     try:
00156       end = 0
00157       start = end
00158       end += 2
00159       (self.index,) = _struct_h.unpack(str[start:end])
00160       start = end
00161       end += 4
00162       (length,) = _struct_I.unpack(str[start:end])
00163       start = end
00164       end += length
00165       if python3:
00166         self.name = str[start:end].decode('utf-8')
00167       else:
00168         self.name = str[start:end]
00169       _x = self
00170       start = end
00171       end += 2
00172       (_x.is_cal, _x.has_safety,) = _struct_2b.unpack(str[start:end])
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.type = str[start:end].decode('utf-8')
00180       else:
00181         self.type = str[start:end]
00182       return self
00183     except struct.error as e:
00184       raise genpy.DeserializationError(e) #most likely buffer underfill
00185 
00186 _struct_I = genpy.struct_I
00187 _struct_h = struct.Struct("<h")
00188 _struct_2b = struct.Struct("<2b")


joint_qualification_controllers
Author(s): Kevin Watts, Melonee Wise
autogenerated on Tue Apr 22 2014 19:39:16