$search
00001 """autogenerated by genmsg_py from Magnetometer.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class Magnetometer(roslib.message.Message): 00008 _md5sum = "5defbd163657b4f6f639ba6d5676cc01" 00009 _type = "clearpath_base/Magnetometer" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 float64 x 00013 float64 y 00014 float64 z 00015 ================================================================================ 00016 MSG: std_msgs/Header 00017 # Standard metadata for higher-level stamped data types. 00018 # This is generally used to communicate timestamped data 00019 # in a particular coordinate frame. 00020 # 00021 # sequence ID: consecutively increasing ID 00022 uint32 seq 00023 #Two-integer timestamp that is expressed as: 00024 # * stamp.secs: seconds (stamp_secs) since epoch 00025 # * stamp.nsecs: nanoseconds since stamp_secs 00026 # time-handling sugar is provided by the client library 00027 time stamp 00028 #Frame this data is associated with 00029 # 0: no frame 00030 # 1: global frame 00031 string frame_id 00032 00033 """ 00034 __slots__ = ['header','x','y','z'] 00035 _slot_types = ['Header','float64','float64','float64'] 00036 00037 def __init__(self, *args, **kwds): 00038 """ 00039 Constructor. Any message fields that are implicitly/explicitly 00040 set to None will be assigned a default value. The recommend 00041 use is keyword arguments as this is more robust to future message 00042 changes. You cannot mix in-order arguments and keyword arguments. 00043 00044 The available fields are: 00045 header,x,y,z 00046 00047 @param args: complete set of field values, in .msg order 00048 @param kwds: use keyword arguments corresponding to message field names 00049 to set specific fields. 00050 """ 00051 if args or kwds: 00052 super(Magnetometer, self).__init__(*args, **kwds) 00053 #message fields cannot be None, assign default values for those that are 00054 if self.header is None: 00055 self.header = std_msgs.msg._Header.Header() 00056 if self.x is None: 00057 self.x = 0. 00058 if self.y is None: 00059 self.y = 0. 00060 if self.z is None: 00061 self.z = 0. 00062 else: 00063 self.header = std_msgs.msg._Header.Header() 00064 self.x = 0. 00065 self.y = 0. 00066 self.z = 0. 00067 00068 def _get_types(self): 00069 """ 00070 internal API method 00071 """ 00072 return self._slot_types 00073 00074 def serialize(self, buff): 00075 """ 00076 serialize message into buffer 00077 @param buff: buffer 00078 @type buff: StringIO 00079 """ 00080 try: 00081 _x = self 00082 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00083 _x = self.header.frame_id 00084 length = len(_x) 00085 buff.write(struct.pack('<I%ss'%length, length, _x)) 00086 _x = self 00087 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00088 except struct.error as se: self._check_types(se) 00089 except TypeError as te: self._check_types(te) 00090 00091 def deserialize(self, str): 00092 """ 00093 unpack serialized message in str into this message instance 00094 @param str: byte array of serialized message 00095 @type str: str 00096 """ 00097 try: 00098 if self.header is None: 00099 self.header = std_msgs.msg._Header.Header() 00100 end = 0 00101 _x = self 00102 start = end 00103 end += 12 00104 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00105 start = end 00106 end += 4 00107 (length,) = _struct_I.unpack(str[start:end]) 00108 start = end 00109 end += length 00110 self.header.frame_id = str[start:end] 00111 _x = self 00112 start = end 00113 end += 24 00114 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00115 return self 00116 except struct.error as e: 00117 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00118 00119 00120 def serialize_numpy(self, buff, numpy): 00121 """ 00122 serialize message with numpy array types into buffer 00123 @param buff: buffer 00124 @type buff: StringIO 00125 @param numpy: numpy python module 00126 @type numpy module 00127 """ 00128 try: 00129 _x = self 00130 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00131 _x = self.header.frame_id 00132 length = len(_x) 00133 buff.write(struct.pack('<I%ss'%length, length, _x)) 00134 _x = self 00135 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00136 except struct.error as se: self._check_types(se) 00137 except TypeError as te: self._check_types(te) 00138 00139 def deserialize_numpy(self, str, numpy): 00140 """ 00141 unpack serialized message in str into this message instance using numpy for array types 00142 @param str: byte array of serialized message 00143 @type str: str 00144 @param numpy: numpy python module 00145 @type numpy: module 00146 """ 00147 try: 00148 if self.header is None: 00149 self.header = std_msgs.msg._Header.Header() 00150 end = 0 00151 _x = self 00152 start = end 00153 end += 12 00154 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00155 start = end 00156 end += 4 00157 (length,) = _struct_I.unpack(str[start:end]) 00158 start = end 00159 end += length 00160 self.header.frame_id = str[start:end] 00161 _x = self 00162 start = end 00163 end += 24 00164 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00165 return self 00166 except struct.error as e: 00167 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00168 00169 _struct_I = roslib.message.struct_I 00170 _struct_3I = struct.Struct("<3I") 00171 _struct_3d = struct.Struct("<3d")