_RoombaSwitch.py
Go to the documentation of this file.
00001 """autogenerated by genpy from roomba_500_series/RoombaSwitch.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 RoombaSwitch(genpy.Message):
00010   _md5sum = "0821670ec5c727dca6fe68a1bf54ae6c"
00011   _type = "roomba_500_series/RoombaSwitch"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 bool state
00015 
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','state']
00036   _slot_types = ['std_msgs/Header','bool']
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,state
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(RoombaSwitch, 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.state is None:
00058         self.state = False
00059     else:
00060       self.header = std_msgs.msg.Header()
00061       self.state = False
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_B.pack(self.state))
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 += 1
00111       (self.state,) = _struct_B.unpack(str[start:end])
00112       self.state = bool(self.state)
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.state))
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.state,) = _struct_B.unpack(str[start:end])
00163       self.state = bool(self.state)
00164       return self
00165     except struct.error as e:
00166       raise genpy.DeserializationError(e) #most likely buffer underfill
00167 
00168 _struct_I = genpy.struct_I
00169 _struct_3I = struct.Struct("<3I")
00170 _struct_B = struct.Struct("<B")


roomba_500_series
Author(s): Gonçalo Cabrita
autogenerated on Mon Jan 6 2014 11:26:40