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