$search
00001 """autogenerated by genmsg_py from AsebaEvent.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslib.rostime 00006 00007 class AsebaEvent(roslib.message.Message): 00008 _md5sum = "49995036bad52e061c5fd515a11fffd7" 00009 _type = "asebaros/AsebaEvent" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """time stamp 00012 uint16 source 00013 int16[] data 00014 00015 """ 00016 __slots__ = ['stamp','source','data'] 00017 _slot_types = ['time','uint16','int16[]'] 00018 00019 def __init__(self, *args, **kwds): 00020 """ 00021 Constructor. Any message fields that are implicitly/explicitly 00022 set to None will be assigned a default value. The recommend 00023 use is keyword arguments as this is more robust to future message 00024 changes. You cannot mix in-order arguments and keyword arguments. 00025 00026 The available fields are: 00027 stamp,source,data 00028 00029 @param args: complete set of field values, in .msg order 00030 @param kwds: use keyword arguments corresponding to message field names 00031 to set specific fields. 00032 """ 00033 if args or kwds: 00034 super(AsebaEvent, self).__init__(*args, **kwds) 00035 #message fields cannot be None, assign default values for those that are 00036 if self.stamp is None: 00037 self.stamp = roslib.rostime.Time() 00038 if self.source is None: 00039 self.source = 0 00040 if self.data is None: 00041 self.data = [] 00042 else: 00043 self.stamp = roslib.rostime.Time() 00044 self.source = 0 00045 self.data = [] 00046 00047 def _get_types(self): 00048 """ 00049 internal API method 00050 """ 00051 return self._slot_types 00052 00053 def serialize(self, buff): 00054 """ 00055 serialize message into buffer 00056 @param buff: buffer 00057 @type buff: StringIO 00058 """ 00059 try: 00060 _x = self 00061 buff.write(_struct_2IH.pack(_x.stamp.secs, _x.stamp.nsecs, _x.source)) 00062 length = len(self.data) 00063 buff.write(_struct_I.pack(length)) 00064 pattern = '<%sh'%length 00065 buff.write(struct.pack(pattern, *self.data)) 00066 except struct.error as se: self._check_types(se) 00067 except TypeError as te: self._check_types(te) 00068 00069 def deserialize(self, str): 00070 """ 00071 unpack serialized message in str into this message instance 00072 @param str: byte array of serialized message 00073 @type str: str 00074 """ 00075 try: 00076 if self.stamp is None: 00077 self.stamp = roslib.rostime.Time() 00078 end = 0 00079 _x = self 00080 start = end 00081 end += 10 00082 (_x.stamp.secs, _x.stamp.nsecs, _x.source,) = _struct_2IH.unpack(str[start:end]) 00083 start = end 00084 end += 4 00085 (length,) = _struct_I.unpack(str[start:end]) 00086 pattern = '<%sh'%length 00087 start = end 00088 end += struct.calcsize(pattern) 00089 self.data = struct.unpack(pattern, str[start:end]) 00090 self.stamp.canon() 00091 return self 00092 except struct.error as e: 00093 raise roslib.message.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 00100 @type buff: StringIO 00101 @param numpy: numpy python module 00102 @type numpy module 00103 """ 00104 try: 00105 _x = self 00106 buff.write(_struct_2IH.pack(_x.stamp.secs, _x.stamp.nsecs, _x.source)) 00107 length = len(self.data) 00108 buff.write(_struct_I.pack(length)) 00109 pattern = '<%sh'%length 00110 buff.write(self.data.tostring()) 00111 except struct.error as se: self._check_types(se) 00112 except TypeError as te: self._check_types(te) 00113 00114 def deserialize_numpy(self, str, numpy): 00115 """ 00116 unpack serialized message in str into this message instance using numpy for array types 00117 @param str: byte array of serialized message 00118 @type str: str 00119 @param numpy: numpy python module 00120 @type numpy: module 00121 """ 00122 try: 00123 if self.stamp is None: 00124 self.stamp = roslib.rostime.Time() 00125 end = 0 00126 _x = self 00127 start = end 00128 end += 10 00129 (_x.stamp.secs, _x.stamp.nsecs, _x.source,) = _struct_2IH.unpack(str[start:end]) 00130 start = end 00131 end += 4 00132 (length,) = _struct_I.unpack(str[start:end]) 00133 pattern = '<%sh'%length 00134 start = end 00135 end += struct.calcsize(pattern) 00136 self.data = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00137 self.stamp.canon() 00138 return self 00139 except struct.error as e: 00140 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00141 00142 _struct_I = roslib.message.struct_I 00143 _struct_2IH = struct.Struct("<2IH")