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