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


clearpath_base
Author(s): Mike Purvis
autogenerated on Sat Dec 28 2013 16:50:47