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