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


ros_arduino_msgs
Author(s): Patrick Goebel
autogenerated on Thu Nov 21 2013 12:10:01