Go to the documentation of this file.00001 """autogenerated by genpy from srs_knowledge/CUAction.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 srs_knowledge.msg
00008
00009 class CUAction(genpy.Message):
00010 _md5sum = "dd380bff1522657abc20274417168b83"
00011 _type = "srs_knowledge/CUAction"
00012 _has_header = False
00013 _full_text = """# still at alpha stage. not finalised yet.
00014
00015 # indicate if task finished successfully (1); no feasible solution (-1); continue executing the given actions in this message (0)
00016 int32 status
00017
00018 # [ifNavigate, ifDetect, ifGrasp]. 0: yes, 1: no, 2: others (undefined)
00019 #int32[] actionFlags
00020
00021 #MoveAction ma
00022 #PerceptionAction pa
00023 #GraspAction ga
00024 GenericAction generic
00025
00026 # move, perception, grasp, or generic
00027 string actionType
00028 ================================================================================
00029 MSG: srs_knowledge/GenericAction
00030 # use a list as the information container of an action
00031 # BE CAREFUL WHEN USING IT. FOR FLEXIBILITY REASON OR TESTING NEW ADDED ACTION TYPE
00032 # string[] actionInfo # to deprecate
00033 string jsonActionInfo
00034
00035 """
00036 __slots__ = ['status','generic','actionType']
00037 _slot_types = ['int32','srs_knowledge/GenericAction','string']
00038
00039 def __init__(self, *args, **kwds):
00040 """
00041 Constructor. Any message fields that are implicitly/explicitly
00042 set to None will be assigned a default value. The recommend
00043 use is keyword arguments as this is more robust to future message
00044 changes. You cannot mix in-order arguments and keyword arguments.
00045
00046 The available fields are:
00047 status,generic,actionType
00048
00049 :param args: complete set of field values, in .msg order
00050 :param kwds: use keyword arguments corresponding to message field names
00051 to set specific fields.
00052 """
00053 if args or kwds:
00054 super(CUAction, self).__init__(*args, **kwds)
00055
00056 if self.status is None:
00057 self.status = 0
00058 if self.generic is None:
00059 self.generic = srs_knowledge.msg.GenericAction()
00060 if self.actionType is None:
00061 self.actionType = ''
00062 else:
00063 self.status = 0
00064 self.generic = srs_knowledge.msg.GenericAction()
00065 self.actionType = ''
00066
00067 def _get_types(self):
00068 """
00069 internal API method
00070 """
00071 return self._slot_types
00072
00073 def serialize(self, buff):
00074 """
00075 serialize message into buffer
00076 :param buff: buffer, ``StringIO``
00077 """
00078 try:
00079 buff.write(_struct_i.pack(self.status))
00080 _x = self.generic.jsonActionInfo
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 _x = self.actionType
00087 length = len(_x)
00088 if python3 or type(_x) == unicode:
00089 _x = _x.encode('utf-8')
00090 length = len(_x)
00091 buff.write(struct.pack('<I%ss'%length, length, _x))
00092 except struct.error as se: self._check_types(se)
00093 except TypeError as te: self._check_types(te)
00094
00095 def deserialize(self, str):
00096 """
00097 unpack serialized message in str into this message instance
00098 :param str: byte array of serialized message, ``str``
00099 """
00100 try:
00101 if self.generic is None:
00102 self.generic = srs_knowledge.msg.GenericAction()
00103 end = 0
00104 start = end
00105 end += 4
00106 (self.status,) = _struct_i.unpack(str[start:end])
00107 start = end
00108 end += 4
00109 (length,) = _struct_I.unpack(str[start:end])
00110 start = end
00111 end += length
00112 if python3:
00113 self.generic.jsonActionInfo = str[start:end].decode('utf-8')
00114 else:
00115 self.generic.jsonActionInfo = str[start:end]
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 start = end
00120 end += length
00121 if python3:
00122 self.actionType = str[start:end].decode('utf-8')
00123 else:
00124 self.actionType = str[start:end]
00125 return self
00126 except struct.error as e:
00127 raise genpy.DeserializationError(e)
00128
00129
00130 def serialize_numpy(self, buff, numpy):
00131 """
00132 serialize message with numpy array types into buffer
00133 :param buff: buffer, ``StringIO``
00134 :param numpy: numpy python module
00135 """
00136 try:
00137 buff.write(_struct_i.pack(self.status))
00138 _x = self.generic.jsonActionInfo
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.actionType
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 except struct.error as se: self._check_types(se)
00151 except TypeError as te: self._check_types(te)
00152
00153 def deserialize_numpy(self, str, numpy):
00154 """
00155 unpack serialized message in str into this message instance using numpy for array types
00156 :param str: byte array of serialized message, ``str``
00157 :param numpy: numpy python module
00158 """
00159 try:
00160 if self.generic is None:
00161 self.generic = srs_knowledge.msg.GenericAction()
00162 end = 0
00163 start = end
00164 end += 4
00165 (self.status,) = _struct_i.unpack(str[start:end])
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 start = end
00170 end += length
00171 if python3:
00172 self.generic.jsonActionInfo = str[start:end].decode('utf-8')
00173 else:
00174 self.generic.jsonActionInfo = str[start:end]
00175 start = end
00176 end += 4
00177 (length,) = _struct_I.unpack(str[start:end])
00178 start = end
00179 end += length
00180 if python3:
00181 self.actionType = str[start:end].decode('utf-8')
00182 else:
00183 self.actionType = str[start:end]
00184 return self
00185 except struct.error as e:
00186 raise genpy.DeserializationError(e)
00187
00188 _struct_I = genpy.struct_I
00189 _struct_i = struct.Struct("<i")