$search
00001 """autogenerated by genmsg_py from smi540meas.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class smi540meas(roslib.message.Message): 00008 _md5sum = "0dbe54f84ea8052406fa280d1c1f5801" 00009 _type = "smi540/smi540meas" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 string strIdSubDev 00013 int16[] iChipSelect 00014 float64[] fAcclX 00015 float64[] fAcclY 00016 float64[] fRateZ 00017 00018 00019 00020 ================================================================================ 00021 MSG: std_msgs/Header 00022 # Standard metadata for higher-level stamped data types. 00023 # This is generally used to communicate timestamped data 00024 # in a particular coordinate frame. 00025 # 00026 # sequence ID: consecutively increasing ID 00027 uint32 seq 00028 #Two-integer timestamp that is expressed as: 00029 # * stamp.secs: seconds (stamp_secs) since epoch 00030 # * stamp.nsecs: nanoseconds since stamp_secs 00031 # time-handling sugar is provided by the client library 00032 time stamp 00033 #Frame this data is associated with 00034 # 0: no frame 00035 # 1: global frame 00036 string frame_id 00037 00038 """ 00039 __slots__ = ['header','strIdSubDev','iChipSelect','fAcclX','fAcclY','fRateZ'] 00040 _slot_types = ['Header','string','int16[]','float64[]','float64[]','float64[]'] 00041 00042 def __init__(self, *args, **kwds): 00043 """ 00044 Constructor. Any message fields that are implicitly/explicitly 00045 set to None will be assigned a default value. The recommend 00046 use is keyword arguments as this is more robust to future message 00047 changes. You cannot mix in-order arguments and keyword arguments. 00048 00049 The available fields are: 00050 header,strIdSubDev,iChipSelect,fAcclX,fAcclY,fRateZ 00051 00052 @param args: complete set of field values, in .msg order 00053 @param kwds: use keyword arguments corresponding to message field names 00054 to set specific fields. 00055 """ 00056 if args or kwds: 00057 super(smi540meas, self).__init__(*args, **kwds) 00058 #message fields cannot be None, assign default values for those that are 00059 if self.header is None: 00060 self.header = std_msgs.msg._Header.Header() 00061 if self.strIdSubDev is None: 00062 self.strIdSubDev = '' 00063 if self.iChipSelect is None: 00064 self.iChipSelect = [] 00065 if self.fAcclX is None: 00066 self.fAcclX = [] 00067 if self.fAcclY is None: 00068 self.fAcclY = [] 00069 if self.fRateZ is None: 00070 self.fRateZ = [] 00071 else: 00072 self.header = std_msgs.msg._Header.Header() 00073 self.strIdSubDev = '' 00074 self.iChipSelect = [] 00075 self.fAcclX = [] 00076 self.fAcclY = [] 00077 self.fRateZ = [] 00078 00079 def _get_types(self): 00080 """ 00081 internal API method 00082 """ 00083 return self._slot_types 00084 00085 def serialize(self, buff): 00086 """ 00087 serialize message into buffer 00088 @param buff: buffer 00089 @type buff: StringIO 00090 """ 00091 try: 00092 _x = self 00093 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00094 _x = self.header.frame_id 00095 length = len(_x) 00096 buff.write(struct.pack('<I%ss'%length, length, _x)) 00097 _x = self.strIdSubDev 00098 length = len(_x) 00099 buff.write(struct.pack('<I%ss'%length, length, _x)) 00100 length = len(self.iChipSelect) 00101 buff.write(_struct_I.pack(length)) 00102 pattern = '<%sh'%length 00103 buff.write(struct.pack(pattern, *self.iChipSelect)) 00104 length = len(self.fAcclX) 00105 buff.write(_struct_I.pack(length)) 00106 pattern = '<%sd'%length 00107 buff.write(struct.pack(pattern, *self.fAcclX)) 00108 length = len(self.fAcclY) 00109 buff.write(_struct_I.pack(length)) 00110 pattern = '<%sd'%length 00111 buff.write(struct.pack(pattern, *self.fAcclY)) 00112 length = len(self.fRateZ) 00113 buff.write(_struct_I.pack(length)) 00114 pattern = '<%sd'%length 00115 buff.write(struct.pack(pattern, *self.fRateZ)) 00116 except struct.error as se: self._check_types(se) 00117 except TypeError as te: self._check_types(te) 00118 00119 def deserialize(self, str): 00120 """ 00121 unpack serialized message in str into this message instance 00122 @param str: byte array of serialized message 00123 @type str: str 00124 """ 00125 try: 00126 if self.header is None: 00127 self.header = std_msgs.msg._Header.Header() 00128 end = 0 00129 _x = self 00130 start = end 00131 end += 12 00132 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00133 start = end 00134 end += 4 00135 (length,) = _struct_I.unpack(str[start:end]) 00136 start = end 00137 end += length 00138 self.header.frame_id = str[start:end] 00139 start = end 00140 end += 4 00141 (length,) = _struct_I.unpack(str[start:end]) 00142 start = end 00143 end += length 00144 self.strIdSubDev = str[start:end] 00145 start = end 00146 end += 4 00147 (length,) = _struct_I.unpack(str[start:end]) 00148 pattern = '<%sh'%length 00149 start = end 00150 end += struct.calcsize(pattern) 00151 self.iChipSelect = struct.unpack(pattern, str[start:end]) 00152 start = end 00153 end += 4 00154 (length,) = _struct_I.unpack(str[start:end]) 00155 pattern = '<%sd'%length 00156 start = end 00157 end += struct.calcsize(pattern) 00158 self.fAcclX = struct.unpack(pattern, str[start:end]) 00159 start = end 00160 end += 4 00161 (length,) = _struct_I.unpack(str[start:end]) 00162 pattern = '<%sd'%length 00163 start = end 00164 end += struct.calcsize(pattern) 00165 self.fAcclY = struct.unpack(pattern, str[start:end]) 00166 start = end 00167 end += 4 00168 (length,) = _struct_I.unpack(str[start:end]) 00169 pattern = '<%sd'%length 00170 start = end 00171 end += struct.calcsize(pattern) 00172 self.fRateZ = struct.unpack(pattern, str[start:end]) 00173 return self 00174 except struct.error as e: 00175 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00176 00177 00178 def serialize_numpy(self, buff, numpy): 00179 """ 00180 serialize message with numpy array types into buffer 00181 @param buff: buffer 00182 @type buff: StringIO 00183 @param numpy: numpy python module 00184 @type numpy module 00185 """ 00186 try: 00187 _x = self 00188 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00189 _x = self.header.frame_id 00190 length = len(_x) 00191 buff.write(struct.pack('<I%ss'%length, length, _x)) 00192 _x = self.strIdSubDev 00193 length = len(_x) 00194 buff.write(struct.pack('<I%ss'%length, length, _x)) 00195 length = len(self.iChipSelect) 00196 buff.write(_struct_I.pack(length)) 00197 pattern = '<%sh'%length 00198 buff.write(self.iChipSelect.tostring()) 00199 length = len(self.fAcclX) 00200 buff.write(_struct_I.pack(length)) 00201 pattern = '<%sd'%length 00202 buff.write(self.fAcclX.tostring()) 00203 length = len(self.fAcclY) 00204 buff.write(_struct_I.pack(length)) 00205 pattern = '<%sd'%length 00206 buff.write(self.fAcclY.tostring()) 00207 length = len(self.fRateZ) 00208 buff.write(_struct_I.pack(length)) 00209 pattern = '<%sd'%length 00210 buff.write(self.fRateZ.tostring()) 00211 except struct.error as se: self._check_types(se) 00212 except TypeError as te: self._check_types(te) 00213 00214 def deserialize_numpy(self, str, numpy): 00215 """ 00216 unpack serialized message in str into this message instance using numpy for array types 00217 @param str: byte array of serialized message 00218 @type str: str 00219 @param numpy: numpy python module 00220 @type numpy: module 00221 """ 00222 try: 00223 if self.header is None: 00224 self.header = std_msgs.msg._Header.Header() 00225 end = 0 00226 _x = self 00227 start = end 00228 end += 12 00229 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00230 start = end 00231 end += 4 00232 (length,) = _struct_I.unpack(str[start:end]) 00233 start = end 00234 end += length 00235 self.header.frame_id = str[start:end] 00236 start = end 00237 end += 4 00238 (length,) = _struct_I.unpack(str[start:end]) 00239 start = end 00240 end += length 00241 self.strIdSubDev = str[start:end] 00242 start = end 00243 end += 4 00244 (length,) = _struct_I.unpack(str[start:end]) 00245 pattern = '<%sh'%length 00246 start = end 00247 end += struct.calcsize(pattern) 00248 self.iChipSelect = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length) 00249 start = end 00250 end += 4 00251 (length,) = _struct_I.unpack(str[start:end]) 00252 pattern = '<%sd'%length 00253 start = end 00254 end += struct.calcsize(pattern) 00255 self.fAcclX = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00256 start = end 00257 end += 4 00258 (length,) = _struct_I.unpack(str[start:end]) 00259 pattern = '<%sd'%length 00260 start = end 00261 end += struct.calcsize(pattern) 00262 self.fAcclY = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00263 start = end 00264 end += 4 00265 (length,) = _struct_I.unpack(str[start:end]) 00266 pattern = '<%sd'%length 00267 start = end 00268 end += struct.calcsize(pattern) 00269 self.fRateZ = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00270 return self 00271 except struct.error as e: 00272 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00273 00274 _struct_I = roslib.message.struct_I 00275 _struct_3I = struct.Struct("<3I")