00001 """autogenerated by genpy from nasa_r2_common_msgs/Modes.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 Modes(genpy.Message):
00010 _md5sum = "63b389b7faa68c6a12708f1df983f6f3"
00011 _type = "nasa_r2_common_msgs/Modes"
00012 _has_header = True
00013 _full_text = """Header header
00014 string originator
00015 string master
00016 string[] joint_names
00017 string[] supervisor
00018 string[] incumbent
00019 string[] mode
00020
00021 ================================================================================
00022 MSG: std_msgs/Header
00023 # Standard metadata for higher-level stamped data types.
00024 # This is generally used to communicate timestamped data
00025 # in a particular coordinate frame.
00026 #
00027 # sequence ID: consecutively increasing ID
00028 uint32 seq
00029 #Two-integer timestamp that is expressed as:
00030 # * stamp.secs: seconds (stamp_secs) since epoch
00031 # * stamp.nsecs: nanoseconds since stamp_secs
00032 # time-handling sugar is provided by the client library
00033 time stamp
00034 #Frame this data is associated with
00035 # 0: no frame
00036 # 1: global frame
00037 string frame_id
00038
00039 """
00040 __slots__ = ['header','originator','master','joint_names','supervisor','incumbent','mode']
00041 _slot_types = ['std_msgs/Header','string','string','string[]','string[]','string[]','string[]']
00042
00043 def __init__(self, *args, **kwds):
00044 """
00045 Constructor. Any message fields that are implicitly/explicitly
00046 set to None will be assigned a default value. The recommend
00047 use is keyword arguments as this is more robust to future message
00048 changes. You cannot mix in-order arguments and keyword arguments.
00049
00050 The available fields are:
00051 header,originator,master,joint_names,supervisor,incumbent,mode
00052
00053 :param args: complete set of field values, in .msg order
00054 :param kwds: use keyword arguments corresponding to message field names
00055 to set specific fields.
00056 """
00057 if args or kwds:
00058 super(Modes, self).__init__(*args, **kwds)
00059
00060 if self.header is None:
00061 self.header = std_msgs.msg.Header()
00062 if self.originator is None:
00063 self.originator = ''
00064 if self.master is None:
00065 self.master = ''
00066 if self.joint_names is None:
00067 self.joint_names = []
00068 if self.supervisor is None:
00069 self.supervisor = []
00070 if self.incumbent is None:
00071 self.incumbent = []
00072 if self.mode is None:
00073 self.mode = []
00074 else:
00075 self.header = std_msgs.msg.Header()
00076 self.originator = ''
00077 self.master = ''
00078 self.joint_names = []
00079 self.supervisor = []
00080 self.incumbent = []
00081 self.mode = []
00082
00083 def _get_types(self):
00084 """
00085 internal API method
00086 """
00087 return self._slot_types
00088
00089 def serialize(self, buff):
00090 """
00091 serialize message into buffer
00092 :param buff: buffer, ``StringIO``
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00097 _x = self.header.frame_id
00098 length = len(_x)
00099 if python3 or type(_x) == unicode:
00100 _x = _x.encode('utf-8')
00101 length = len(_x)
00102 buff.write(struct.pack('<I%ss'%length, length, _x))
00103 _x = self.originator
00104 length = len(_x)
00105 if python3 or type(_x) == unicode:
00106 _x = _x.encode('utf-8')
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = self.master
00110 length = len(_x)
00111 if python3 or type(_x) == unicode:
00112 _x = _x.encode('utf-8')
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 length = len(self.joint_names)
00116 buff.write(_struct_I.pack(length))
00117 for val1 in self.joint_names:
00118 length = len(val1)
00119 if python3 or type(val1) == unicode:
00120 val1 = val1.encode('utf-8')
00121 length = len(val1)
00122 buff.write(struct.pack('<I%ss'%length, length, val1))
00123 length = len(self.supervisor)
00124 buff.write(_struct_I.pack(length))
00125 for val1 in self.supervisor:
00126 length = len(val1)
00127 if python3 or type(val1) == unicode:
00128 val1 = val1.encode('utf-8')
00129 length = len(val1)
00130 buff.write(struct.pack('<I%ss'%length, length, val1))
00131 length = len(self.incumbent)
00132 buff.write(_struct_I.pack(length))
00133 for val1 in self.incumbent:
00134 length = len(val1)
00135 if python3 or type(val1) == unicode:
00136 val1 = val1.encode('utf-8')
00137 length = len(val1)
00138 buff.write(struct.pack('<I%ss'%length, length, val1))
00139 length = len(self.mode)
00140 buff.write(_struct_I.pack(length))
00141 for val1 in self.mode:
00142 length = len(val1)
00143 if python3 or type(val1) == unicode:
00144 val1 = val1.encode('utf-8')
00145 length = len(val1)
00146 buff.write(struct.pack('<I%ss'%length, length, val1))
00147 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00148 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00149
00150 def deserialize(self, str):
00151 """
00152 unpack serialized message in str into this message instance
00153 :param str: byte array of serialized message, ``str``
00154 """
00155 try:
00156 if self.header is None:
00157 self.header = std_msgs.msg.Header()
00158 end = 0
00159 _x = self
00160 start = end
00161 end += 12
00162 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00163 start = end
00164 end += 4
00165 (length,) = _struct_I.unpack(str[start:end])
00166 start = end
00167 end += length
00168 if python3:
00169 self.header.frame_id = str[start:end].decode('utf-8')
00170 else:
00171 self.header.frame_id = str[start:end]
00172 start = end
00173 end += 4
00174 (length,) = _struct_I.unpack(str[start:end])
00175 start = end
00176 end += length
00177 if python3:
00178 self.originator = str[start:end].decode('utf-8')
00179 else:
00180 self.originator = str[start:end]
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 start = end
00185 end += length
00186 if python3:
00187 self.master = str[start:end].decode('utf-8')
00188 else:
00189 self.master = str[start:end]
00190 start = end
00191 end += 4
00192 (length,) = _struct_I.unpack(str[start:end])
00193 self.joint_names = []
00194 for i in range(0, length):
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 start = end
00199 end += length
00200 if python3:
00201 val1 = str[start:end].decode('utf-8')
00202 else:
00203 val1 = str[start:end]
00204 self.joint_names.append(val1)
00205 start = end
00206 end += 4
00207 (length,) = _struct_I.unpack(str[start:end])
00208 self.supervisor = []
00209 for i in range(0, length):
00210 start = end
00211 end += 4
00212 (length,) = _struct_I.unpack(str[start:end])
00213 start = end
00214 end += length
00215 if python3:
00216 val1 = str[start:end].decode('utf-8')
00217 else:
00218 val1 = str[start:end]
00219 self.supervisor.append(val1)
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 self.incumbent = []
00224 for i in range(0, length):
00225 start = end
00226 end += 4
00227 (length,) = _struct_I.unpack(str[start:end])
00228 start = end
00229 end += length
00230 if python3:
00231 val1 = str[start:end].decode('utf-8')
00232 else:
00233 val1 = str[start:end]
00234 self.incumbent.append(val1)
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 self.mode = []
00239 for i in range(0, length):
00240 start = end
00241 end += 4
00242 (length,) = _struct_I.unpack(str[start:end])
00243 start = end
00244 end += length
00245 if python3:
00246 val1 = str[start:end].decode('utf-8')
00247 else:
00248 val1 = str[start:end]
00249 self.mode.append(val1)
00250 return self
00251 except struct.error as e:
00252 raise genpy.DeserializationError(e)
00253
00254
00255 def serialize_numpy(self, buff, numpy):
00256 """
00257 serialize message with numpy array types into buffer
00258 :param buff: buffer, ``StringIO``
00259 :param numpy: numpy python module
00260 """
00261 try:
00262 _x = self
00263 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00264 _x = self.header.frame_id
00265 length = len(_x)
00266 if python3 or type(_x) == unicode:
00267 _x = _x.encode('utf-8')
00268 length = len(_x)
00269 buff.write(struct.pack('<I%ss'%length, length, _x))
00270 _x = self.originator
00271 length = len(_x)
00272 if python3 or type(_x) == unicode:
00273 _x = _x.encode('utf-8')
00274 length = len(_x)
00275 buff.write(struct.pack('<I%ss'%length, length, _x))
00276 _x = self.master
00277 length = len(_x)
00278 if python3 or type(_x) == unicode:
00279 _x = _x.encode('utf-8')
00280 length = len(_x)
00281 buff.write(struct.pack('<I%ss'%length, length, _x))
00282 length = len(self.joint_names)
00283 buff.write(_struct_I.pack(length))
00284 for val1 in self.joint_names:
00285 length = len(val1)
00286 if python3 or type(val1) == unicode:
00287 val1 = val1.encode('utf-8')
00288 length = len(val1)
00289 buff.write(struct.pack('<I%ss'%length, length, val1))
00290 length = len(self.supervisor)
00291 buff.write(_struct_I.pack(length))
00292 for val1 in self.supervisor:
00293 length = len(val1)
00294 if python3 or type(val1) == unicode:
00295 val1 = val1.encode('utf-8')
00296 length = len(val1)
00297 buff.write(struct.pack('<I%ss'%length, length, val1))
00298 length = len(self.incumbent)
00299 buff.write(_struct_I.pack(length))
00300 for val1 in self.incumbent:
00301 length = len(val1)
00302 if python3 or type(val1) == unicode:
00303 val1 = val1.encode('utf-8')
00304 length = len(val1)
00305 buff.write(struct.pack('<I%ss'%length, length, val1))
00306 length = len(self.mode)
00307 buff.write(_struct_I.pack(length))
00308 for val1 in self.mode:
00309 length = len(val1)
00310 if python3 or type(val1) == unicode:
00311 val1 = val1.encode('utf-8')
00312 length = len(val1)
00313 buff.write(struct.pack('<I%ss'%length, length, val1))
00314 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00315 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00316
00317 def deserialize_numpy(self, str, numpy):
00318 """
00319 unpack serialized message in str into this message instance using numpy for array types
00320 :param str: byte array of serialized message, ``str``
00321 :param numpy: numpy python module
00322 """
00323 try:
00324 if self.header is None:
00325 self.header = std_msgs.msg.Header()
00326 end = 0
00327 _x = self
00328 start = end
00329 end += 12
00330 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00331 start = end
00332 end += 4
00333 (length,) = _struct_I.unpack(str[start:end])
00334 start = end
00335 end += length
00336 if python3:
00337 self.header.frame_id = str[start:end].decode('utf-8')
00338 else:
00339 self.header.frame_id = str[start:end]
00340 start = end
00341 end += 4
00342 (length,) = _struct_I.unpack(str[start:end])
00343 start = end
00344 end += length
00345 if python3:
00346 self.originator = str[start:end].decode('utf-8')
00347 else:
00348 self.originator = str[start:end]
00349 start = end
00350 end += 4
00351 (length,) = _struct_I.unpack(str[start:end])
00352 start = end
00353 end += length
00354 if python3:
00355 self.master = str[start:end].decode('utf-8')
00356 else:
00357 self.master = str[start:end]
00358 start = end
00359 end += 4
00360 (length,) = _struct_I.unpack(str[start:end])
00361 self.joint_names = []
00362 for i in range(0, length):
00363 start = end
00364 end += 4
00365 (length,) = _struct_I.unpack(str[start:end])
00366 start = end
00367 end += length
00368 if python3:
00369 val1 = str[start:end].decode('utf-8')
00370 else:
00371 val1 = str[start:end]
00372 self.joint_names.append(val1)
00373 start = end
00374 end += 4
00375 (length,) = _struct_I.unpack(str[start:end])
00376 self.supervisor = []
00377 for i in range(0, length):
00378 start = end
00379 end += 4
00380 (length,) = _struct_I.unpack(str[start:end])
00381 start = end
00382 end += length
00383 if python3:
00384 val1 = str[start:end].decode('utf-8')
00385 else:
00386 val1 = str[start:end]
00387 self.supervisor.append(val1)
00388 start = end
00389 end += 4
00390 (length,) = _struct_I.unpack(str[start:end])
00391 self.incumbent = []
00392 for i in range(0, length):
00393 start = end
00394 end += 4
00395 (length,) = _struct_I.unpack(str[start:end])
00396 start = end
00397 end += length
00398 if python3:
00399 val1 = str[start:end].decode('utf-8')
00400 else:
00401 val1 = str[start:end]
00402 self.incumbent.append(val1)
00403 start = end
00404 end += 4
00405 (length,) = _struct_I.unpack(str[start:end])
00406 self.mode = []
00407 for i in range(0, length):
00408 start = end
00409 end += 4
00410 (length,) = _struct_I.unpack(str[start:end])
00411 start = end
00412 end += length
00413 if python3:
00414 val1 = str[start:end].decode('utf-8')
00415 else:
00416 val1 = str[start:end]
00417 self.mode.append(val1)
00418 return self
00419 except struct.error as e:
00420 raise genpy.DeserializationError(e)
00421
00422 _struct_I = genpy.struct_I
00423 _struct_3I = struct.Struct("<3I")