_TactileMatrix.py
Go to the documentation of this file.
00001 """autogenerated by genpy from schunk_sdh/TactileMatrix.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 TactileMatrix(genpy.Message):
00009   _md5sum = "ab718b6c1d4d719110707994d2e325e4"
00010   _type = "schunk_sdh/TactileMatrix"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """uint32 matrix_id
00013 int16 cells_x
00014 int16 cells_y
00015 int16[] tactile_array
00016 
00017 """
00018   __slots__ = ['matrix_id','cells_x','cells_y','tactile_array']
00019   _slot_types = ['uint32','int16','int16','int16[]']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        matrix_id,cells_x,cells_y,tactile_array
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(TactileMatrix, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.matrix_id is None:
00039         self.matrix_id = 0
00040       if self.cells_x is None:
00041         self.cells_x = 0
00042       if self.cells_y is None:
00043         self.cells_y = 0
00044       if self.tactile_array is None:
00045         self.tactile_array = []
00046     else:
00047       self.matrix_id = 0
00048       self.cells_x = 0
00049       self.cells_y = 0
00050       self.tactile_array = []
00051 
00052   def _get_types(self):
00053     """
00054     internal API method
00055     """
00056     return self._slot_types
00057 
00058   def serialize(self, buff):
00059     """
00060     serialize message into buffer
00061     :param buff: buffer, ``StringIO``
00062     """
00063     try:
00064       _x = self
00065       buff.write(_struct_I2h.pack(_x.matrix_id, _x.cells_x, _x.cells_y))
00066       length = len(self.tactile_array)
00067       buff.write(_struct_I.pack(length))
00068       pattern = '<%sh'%length
00069       buff.write(struct.pack(pattern, *self.tactile_array))
00070     except struct.error as se: self._check_types(se)
00071     except TypeError as te: self._check_types(te)
00072 
00073   def deserialize(self, str):
00074     """
00075     unpack serialized message in str into this message instance
00076     :param str: byte array of serialized message, ``str``
00077     """
00078     try:
00079       end = 0
00080       _x = self
00081       start = end
00082       end += 8
00083       (_x.matrix_id, _x.cells_x, _x.cells_y,) = _struct_I2h.unpack(str[start:end])
00084       start = end
00085       end += 4
00086       (length,) = _struct_I.unpack(str[start:end])
00087       pattern = '<%sh'%length
00088       start = end
00089       end += struct.calcsize(pattern)
00090       self.tactile_array = struct.unpack(pattern, str[start:end])
00091       return self
00092     except struct.error as e:
00093       raise genpy.DeserializationError(e) #most likely buffer underfill
00094 
00095 
00096   def serialize_numpy(self, buff, numpy):
00097     """
00098     serialize message with numpy array types into buffer
00099     :param buff: buffer, ``StringIO``
00100     :param numpy: numpy python module
00101     """
00102     try:
00103       _x = self
00104       buff.write(_struct_I2h.pack(_x.matrix_id, _x.cells_x, _x.cells_y))
00105       length = len(self.tactile_array)
00106       buff.write(_struct_I.pack(length))
00107       pattern = '<%sh'%length
00108       buff.write(self.tactile_array.tostring())
00109     except struct.error as se: self._check_types(se)
00110     except TypeError as te: self._check_types(te)
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 += 8
00123       (_x.matrix_id, _x.cells_x, _x.cells_y,) = _struct_I2h.unpack(str[start:end])
00124       start = end
00125       end += 4
00126       (length,) = _struct_I.unpack(str[start:end])
00127       pattern = '<%sh'%length
00128       start = end
00129       end += struct.calcsize(pattern)
00130       self.tactile_array = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_I2h = struct.Struct("<I2h")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


schunk_sdh
Author(s): Florian Weisshardt
autogenerated on Tue Mar 5 2013 14:44:11