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


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