_srs_actionGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_decision_making_interface/srs_actionGoal.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class srs_actionGoal(genpy.Message):
00009   _md5sum = "17ace6d839845ba28d596f5bde7e89f1"
00010   _type = "srs_decision_making_interface/srs_actionGoal"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 #define the goal, srs_msgs/srs_action[] action_sequence #Specify what action sequence to be applied
00014 string action         # to deprecate, replaced by json_parameters. Kept for backward compatibility
00015 string parameter      # to deprecate, replaced by json_parameters
00016 uint32 priority       # to deprecate
00017 string json_parameters   # new added parameter in json (test by Ze)
00018 # string[] parameters   # to deprecate
00019 
00020 """
00021   __slots__ = ['action','parameter','priority','json_parameters']
00022   _slot_types = ['string','string','uint32','string']
00023 
00024   def __init__(self, *args, **kwds):
00025     """
00026     Constructor. Any message fields that are implicitly/explicitly
00027     set to None will be assigned a default value. The recommend
00028     use is keyword arguments as this is more robust to future message
00029     changes.  You cannot mix in-order arguments and keyword arguments.
00030 
00031     The available fields are:
00032        action,parameter,priority,json_parameters
00033 
00034     :param args: complete set of field values, in .msg order
00035     :param kwds: use keyword arguments corresponding to message field names
00036     to set specific fields.
00037     """
00038     if args or kwds:
00039       super(srs_actionGoal, self).__init__(*args, **kwds)
00040       #message fields cannot be None, assign default values for those that are
00041       if self.action is None:
00042         self.action = ''
00043       if self.parameter is None:
00044         self.parameter = ''
00045       if self.priority is None:
00046         self.priority = 0
00047       if self.json_parameters is None:
00048         self.json_parameters = ''
00049     else:
00050       self.action = ''
00051       self.parameter = ''
00052       self.priority = 0
00053       self.json_parameters = ''
00054 
00055   def _get_types(self):
00056     """
00057     internal API method
00058     """
00059     return self._slot_types
00060 
00061   def serialize(self, buff):
00062     """
00063     serialize message into buffer
00064     :param buff: buffer, ``StringIO``
00065     """
00066     try:
00067       _x = self.action
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073       _x = self.parameter
00074       length = len(_x)
00075       if python3 or type(_x) == unicode:
00076         _x = _x.encode('utf-8')
00077         length = len(_x)
00078       buff.write(struct.pack('<I%ss'%length, length, _x))
00079       buff.write(_struct_I.pack(self.priority))
00080       _x = self.json_parameters
00081       length = len(_x)
00082       if python3 or type(_x) == unicode:
00083         _x = _x.encode('utf-8')
00084         length = len(_x)
00085       buff.write(struct.pack('<I%ss'%length, length, _x))
00086     except struct.error as se: self._check_types(se)
00087     except TypeError as te: self._check_types(te)
00088 
00089   def deserialize(self, str):
00090     """
00091     unpack serialized message in str into this message instance
00092     :param str: byte array of serialized message, ``str``
00093     """
00094     try:
00095       end = 0
00096       start = end
00097       end += 4
00098       (length,) = _struct_I.unpack(str[start:end])
00099       start = end
00100       end += length
00101       if python3:
00102         self.action = str[start:end].decode('utf-8')
00103       else:
00104         self.action = 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.parameter = str[start:end].decode('utf-8')
00112       else:
00113         self.parameter = str[start:end]
00114       start = end
00115       end += 4
00116       (self.priority,) = _struct_I.unpack(str[start:end])
00117       start = end
00118       end += 4
00119       (length,) = _struct_I.unpack(str[start:end])
00120       start = end
00121       end += length
00122       if python3:
00123         self.json_parameters = str[start:end].decode('utf-8')
00124       else:
00125         self.json_parameters = str[start:end]
00126       return self
00127     except struct.error as e:
00128       raise genpy.DeserializationError(e) #most likely buffer underfill
00129 
00130 
00131   def serialize_numpy(self, buff, numpy):
00132     """
00133     serialize message with numpy array types into buffer
00134     :param buff: buffer, ``StringIO``
00135     :param numpy: numpy python module
00136     """
00137     try:
00138       _x = self.action
00139       length = len(_x)
00140       if python3 or type(_x) == unicode:
00141         _x = _x.encode('utf-8')
00142         length = len(_x)
00143       buff.write(struct.pack('<I%ss'%length, length, _x))
00144       _x = self.parameter
00145       length = len(_x)
00146       if python3 or type(_x) == unicode:
00147         _x = _x.encode('utf-8')
00148         length = len(_x)
00149       buff.write(struct.pack('<I%ss'%length, length, _x))
00150       buff.write(_struct_I.pack(self.priority))
00151       _x = self.json_parameters
00152       length = len(_x)
00153       if python3 or type(_x) == unicode:
00154         _x = _x.encode('utf-8')
00155         length = len(_x)
00156       buff.write(struct.pack('<I%ss'%length, length, _x))
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, ``str``
00164     :param numpy: numpy python module
00165     """
00166     try:
00167       end = 0
00168       start = end
00169       end += 4
00170       (length,) = _struct_I.unpack(str[start:end])
00171       start = end
00172       end += length
00173       if python3:
00174         self.action = str[start:end].decode('utf-8')
00175       else:
00176         self.action = str[start:end]
00177       start = end
00178       end += 4
00179       (length,) = _struct_I.unpack(str[start:end])
00180       start = end
00181       end += length
00182       if python3:
00183         self.parameter = str[start:end].decode('utf-8')
00184       else:
00185         self.parameter = str[start:end]
00186       start = end
00187       end += 4
00188       (self.priority,) = _struct_I.unpack(str[start:end])
00189       start = end
00190       end += 4
00191       (length,) = _struct_I.unpack(str[start:end])
00192       start = end
00193       end += length
00194       if python3:
00195         self.json_parameters = str[start:end].decode('utf-8')
00196       else:
00197         self.json_parameters = str[start:end]
00198       return self
00199     except struct.error as e:
00200       raise genpy.DeserializationError(e) #most likely buffer underfill
00201 
00202 _struct_I = genpy.struct_I


srs_decision_making_interface
Author(s): renxi
autogenerated on Sun Jan 5 2014 12:07:47