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