00001 """autogenerated by genpy from nasa_r2_common_msgs/SetParameterRequest.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 nasa_r2_common_msgs.msg
00008 import std_msgs.msg
00009
00010 class SetParameterRequest(genpy.Message):
00011 _md5sum = "4c20cb3132d88e7123922dd820162194"
00012 _type = "nasa_r2_common_msgs/SetParameterRequest"
00013 _has_header = True
00014 _full_text = """Header header
00015 Parameter param
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 ================================================================================
00036 MSG: nasa_r2_common_msgs/Parameter
00037 uint8 STRING = 0
00038 uint8 INT = 1
00039 uint8 FLOAT = 2
00040 uint8 BOOL = 3
00041 uint8 LIST = 4
00042 uint8 DICT = 5
00043
00044 string key
00045 uint8 type
00046 string value
00047
00048 """
00049 __slots__ = ['header','param']
00050 _slot_types = ['std_msgs/Header','nasa_r2_common_msgs/Parameter']
00051
00052 def __init__(self, *args, **kwds):
00053 """
00054 Constructor. Any message fields that are implicitly/explicitly
00055 set to None will be assigned a default value. The recommend
00056 use is keyword arguments as this is more robust to future message
00057 changes. You cannot mix in-order arguments and keyword arguments.
00058
00059 The available fields are:
00060 header,param
00061
00062 :param args: complete set of field values, in .msg order
00063 :param kwds: use keyword arguments corresponding to message field names
00064 to set specific fields.
00065 """
00066 if args or kwds:
00067 super(SetParameterRequest, self).__init__(*args, **kwds)
00068
00069 if self.header is None:
00070 self.header = std_msgs.msg.Header()
00071 if self.param is None:
00072 self.param = nasa_r2_common_msgs.msg.Parameter()
00073 else:
00074 self.header = std_msgs.msg.Header()
00075 self.param = nasa_r2_common_msgs.msg.Parameter()
00076
00077 def _get_types(self):
00078 """
00079 internal API method
00080 """
00081 return self._slot_types
00082
00083 def serialize(self, buff):
00084 """
00085 serialize message into buffer
00086 :param buff: buffer, ``StringIO``
00087 """
00088 try:
00089 _x = self
00090 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00091 _x = self.header.frame_id
00092 length = len(_x)
00093 if python3 or type(_x) == unicode:
00094 _x = _x.encode('utf-8')
00095 length = len(_x)
00096 buff.write(struct.pack('<I%ss'%length, length, _x))
00097 _x = self.param.key
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 buff.write(_struct_B.pack(self.param.type))
00104 _x = self.param.value
00105 length = len(_x)
00106 if python3 or type(_x) == unicode:
00107 _x = _x.encode('utf-8')
00108 length = len(_x)
00109 buff.write(struct.pack('<I%ss'%length, length, _x))
00110 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00111 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00112
00113 def deserialize(self, str):
00114 """
00115 unpack serialized message in str into this message instance
00116 :param str: byte array of serialized message, ``str``
00117 """
00118 try:
00119 if self.header is None:
00120 self.header = std_msgs.msg.Header()
00121 if self.param is None:
00122 self.param = nasa_r2_common_msgs.msg.Parameter()
00123 end = 0
00124 _x = self
00125 start = end
00126 end += 12
00127 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 if python3:
00134 self.header.frame_id = str[start:end].decode('utf-8')
00135 else:
00136 self.header.frame_id = str[start:end]
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 start = end
00141 end += length
00142 if python3:
00143 self.param.key = str[start:end].decode('utf-8')
00144 else:
00145 self.param.key = str[start:end]
00146 start = end
00147 end += 1
00148 (self.param.type,) = _struct_B.unpack(str[start:end])
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 self.param.value = str[start:end].decode('utf-8')
00156 else:
00157 self.param.value = str[start:end]
00158 return self
00159 except struct.error as e:
00160 raise genpy.DeserializationError(e)
00161
00162
00163 def serialize_numpy(self, buff, numpy):
00164 """
00165 serialize message with numpy array types into buffer
00166 :param buff: buffer, ``StringIO``
00167 :param numpy: numpy python module
00168 """
00169 try:
00170 _x = self
00171 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00172 _x = self.header.frame_id
00173 length = len(_x)
00174 if python3 or type(_x) == unicode:
00175 _x = _x.encode('utf-8')
00176 length = len(_x)
00177 buff.write(struct.pack('<I%ss'%length, length, _x))
00178 _x = self.param.key
00179 length = len(_x)
00180 if python3 or type(_x) == unicode:
00181 _x = _x.encode('utf-8')
00182 length = len(_x)
00183 buff.write(struct.pack('<I%ss'%length, length, _x))
00184 buff.write(_struct_B.pack(self.param.type))
00185 _x = self.param.value
00186 length = len(_x)
00187 if python3 or type(_x) == unicode:
00188 _x = _x.encode('utf-8')
00189 length = len(_x)
00190 buff.write(struct.pack('<I%ss'%length, length, _x))
00191 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00192 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00193
00194 def deserialize_numpy(self, str, numpy):
00195 """
00196 unpack serialized message in str into this message instance using numpy for array types
00197 :param str: byte array of serialized message, ``str``
00198 :param numpy: numpy python module
00199 """
00200 try:
00201 if self.header is None:
00202 self.header = std_msgs.msg.Header()
00203 if self.param is None:
00204 self.param = nasa_r2_common_msgs.msg.Parameter()
00205 end = 0
00206 _x = self
00207 start = end
00208 end += 12
00209 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00210 start = end
00211 end += 4
00212 (length,) = _struct_I.unpack(str[start:end])
00213 start = end
00214 end += length
00215 if python3:
00216 self.header.frame_id = str[start:end].decode('utf-8')
00217 else:
00218 self.header.frame_id = str[start:end]
00219 start = end
00220 end += 4
00221 (length,) = _struct_I.unpack(str[start:end])
00222 start = end
00223 end += length
00224 if python3:
00225 self.param.key = str[start:end].decode('utf-8')
00226 else:
00227 self.param.key = str[start:end]
00228 start = end
00229 end += 1
00230 (self.param.type,) = _struct_B.unpack(str[start:end])
00231 start = end
00232 end += 4
00233 (length,) = _struct_I.unpack(str[start:end])
00234 start = end
00235 end += length
00236 if python3:
00237 self.param.value = str[start:end].decode('utf-8')
00238 else:
00239 self.param.value = str[start:end]
00240 return self
00241 except struct.error as e:
00242 raise genpy.DeserializationError(e)
00243
00244 _struct_I = genpy.struct_I
00245 _struct_3I = struct.Struct("<3I")
00246 _struct_B = struct.Struct("<B")