_state.py
Go to the documentation of this file.
00001 """autogenerated by genpy from corobot_msgs/state.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 state(genpy.Message):
00010   _md5sum = "c7a0547781edb72de7e1029e06a00010"
00011   _type = "corobot_msgs/state"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header  header
00014 string  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','string']
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(state, 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 = ''
00059     else:
00060       self.header = std_msgs.msg.Header()
00061       self.state = ''
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       _x = self.state
00084       length = len(_x)
00085       if python3 or type(_x) == unicode:
00086         _x = _x.encode('utf-8')
00087         length = len(_x)
00088       buff.write(struct.pack('<I%ss'%length, length, _x))
00089     except struct.error as se: self._check_types(se)
00090     except TypeError as te: self._check_types(te)
00091 
00092   def deserialize(self, str):
00093     """
00094     unpack serialized message in str into this message instance
00095     :param str: byte array of serialized message, ``str``
00096     """
00097     try:
00098       if self.header is None:
00099         self.header = std_msgs.msg.Header()
00100       end = 0
00101       _x = self
00102       start = end
00103       end += 12
00104       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       start = end
00109       end += length
00110       if python3:
00111         self.header.frame_id = str[start:end].decode('utf-8')
00112       else:
00113         self.header.frame_id = str[start:end]
00114       start = end
00115       end += 4
00116       (length,) = _struct_I.unpack(str[start:end])
00117       start = end
00118       end += length
00119       if python3:
00120         self.state = str[start:end].decode('utf-8')
00121       else:
00122         self.state = str[start:end]
00123       return self
00124     except struct.error as e:
00125       raise genpy.DeserializationError(e) #most likely buffer underfill
00126 
00127 
00128   def serialize_numpy(self, buff, numpy):
00129     """
00130     serialize message with numpy array types into buffer
00131     :param buff: buffer, ``StringIO``
00132     :param numpy: numpy python module
00133     """
00134     try:
00135       _x = self
00136       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00137       _x = self.header.frame_id
00138       length = len(_x)
00139       if python3 or type(_x) == unicode:
00140         _x = _x.encode('utf-8')
00141         length = len(_x)
00142       buff.write(struct.pack('<I%ss'%length, length, _x))
00143       _x = self.state
00144       length = len(_x)
00145       if python3 or type(_x) == unicode:
00146         _x = _x.encode('utf-8')
00147         length = len(_x)
00148       buff.write(struct.pack('<I%ss'%length, length, _x))
00149     except struct.error as se: self._check_types(se)
00150     except TypeError as te: self._check_types(te)
00151 
00152   def deserialize_numpy(self, str, numpy):
00153     """
00154     unpack serialized message in str into this message instance using numpy for array types
00155     :param str: byte array of serialized message, ``str``
00156     :param numpy: numpy python module
00157     """
00158     try:
00159       if self.header is None:
00160         self.header = std_msgs.msg.Header()
00161       end = 0
00162       _x = self
00163       start = end
00164       end += 12
00165       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00166       start = end
00167       end += 4
00168       (length,) = _struct_I.unpack(str[start:end])
00169       start = end
00170       end += length
00171       if python3:
00172         self.header.frame_id = str[start:end].decode('utf-8')
00173       else:
00174         self.header.frame_id = str[start:end]
00175       start = end
00176       end += 4
00177       (length,) = _struct_I.unpack(str[start:end])
00178       start = end
00179       end += length
00180       if python3:
00181         self.state = str[start:end].decode('utf-8')
00182       else:
00183         self.state = str[start:end]
00184       return self
00185     except struct.error as e:
00186       raise genpy.DeserializationError(e) #most likely buffer underfill
00187 
00188 _struct_I = genpy.struct_I
00189 _struct_3I = struct.Struct("<3I")


corobot_msgs
Author(s): Morgan Cormier/mcormier@coroware.com
autogenerated on Tue Jan 7 2014 11:38:41