_Analog.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arbotix_msgs/Analog.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 Analog(genpy.Message):
00010   _md5sum = "90539346f3c3c8fc47f159ab9a6ff208"
00011   _type = "arbotix_msgs/Analog"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """# Reading from a single analog IO pin.
00014 Header header
00015 uint8 value
00016 
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','value']
00037   _slot_types = ['std_msgs/Header','uint8']
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,value
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(Analog, 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.value is None:
00059         self.value = 0
00060     else:
00061       self.header = std_msgs.msg.Header()
00062       self.value = 0
00063 
00064   def _get_types(self):
00065     """
00066     internal API method
00067     """
00068     return self._slot_types
00069 
00070   def serialize(self, buff):
00071     """
00072     serialize message into buffer
00073     :param buff: buffer, ``StringIO``
00074     """
00075     try:
00076       _x = self
00077       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00078       _x = self.header.frame_id
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084       buff.write(_struct_B.pack(self.value))
00085     except struct.error as se: self._check_types(se)
00086     except TypeError as te: self._check_types(te)
00087 
00088   def deserialize(self, str):
00089     """
00090     unpack serialized message in str into this message instance
00091     :param str: byte array of serialized message, ``str``
00092     """
00093     try:
00094       if self.header is None:
00095         self.header = std_msgs.msg.Header()
00096       end = 0
00097       _x = self
00098       start = end
00099       end += 12
00100       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       start = end
00105       end += length
00106       if python3:
00107         self.header.frame_id = str[start:end].decode('utf-8')
00108       else:
00109         self.header.frame_id = str[start:end]
00110       start = end
00111       end += 1
00112       (self.value,) = _struct_B.unpack(str[start:end])
00113       return self
00114     except struct.error as e:
00115       raise genpy.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, ``StringIO``
00122     :param numpy: numpy python module
00123     """
00124     try:
00125       _x = self
00126       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00127       _x = self.header.frame_id
00128       length = len(_x)
00129       if python3 or type(_x) == unicode:
00130         _x = _x.encode('utf-8')
00131         length = len(_x)
00132       buff.write(struct.pack('<I%ss'%length, length, _x))
00133       buff.write(_struct_B.pack(self.value))
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, ``str``
00141     :param numpy: numpy python module
00142     """
00143     try:
00144       if self.header is None:
00145         self.header = std_msgs.msg.Header()
00146       end = 0
00147       _x = self
00148       start = end
00149       end += 12
00150       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.header.frame_id = str[start:end].decode('utf-8')
00158       else:
00159         self.header.frame_id = str[start:end]
00160       start = end
00161       end += 1
00162       (self.value,) = _struct_B.unpack(str[start:end])
00163       return self
00164     except struct.error as e:
00165       raise genpy.DeserializationError(e) #most likely buffer underfill
00166 
00167 _struct_I = genpy.struct_I
00168 _struct_3I = struct.Struct("<3I")
00169 _struct_B = struct.Struct("<B")


arbotix_msgs
Author(s): Michael Ferguson
autogenerated on Sat Dec 28 2013 16:46:08