$search
00001 """autogenerated by genmsg_py from Digital.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class Digital(roslib.message.Message): 00008 _md5sum = "84d79480c76268c7cdf109dc588e00c4" 00009 _type = "arbotix_msgs/Digital" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """# Reading or command to a single digital IO pin. 00012 Header header 00013 00014 # value of pin 00015 uint8 LOW=0 00016 uint8 HIGH=255 00017 00018 uint8 value 00019 00020 # direction of pin 00021 uint8 INPUT=0 00022 uint8 OUTPUT=255 00023 00024 uint8 direction 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 # Pseudo-constants 00046 LOW = 0 00047 HIGH = 255 00048 INPUT = 0 00049 OUTPUT = 255 00050 00051 __slots__ = ['header','value','direction'] 00052 _slot_types = ['Header','uint8','uint8'] 00053 00054 def __init__(self, *args, **kwds): 00055 """ 00056 Constructor. Any message fields that are implicitly/explicitly 00057 set to None will be assigned a default value. The recommend 00058 use is keyword arguments as this is more robust to future message 00059 changes. You cannot mix in-order arguments and keyword arguments. 00060 00061 The available fields are: 00062 header,value,direction 00063 00064 @param args: complete set of field values, in .msg order 00065 @param kwds: use keyword arguments corresponding to message field names 00066 to set specific fields. 00067 """ 00068 if args or kwds: 00069 super(Digital, self).__init__(*args, **kwds) 00070 #message fields cannot be None, assign default values for those that are 00071 if self.header is None: 00072 self.header = std_msgs.msg._Header.Header() 00073 if self.value is None: 00074 self.value = 0 00075 if self.direction is None: 00076 self.direction = 0 00077 else: 00078 self.header = std_msgs.msg._Header.Header() 00079 self.value = 0 00080 self.direction = 0 00081 00082 def _get_types(self): 00083 """ 00084 internal API method 00085 """ 00086 return self._slot_types 00087 00088 def serialize(self, buff): 00089 """ 00090 serialize message into buffer 00091 @param buff: buffer 00092 @type buff: StringIO 00093 """ 00094 try: 00095 _x = self 00096 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00097 _x = self.header.frame_id 00098 length = len(_x) 00099 buff.write(struct.pack('<I%ss'%length, length, _x)) 00100 _x = self 00101 buff.write(_struct_2B.pack(_x.value, _x.direction)) 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 00109 @type str: str 00110 """ 00111 try: 00112 if self.header is None: 00113 self.header = std_msgs.msg._Header.Header() 00114 end = 0 00115 _x = self 00116 start = end 00117 end += 12 00118 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00119 start = end 00120 end += 4 00121 (length,) = _struct_I.unpack(str[start:end]) 00122 start = end 00123 end += length 00124 self.header.frame_id = str[start:end] 00125 _x = self 00126 start = end 00127 end += 2 00128 (_x.value, _x.direction,) = _struct_2B.unpack(str[start:end]) 00129 return self 00130 except struct.error as e: 00131 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00132 00133 00134 def serialize_numpy(self, buff, numpy): 00135 """ 00136 serialize message with numpy array types into buffer 00137 @param buff: buffer 00138 @type buff: StringIO 00139 @param numpy: numpy python module 00140 @type numpy module 00141 """ 00142 try: 00143 _x = self 00144 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00145 _x = self.header.frame_id 00146 length = len(_x) 00147 buff.write(struct.pack('<I%ss'%length, length, _x)) 00148 _x = self 00149 buff.write(_struct_2B.pack(_x.value, _x.direction)) 00150 except struct.error as se: self._check_types(se) 00151 except TypeError as te: self._check_types(te) 00152 00153 def deserialize_numpy(self, str, numpy): 00154 """ 00155 unpack serialized message in str into this message instance using numpy for array types 00156 @param str: byte array of serialized message 00157 @type str: str 00158 @param numpy: numpy python module 00159 @type numpy: module 00160 """ 00161 try: 00162 if self.header is None: 00163 self.header = std_msgs.msg._Header.Header() 00164 end = 0 00165 _x = self 00166 start = end 00167 end += 12 00168 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00169 start = end 00170 end += 4 00171 (length,) = _struct_I.unpack(str[start:end]) 00172 start = end 00173 end += length 00174 self.header.frame_id = str[start:end] 00175 _x = self 00176 start = end 00177 end += 2 00178 (_x.value, _x.direction,) = _struct_2B.unpack(str[start:end]) 00179 return self 00180 except struct.error as e: 00181 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00182 00183 _struct_I = roslib.message.struct_I 00184 _struct_3I = struct.Struct("<3I") 00185 _struct_2B = struct.Struct("<2B")