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


iri_common_drivers_msgs
Author(s): Marti Morta, mmorta at iri.upc.ed
autogenerated on Fri Dec 6 2013 19:59:37