_Biotac.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/Biotac.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 Biotac(genpy.Message):
00009   _md5sum = "45887a982dc5cee83be90c94c9db9f12"
00010   _type = "sr_robot_msgs/Biotac"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """int16 pac0
00013 int16 pac1
00014 int16 pdc
00015 
00016 int16 tac
00017 int16 tdc
00018 
00019 int16[19] electrodes
00020 
00021 """
00022   __slots__ = ['pac0','pac1','pdc','tac','tdc','electrodes']
00023   _slot_types = ['int16','int16','int16','int16','int16','int16[19]']
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        pac0,pac1,pdc,tac,tdc,electrodes
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(Biotac, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.pac0 is None:
00043         self.pac0 = 0
00044       if self.pac1 is None:
00045         self.pac1 = 0
00046       if self.pdc is None:
00047         self.pdc = 0
00048       if self.tac is None:
00049         self.tac = 0
00050       if self.tdc is None:
00051         self.tdc = 0
00052       if self.electrodes is None:
00053         self.electrodes = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00054     else:
00055       self.pac0 = 0
00056       self.pac1 = 0
00057       self.pdc = 0
00058       self.tac = 0
00059       self.tdc = 0
00060       self.electrodes = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
00061 
00062   def _get_types(self):
00063     """
00064     internal API method
00065     """
00066     return self._slot_types
00067 
00068   def serialize(self, buff):
00069     """
00070     serialize message into buffer
00071     :param buff: buffer, ``StringIO``
00072     """
00073     try:
00074       _x = self
00075       buff.write(_struct_5h.pack(_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc))
00076       buff.write(_struct_19h.pack(*self.electrodes))
00077     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00078     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00079 
00080   def deserialize(self, str):
00081     """
00082     unpack serialized message in str into this message instance
00083     :param str: byte array of serialized message, ``str``
00084     """
00085     try:
00086       end = 0
00087       _x = self
00088       start = end
00089       end += 10
00090       (_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc,) = _struct_5h.unpack(str[start:end])
00091       start = end
00092       end += 38
00093       self.electrodes = _struct_19h.unpack(str[start:end])
00094       return self
00095     except struct.error as e:
00096       raise genpy.DeserializationError(e) #most likely buffer underfill
00097 
00098 
00099   def serialize_numpy(self, buff, numpy):
00100     """
00101     serialize message with numpy array types into buffer
00102     :param buff: buffer, ``StringIO``
00103     :param numpy: numpy python module
00104     """
00105     try:
00106       _x = self
00107       buff.write(_struct_5h.pack(_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc))
00108       buff.write(self.electrodes.tostring())
00109     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00110     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00111 
00112   def deserialize_numpy(self, str, numpy):
00113     """
00114     unpack serialized message in str into this message instance using numpy for array types
00115     :param str: byte array of serialized message, ``str``
00116     :param numpy: numpy python module
00117     """
00118     try:
00119       end = 0
00120       _x = self
00121       start = end
00122       end += 10
00123       (_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc,) = _struct_5h.unpack(str[start:end])
00124       start = end
00125       end += 38
00126       self.electrodes = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=19)
00127       return self
00128     except struct.error as e:
00129       raise genpy.DeserializationError(e) #most likely buffer underfill
00130 
00131 _struct_I = genpy.struct_I
00132 _struct_5h = struct.Struct("<5h")
00133 _struct_19h = struct.Struct("<19h")


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Mon Oct 6 2014 07:40:05