_BiotacAll.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/BiotacAll.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import sr_robot_msgs.msg
00008 import std_msgs.msg
00009 
00010 class BiotacAll(genpy.Message):
00011   _md5sum = "47a346cfb98ba8199f53056f3ea612f1"
00012   _type = "sr_robot_msgs/BiotacAll"
00013   _has_header = True #flag to mark the presence of a Header object
00014   _full_text = """Header header
00015 Biotac[5] tactiles
00016 ================================================================================
00017 MSG: std_msgs/Header
00018 # Standard metadata for higher-level stamped data types.
00019 # This is generally used to communicate timestamped data 
00020 # in a particular coordinate frame.
00021 # 
00022 # sequence ID: consecutively increasing ID 
00023 uint32 seq
00024 #Two-integer timestamp that is expressed as:
00025 # * stamp.secs: seconds (stamp_secs) since epoch
00026 # * stamp.nsecs: nanoseconds since stamp_secs
00027 # time-handling sugar is provided by the client library
00028 time stamp
00029 #Frame this data is associated with
00030 # 0: no frame
00031 # 1: global frame
00032 string frame_id
00033 
00034 ================================================================================
00035 MSG: sr_robot_msgs/Biotac
00036 int16 pac0
00037 int16 pac1
00038 int16 pdc
00039 
00040 int16 tac
00041 int16 tdc
00042 
00043 int16[19] electrodes
00044 
00045 """
00046   __slots__ = ['header','tactiles']
00047   _slot_types = ['std_msgs/Header','sr_robot_msgs/Biotac[5]']
00048 
00049   def __init__(self, *args, **kwds):
00050     """
00051     Constructor. Any message fields that are implicitly/explicitly
00052     set to None will be assigned a default value. The recommend
00053     use is keyword arguments as this is more robust to future message
00054     changes.  You cannot mix in-order arguments and keyword arguments.
00055 
00056     The available fields are:
00057        header,tactiles
00058 
00059     :param args: complete set of field values, in .msg order
00060     :param kwds: use keyword arguments corresponding to message field names
00061     to set specific fields.
00062     """
00063     if args or kwds:
00064       super(BiotacAll, self).__init__(*args, **kwds)
00065       #message fields cannot be None, assign default values for those that are
00066       if self.header is None:
00067         self.header = std_msgs.msg.Header()
00068       if self.tactiles is None:
00069         self.tactiles = [sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac()]
00070     else:
00071       self.header = std_msgs.msg.Header()
00072       self.tactiles = [sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac(),sr_robot_msgs.msg.Biotac()]
00073 
00074   def _get_types(self):
00075     """
00076     internal API method
00077     """
00078     return self._slot_types
00079 
00080   def serialize(self, buff):
00081     """
00082     serialize message into buffer
00083     :param buff: buffer, ``StringIO``
00084     """
00085     try:
00086       _x = self
00087       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00088       _x = self.header.frame_id
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       for val1 in self.tactiles:
00095         _x = val1
00096         buff.write(_struct_5h.pack(_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc))
00097         buff.write(_struct_19h.pack(*val1.electrodes))
00098     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00099     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00100 
00101   def deserialize(self, str):
00102     """
00103     unpack serialized message in str into this message instance
00104     :param str: byte array of serialized message, ``str``
00105     """
00106     try:
00107       if self.header is None:
00108         self.header = std_msgs.msg.Header()
00109       if self.tactiles is None:
00110         self.tactiles = None
00111       end = 0
00112       _x = self
00113       start = end
00114       end += 12
00115       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += length
00121       if python3:
00122         self.header.frame_id = str[start:end].decode('utf-8')
00123       else:
00124         self.header.frame_id = str[start:end]
00125       self.tactiles = []
00126       for i in range(0, 5):
00127         val1 = sr_robot_msgs.msg.Biotac()
00128         _x = val1
00129         start = end
00130         end += 10
00131         (_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc,) = _struct_5h.unpack(str[start:end])
00132         start = end
00133         end += 38
00134         val1.electrodes = _struct_19h.unpack(str[start:end])
00135         self.tactiles.append(val1)
00136       return self
00137     except struct.error as e:
00138       raise genpy.DeserializationError(e) #most likely buffer underfill
00139 
00140 
00141   def serialize_numpy(self, buff, numpy):
00142     """
00143     serialize message with numpy array types into buffer
00144     :param buff: buffer, ``StringIO``
00145     :param numpy: numpy python module
00146     """
00147     try:
00148       _x = self
00149       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00150       _x = self.header.frame_id
00151       length = len(_x)
00152       if python3 or type(_x) == unicode:
00153         _x = _x.encode('utf-8')
00154         length = len(_x)
00155       buff.write(struct.pack('<I%ss'%length, length, _x))
00156       for val1 in self.tactiles:
00157         _x = val1
00158         buff.write(_struct_5h.pack(_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc))
00159         buff.write(val1.electrodes.tostring())
00160     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00161     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00162 
00163   def deserialize_numpy(self, str, numpy):
00164     """
00165     unpack serialized message in str into this message instance using numpy for array types
00166     :param str: byte array of serialized message, ``str``
00167     :param numpy: numpy python module
00168     """
00169     try:
00170       if self.header is None:
00171         self.header = std_msgs.msg.Header()
00172       if self.tactiles is None:
00173         self.tactiles = None
00174       end = 0
00175       _x = self
00176       start = end
00177       end += 12
00178       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00179       start = end
00180       end += 4
00181       (length,) = _struct_I.unpack(str[start:end])
00182       start = end
00183       end += length
00184       if python3:
00185         self.header.frame_id = str[start:end].decode('utf-8')
00186       else:
00187         self.header.frame_id = str[start:end]
00188       self.tactiles = []
00189       for i in range(0, 5):
00190         val1 = sr_robot_msgs.msg.Biotac()
00191         _x = val1
00192         start = end
00193         end += 10
00194         (_x.pac0, _x.pac1, _x.pdc, _x.tac, _x.tdc,) = _struct_5h.unpack(str[start:end])
00195         start = end
00196         end += 38
00197         val1.electrodes = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=19)
00198         self.tactiles.append(val1)
00199       return self
00200     except struct.error as e:
00201       raise genpy.DeserializationError(e) #most likely buffer underfill
00202 
00203 _struct_I = genpy.struct_I
00204 _struct_3I = struct.Struct("<3I")
00205 _struct_5h = struct.Struct("<5h")
00206 _struct_19h = struct.Struct("<19h")


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