_ClearpathRobot.py
Go to the documentation of this file.
00001 """autogenerated by genpy from clearpath_base/ClearpathRobot.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 ClearpathRobot(genpy.Message):
00009   _md5sum = "1bdab2b789676c1b350ab6739da650c7"
00010   _type = "clearpath_base/ClearpathRobot"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string name
00013 string model
00014 int32 platform_revision
00015 uint32 serial
00016 int32[2] horizon_version
00017 int32[2] firmware_version
00018 int32 firmware_revision
00019 string write_date
00020 
00021 """
00022   __slots__ = ['name','model','platform_revision','serial','horizon_version','firmware_version','firmware_revision','write_date']
00023   _slot_types = ['string','string','int32','uint32','int32[2]','int32[2]','int32','string']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        name,model,platform_revision,serial,horizon_version,firmware_version,firmware_revision,write_date
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(ClearpathRobot, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.name is None:
00043         self.name = ''
00044       if self.model is None:
00045         self.model = ''
00046       if self.platform_revision is None:
00047         self.platform_revision = 0
00048       if self.serial is None:
00049         self.serial = 0
00050       if self.horizon_version is None:
00051         self.horizon_version = [0,0]
00052       if self.firmware_version is None:
00053         self.firmware_version = [0,0]
00054       if self.firmware_revision is None:
00055         self.firmware_revision = 0
00056       if self.write_date is None:
00057         self.write_date = ''
00058     else:
00059       self.name = ''
00060       self.model = ''
00061       self.platform_revision = 0
00062       self.serial = 0
00063       self.horizon_version = [0,0]
00064       self.firmware_version = [0,0]
00065       self.firmware_revision = 0
00066       self.write_date = ''
00067 
00068   def _get_types(self):
00069     """
00070     internal API method
00071     """
00072     return self._slot_types
00073 
00074   def serialize(self, buff):
00075     """
00076     serialize message into buffer
00077     :param buff: buffer, ``StringIO``
00078     """
00079     try:
00080       _x = self.name
00081       length = len(_x)
00082       if python3 or type(_x) == unicode:
00083         _x = _x.encode('utf-8')
00084         length = len(_x)
00085       buff.write(struct.pack('<I%ss'%length, length, _x))
00086       _x = self.model
00087       length = len(_x)
00088       if python3 or type(_x) == unicode:
00089         _x = _x.encode('utf-8')
00090         length = len(_x)
00091       buff.write(struct.pack('<I%ss'%length, length, _x))
00092       _x = self
00093       buff.write(_struct_iI.pack(_x.platform_revision, _x.serial))
00094       buff.write(_struct_2i.pack(*self.horizon_version))
00095       buff.write(_struct_2i.pack(*self.firmware_version))
00096       buff.write(_struct_i.pack(self.firmware_revision))
00097       _x = self.write_date
00098       length = len(_x)
00099       if python3 or type(_x) == unicode:
00100         _x = _x.encode('utf-8')
00101         length = len(_x)
00102       buff.write(struct.pack('<I%ss'%length, length, _x))
00103     except struct.error as se: self._check_types(se)
00104     except TypeError as te: self._check_types(te)
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.name = str[start:end].decode('utf-8')
00120       else:
00121         self.name = str[start:end]
00122       start = end
00123       end += 4
00124       (length,) = _struct_I.unpack(str[start:end])
00125       start = end
00126       end += length
00127       if python3:
00128         self.model = str[start:end].decode('utf-8')
00129       else:
00130         self.model = str[start:end]
00131       _x = self
00132       start = end
00133       end += 8
00134       (_x.platform_revision, _x.serial,) = _struct_iI.unpack(str[start:end])
00135       start = end
00136       end += 8
00137       self.horizon_version = _struct_2i.unpack(str[start:end])
00138       start = end
00139       end += 8
00140       self.firmware_version = _struct_2i.unpack(str[start:end])
00141       start = end
00142       end += 4
00143       (self.firmware_revision,) = _struct_i.unpack(str[start:end])
00144       start = end
00145       end += 4
00146       (length,) = _struct_I.unpack(str[start:end])
00147       start = end
00148       end += length
00149       if python3:
00150         self.write_date = str[start:end].decode('utf-8')
00151       else:
00152         self.write_date = str[start:end]
00153       return self
00154     except struct.error as e:
00155       raise genpy.DeserializationError(e) #most likely buffer underfill
00156 
00157 
00158   def serialize_numpy(self, buff, numpy):
00159     """
00160     serialize message with numpy array types into buffer
00161     :param buff: buffer, ``StringIO``
00162     :param numpy: numpy python module
00163     """
00164     try:
00165       _x = self.name
00166       length = len(_x)
00167       if python3 or type(_x) == unicode:
00168         _x = _x.encode('utf-8')
00169         length = len(_x)
00170       buff.write(struct.pack('<I%ss'%length, length, _x))
00171       _x = self.model
00172       length = len(_x)
00173       if python3 or type(_x) == unicode:
00174         _x = _x.encode('utf-8')
00175         length = len(_x)
00176       buff.write(struct.pack('<I%ss'%length, length, _x))
00177       _x = self
00178       buff.write(_struct_iI.pack(_x.platform_revision, _x.serial))
00179       buff.write(self.horizon_version.tostring())
00180       buff.write(self.firmware_version.tostring())
00181       buff.write(_struct_i.pack(self.firmware_revision))
00182       _x = self.write_date
00183       length = len(_x)
00184       if python3 or type(_x) == unicode:
00185         _x = _x.encode('utf-8')
00186         length = len(_x)
00187       buff.write(struct.pack('<I%ss'%length, length, _x))
00188     except struct.error as se: self._check_types(se)
00189     except TypeError as te: self._check_types(te)
00190 
00191   def deserialize_numpy(self, str, numpy):
00192     """
00193     unpack serialized message in str into this message instance using numpy for array types
00194     :param str: byte array of serialized message, ``str``
00195     :param numpy: numpy python module
00196     """
00197     try:
00198       end = 0
00199       start = end
00200       end += 4
00201       (length,) = _struct_I.unpack(str[start:end])
00202       start = end
00203       end += length
00204       if python3:
00205         self.name = str[start:end].decode('utf-8')
00206       else:
00207         self.name = str[start:end]
00208       start = end
00209       end += 4
00210       (length,) = _struct_I.unpack(str[start:end])
00211       start = end
00212       end += length
00213       if python3:
00214         self.model = str[start:end].decode('utf-8')
00215       else:
00216         self.model = str[start:end]
00217       _x = self
00218       start = end
00219       end += 8
00220       (_x.platform_revision, _x.serial,) = _struct_iI.unpack(str[start:end])
00221       start = end
00222       end += 8
00223       self.horizon_version = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=2)
00224       start = end
00225       end += 8
00226       self.firmware_version = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=2)
00227       start = end
00228       end += 4
00229       (self.firmware_revision,) = _struct_i.unpack(str[start:end])
00230       start = end
00231       end += 4
00232       (length,) = _struct_I.unpack(str[start:end])
00233       start = end
00234       end += length
00235       if python3:
00236         self.write_date = str[start:end].decode('utf-8')
00237       else:
00238         self.write_date = str[start:end]
00239       return self
00240     except struct.error as e:
00241       raise genpy.DeserializationError(e) #most likely buffer underfill
00242 
00243 _struct_I = genpy.struct_I
00244 _struct_iI = struct.Struct("<iI")
00245 _struct_i = struct.Struct("<i")
00246 _struct_2i = struct.Struct("<2i")


clearpath_base
Author(s): Mike Purvis
autogenerated on Sat Dec 28 2013 16:50:47