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


hector_uav_msgs
Author(s): Johannes Meyer
autogenerated on Mon Oct 6 2014 00:29:22