$search
00001 """autogenerated by genmsg_py from SpawnRequest.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class SpawnRequest(roslib.message.Message): 00007 _md5sum = "57f001c49ab7b11d699f8606c1f4f7ff" 00008 _type = "turtlesim/SpawnRequest" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """float32 x 00011 float32 y 00012 float32 theta 00013 string name 00014 00015 """ 00016 __slots__ = ['x','y','theta','name'] 00017 _slot_types = ['float32','float32','float32','string'] 00018 00019 def __init__(self, *args, **kwds): 00020 """ 00021 Constructor. Any message fields that are implicitly/explicitly 00022 set to None will be assigned a default value. The recommend 00023 use is keyword arguments as this is more robust to future message 00024 changes. You cannot mix in-order arguments and keyword arguments. 00025 00026 The available fields are: 00027 x,y,theta,name 00028 00029 @param args: complete set of field values, in .msg order 00030 @param kwds: use keyword arguments corresponding to message field names 00031 to set specific fields. 00032 """ 00033 if args or kwds: 00034 super(SpawnRequest, self).__init__(*args, **kwds) 00035 #message fields cannot be None, assign default values for those that are 00036 if self.x is None: 00037 self.x = 0. 00038 if self.y is None: 00039 self.y = 0. 00040 if self.theta is None: 00041 self.theta = 0. 00042 if self.name is None: 00043 self.name = '' 00044 else: 00045 self.x = 0. 00046 self.y = 0. 00047 self.theta = 0. 00048 self.name = '' 00049 00050 def _get_types(self): 00051 """ 00052 internal API method 00053 """ 00054 return self._slot_types 00055 00056 def serialize(self, buff): 00057 """ 00058 serialize message into buffer 00059 @param buff: buffer 00060 @type buff: StringIO 00061 """ 00062 try: 00063 _x = self 00064 buff.write(_struct_3f.pack(_x.x, _x.y, _x.theta)) 00065 _x = self.name 00066 length = len(_x) 00067 buff.write(struct.pack('<I%ss'%length, length, _x)) 00068 except struct.error as se: self._check_types(se) 00069 except TypeError as te: self._check_types(te) 00070 00071 def deserialize(self, str): 00072 """ 00073 unpack serialized message in str into this message instance 00074 @param str: byte array of serialized message 00075 @type str: str 00076 """ 00077 try: 00078 end = 0 00079 _x = self 00080 start = end 00081 end += 12 00082 (_x.x, _x.y, _x.theta,) = _struct_3f.unpack(str[start:end]) 00083 start = end 00084 end += 4 00085 (length,) = _struct_I.unpack(str[start:end]) 00086 start = end 00087 end += length 00088 self.name = str[start:end] 00089 return self 00090 except struct.error as e: 00091 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00092 00093 00094 def serialize_numpy(self, buff, numpy): 00095 """ 00096 serialize message with numpy array types into buffer 00097 @param buff: buffer 00098 @type buff: StringIO 00099 @param numpy: numpy python module 00100 @type numpy module 00101 """ 00102 try: 00103 _x = self 00104 buff.write(_struct_3f.pack(_x.x, _x.y, _x.theta)) 00105 _x = self.name 00106 length = len(_x) 00107 buff.write(struct.pack('<I%ss'%length, length, _x)) 00108 except struct.error as se: self._check_types(se) 00109 except TypeError as te: self._check_types(te) 00110 00111 def deserialize_numpy(self, str, numpy): 00112 """ 00113 unpack serialized message in str into this message instance using numpy for array types 00114 @param str: byte array of serialized message 00115 @type str: str 00116 @param numpy: numpy python module 00117 @type numpy: module 00118 """ 00119 try: 00120 end = 0 00121 _x = self 00122 start = end 00123 end += 12 00124 (_x.x, _x.y, _x.theta,) = _struct_3f.unpack(str[start:end]) 00125 start = end 00126 end += 4 00127 (length,) = _struct_I.unpack(str[start:end]) 00128 start = end 00129 end += length 00130 self.name = str[start:end] 00131 return self 00132 except struct.error as e: 00133 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00134 00135 _struct_I = roslib.message.struct_I 00136 _struct_3f = struct.Struct("<3f") 00137 """autogenerated by genmsg_py from SpawnResponse.msg. Do not edit.""" 00138 import roslib.message 00139 import struct 00140 00141 00142 class SpawnResponse(roslib.message.Message): 00143 _md5sum = "c1f3d28f1b044c871e6eff2e9fc3c667" 00144 _type = "turtlesim/SpawnResponse" 00145 _has_header = False #flag to mark the presence of a Header object 00146 _full_text = """string name 00147 00148 """ 00149 __slots__ = ['name'] 00150 _slot_types = ['string'] 00151 00152 def __init__(self, *args, **kwds): 00153 """ 00154 Constructor. Any message fields that are implicitly/explicitly 00155 set to None will be assigned a default value. The recommend 00156 use is keyword arguments as this is more robust to future message 00157 changes. You cannot mix in-order arguments and keyword arguments. 00158 00159 The available fields are: 00160 name 00161 00162 @param args: complete set of field values, in .msg order 00163 @param kwds: use keyword arguments corresponding to message field names 00164 to set specific fields. 00165 """ 00166 if args or kwds: 00167 super(SpawnResponse, self).__init__(*args, **kwds) 00168 #message fields cannot be None, assign default values for those that are 00169 if self.name is None: 00170 self.name = '' 00171 else: 00172 self.name = '' 00173 00174 def _get_types(self): 00175 """ 00176 internal API method 00177 """ 00178 return self._slot_types 00179 00180 def serialize(self, buff): 00181 """ 00182 serialize message into buffer 00183 @param buff: buffer 00184 @type buff: StringIO 00185 """ 00186 try: 00187 _x = self.name 00188 length = len(_x) 00189 buff.write(struct.pack('<I%ss'%length, length, _x)) 00190 except struct.error as se: self._check_types(se) 00191 except TypeError as te: self._check_types(te) 00192 00193 def deserialize(self, str): 00194 """ 00195 unpack serialized message in str into this message instance 00196 @param str: byte array of serialized message 00197 @type str: str 00198 """ 00199 try: 00200 end = 0 00201 start = end 00202 end += 4 00203 (length,) = _struct_I.unpack(str[start:end]) 00204 start = end 00205 end += length 00206 self.name = str[start:end] 00207 return self 00208 except struct.error as e: 00209 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00210 00211 00212 def serialize_numpy(self, buff, numpy): 00213 """ 00214 serialize message with numpy array types into buffer 00215 @param buff: buffer 00216 @type buff: StringIO 00217 @param numpy: numpy python module 00218 @type numpy module 00219 """ 00220 try: 00221 _x = self.name 00222 length = len(_x) 00223 buff.write(struct.pack('<I%ss'%length, length, _x)) 00224 except struct.error as se: self._check_types(se) 00225 except TypeError as te: self._check_types(te) 00226 00227 def deserialize_numpy(self, str, numpy): 00228 """ 00229 unpack serialized message in str into this message instance using numpy for array types 00230 @param str: byte array of serialized message 00231 @type str: str 00232 @param numpy: numpy python module 00233 @type numpy: module 00234 """ 00235 try: 00236 end = 0 00237 start = end 00238 end += 4 00239 (length,) = _struct_I.unpack(str[start:end]) 00240 start = end 00241 end += length 00242 self.name = str[start:end] 00243 return self 00244 except struct.error as e: 00245 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00246 00247 _struct_I = roslib.message.struct_I 00248 class Spawn(roslib.message.ServiceDefinition): 00249 _type = 'turtlesim/Spawn' 00250 _md5sum = '0b2d2e872a8e2887d5ed626f2bf2c561' 00251 _request_class = SpawnRequest 00252 _response_class = SpawnResponse