$search
00001 """autogenerated by genmsg_py from SwitchControllerRequest.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class SwitchControllerRequest(roslib.message.Message): 00007 _md5sum = "434da54adc434a5af5743ed711fd6ba1" 00008 _type = "pr2_mechanism_msgs/SwitchControllerRequest" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """ 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 string[] start_controllers 00029 string[] stop_controllers 00030 int32 strictness 00031 int32 BEST_EFFORT=1 00032 int32 STRICT=2 00033 00034 """ 00035 # Pseudo-constants 00036 BEST_EFFORT = 1 00037 STRICT = 2 00038 00039 __slots__ = ['start_controllers','stop_controllers','strictness'] 00040 _slot_types = ['string[]','string[]','int32'] 00041 00042 def __init__(self, *args, **kwds): 00043 """ 00044 Constructor. Any message fields that are implicitly/explicitly 00045 set to None will be assigned a default value. The recommend 00046 use is keyword arguments as this is more robust to future message 00047 changes. You cannot mix in-order arguments and keyword arguments. 00048 00049 The available fields are: 00050 start_controllers,stop_controllers,strictness 00051 00052 @param args: complete set of field values, in .msg order 00053 @param kwds: use keyword arguments corresponding to message field names 00054 to set specific fields. 00055 """ 00056 if args or kwds: 00057 super(SwitchControllerRequest, self).__init__(*args, **kwds) 00058 #message fields cannot be None, assign default values for those that are 00059 if self.start_controllers is None: 00060 self.start_controllers = [] 00061 if self.stop_controllers is None: 00062 self.stop_controllers = [] 00063 if self.strictness is None: 00064 self.strictness = 0 00065 else: 00066 self.start_controllers = [] 00067 self.stop_controllers = [] 00068 self.strictness = 0 00069 00070 def _get_types(self): 00071 """ 00072 internal API method 00073 """ 00074 return self._slot_types 00075 00076 def serialize(self, buff): 00077 """ 00078 serialize message into buffer 00079 @param buff: buffer 00080 @type buff: StringIO 00081 """ 00082 try: 00083 length = len(self.start_controllers) 00084 buff.write(_struct_I.pack(length)) 00085 for val1 in self.start_controllers: 00086 length = len(val1) 00087 buff.write(struct.pack('<I%ss'%length, length, val1)) 00088 length = len(self.stop_controllers) 00089 buff.write(_struct_I.pack(length)) 00090 for val1 in self.stop_controllers: 00091 length = len(val1) 00092 buff.write(struct.pack('<I%ss'%length, length, val1)) 00093 buff.write(_struct_i.pack(self.strictness)) 00094 except struct.error as se: self._check_types(se) 00095 except TypeError as te: self._check_types(te) 00096 00097 def deserialize(self, str): 00098 """ 00099 unpack serialized message in str into this message instance 00100 @param str: byte array of serialized message 00101 @type str: str 00102 """ 00103 try: 00104 end = 0 00105 start = end 00106 end += 4 00107 (length,) = _struct_I.unpack(str[start:end]) 00108 self.start_controllers = [] 00109 for i in range(0, length): 00110 start = end 00111 end += 4 00112 (length,) = _struct_I.unpack(str[start:end]) 00113 start = end 00114 end += length 00115 val1 = str[start:end] 00116 self.start_controllers.append(val1) 00117 start = end 00118 end += 4 00119 (length,) = _struct_I.unpack(str[start:end]) 00120 self.stop_controllers = [] 00121 for i in range(0, length): 00122 start = end 00123 end += 4 00124 (length,) = _struct_I.unpack(str[start:end]) 00125 start = end 00126 end += length 00127 val1 = str[start:end] 00128 self.stop_controllers.append(val1) 00129 start = end 00130 end += 4 00131 (self.strictness,) = _struct_i.unpack(str[start:end]) 00132 return self 00133 except struct.error as e: 00134 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00135 00136 00137 def serialize_numpy(self, buff, numpy): 00138 """ 00139 serialize message with numpy array types into buffer 00140 @param buff: buffer 00141 @type buff: StringIO 00142 @param numpy: numpy python module 00143 @type numpy module 00144 """ 00145 try: 00146 length = len(self.start_controllers) 00147 buff.write(_struct_I.pack(length)) 00148 for val1 in self.start_controllers: 00149 length = len(val1) 00150 buff.write(struct.pack('<I%ss'%length, length, val1)) 00151 length = len(self.stop_controllers) 00152 buff.write(_struct_I.pack(length)) 00153 for val1 in self.stop_controllers: 00154 length = len(val1) 00155 buff.write(struct.pack('<I%ss'%length, length, val1)) 00156 buff.write(_struct_i.pack(self.strictness)) 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 00164 @type str: str 00165 @param numpy: numpy python module 00166 @type numpy: module 00167 """ 00168 try: 00169 end = 0 00170 start = end 00171 end += 4 00172 (length,) = _struct_I.unpack(str[start:end]) 00173 self.start_controllers = [] 00174 for i in range(0, length): 00175 start = end 00176 end += 4 00177 (length,) = _struct_I.unpack(str[start:end]) 00178 start = end 00179 end += length 00180 val1 = str[start:end] 00181 self.start_controllers.append(val1) 00182 start = end 00183 end += 4 00184 (length,) = _struct_I.unpack(str[start:end]) 00185 self.stop_controllers = [] 00186 for i in range(0, length): 00187 start = end 00188 end += 4 00189 (length,) = _struct_I.unpack(str[start:end]) 00190 start = end 00191 end += length 00192 val1 = str[start:end] 00193 self.stop_controllers.append(val1) 00194 start = end 00195 end += 4 00196 (self.strictness,) = _struct_i.unpack(str[start:end]) 00197 return self 00198 except struct.error as e: 00199 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00200 00201 _struct_I = roslib.message.struct_I 00202 _struct_i = struct.Struct("<i") 00203 """autogenerated by genmsg_py from SwitchControllerResponse.msg. Do not edit.""" 00204 import roslib.message 00205 import struct 00206 00207 00208 class SwitchControllerResponse(roslib.message.Message): 00209 _md5sum = "6f6da3883749771fac40d6deb24a8c02" 00210 _type = "pr2_mechanism_msgs/SwitchControllerResponse" 00211 _has_header = False #flag to mark the presence of a Header object 00212 _full_text = """bool ok 00213 00214 00215 00216 00217 00218 """ 00219 __slots__ = ['ok'] 00220 _slot_types = ['bool'] 00221 00222 def __init__(self, *args, **kwds): 00223 """ 00224 Constructor. Any message fields that are implicitly/explicitly 00225 set to None will be assigned a default value. The recommend 00226 use is keyword arguments as this is more robust to future message 00227 changes. You cannot mix in-order arguments and keyword arguments. 00228 00229 The available fields are: 00230 ok 00231 00232 @param args: complete set of field values, in .msg order 00233 @param kwds: use keyword arguments corresponding to message field names 00234 to set specific fields. 00235 """ 00236 if args or kwds: 00237 super(SwitchControllerResponse, self).__init__(*args, **kwds) 00238 #message fields cannot be None, assign default values for those that are 00239 if self.ok is None: 00240 self.ok = False 00241 else: 00242 self.ok = False 00243 00244 def _get_types(self): 00245 """ 00246 internal API method 00247 """ 00248 return self._slot_types 00249 00250 def serialize(self, buff): 00251 """ 00252 serialize message into buffer 00253 @param buff: buffer 00254 @type buff: StringIO 00255 """ 00256 try: 00257 buff.write(_struct_B.pack(self.ok)) 00258 except struct.error as se: self._check_types(se) 00259 except TypeError as te: self._check_types(te) 00260 00261 def deserialize(self, str): 00262 """ 00263 unpack serialized message in str into this message instance 00264 @param str: byte array of serialized message 00265 @type str: str 00266 """ 00267 try: 00268 end = 0 00269 start = end 00270 end += 1 00271 (self.ok,) = _struct_B.unpack(str[start:end]) 00272 self.ok = bool(self.ok) 00273 return self 00274 except struct.error as e: 00275 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00276 00277 00278 def serialize_numpy(self, buff, numpy): 00279 """ 00280 serialize message with numpy array types into buffer 00281 @param buff: buffer 00282 @type buff: StringIO 00283 @param numpy: numpy python module 00284 @type numpy module 00285 """ 00286 try: 00287 buff.write(_struct_B.pack(self.ok)) 00288 except struct.error as se: self._check_types(se) 00289 except TypeError as te: self._check_types(te) 00290 00291 def deserialize_numpy(self, str, numpy): 00292 """ 00293 unpack serialized message in str into this message instance using numpy for array types 00294 @param str: byte array of serialized message 00295 @type str: str 00296 @param numpy: numpy python module 00297 @type numpy: module 00298 """ 00299 try: 00300 end = 0 00301 start = end 00302 end += 1 00303 (self.ok,) = _struct_B.unpack(str[start:end]) 00304 self.ok = bool(self.ok) 00305 return self 00306 except struct.error as e: 00307 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00308 00309 _struct_I = roslib.message.struct_I 00310 _struct_B = struct.Struct("<B") 00311 class SwitchController(roslib.message.ServiceDefinition): 00312 _type = 'pr2_mechanism_msgs/SwitchController' 00313 _md5sum = '5e857dedf71d6f337975e15a1e7cfdd8' 00314 _request_class = SwitchControllerRequest 00315 _response_class = SwitchControllerResponse