$search
00001 """autogenerated by genmsg_py from Tactile.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class Tactile(roslib.message.Message): 00008 _md5sum = "0f9585f47779b9607f760bef85a254c0" 00009 _type = "sr_robot_msgs/Tactile" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """std_msgs/Int16[] data 00012 00013 ================================================================================ 00014 MSG: std_msgs/Int16 00015 int16 data 00016 00017 """ 00018 __slots__ = ['data'] 00019 _slot_types = ['std_msgs/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 data 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(Tactile, self).__init__(*args, **kwds) 00037 #message fields cannot be None, assign default values for those that are 00038 if self.data is None: 00039 self.data = [] 00040 else: 00041 self.data = [] 00042 00043 def _get_types(self): 00044 """ 00045 internal API method 00046 """ 00047 return self._slot_types 00048 00049 def serialize(self, buff): 00050 """ 00051 serialize message into buffer 00052 @param buff: buffer 00053 @type buff: StringIO 00054 """ 00055 try: 00056 length = len(self.data) 00057 buff.write(_struct_I.pack(length)) 00058 for val1 in self.data: 00059 buff.write(_struct_h.pack(val1.data)) 00060 except struct.error as se: self._check_types(se) 00061 except TypeError as te: self._check_types(te) 00062 00063 def deserialize(self, str): 00064 """ 00065 unpack serialized message in str into this message instance 00066 @param str: byte array of serialized message 00067 @type str: str 00068 """ 00069 try: 00070 end = 0 00071 start = end 00072 end += 4 00073 (length,) = _struct_I.unpack(str[start:end]) 00074 self.data = [] 00075 for i in range(0, length): 00076 val1 = std_msgs.msg.Int16() 00077 start = end 00078 end += 2 00079 (val1.data,) = _struct_h.unpack(str[start:end]) 00080 self.data.append(val1) 00081 return self 00082 except struct.error as e: 00083 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00084 00085 00086 def serialize_numpy(self, buff, numpy): 00087 """ 00088 serialize message with numpy array types into buffer 00089 @param buff: buffer 00090 @type buff: StringIO 00091 @param numpy: numpy python module 00092 @type numpy 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(se) 00100 except TypeError as te: self._check_types(te) 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 00106 @type str: str 00107 @param numpy: numpy python module 00108 @type numpy: module 00109 """ 00110 try: 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 roslib.message.DeserializationError(e) #most likely buffer underfill 00125 00126 _struct_I = roslib.message.struct_I 00127 _struct_h = struct.Struct("<h")