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


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