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


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