00001 """autogenerated by genpy from joint_states_settler/ConfigGoal.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 genpy
00008
00009 class ConfigGoal(genpy.Message):
00010 _md5sum = "863b25359077f9aa231257b3d1612b63"
00011 _type = "joint_states_settler/ConfigGoal"
00012 _has_header = False
00013 _full_text = """string[] joint_names # Names of the joints we're waiting to settle
00014 float64[] tolerances # Tolerance on each of the specified joints
00015 duration max_step # The maximum timestep between two elements in an interval
00016 uint32 cache_size # The size of our cache when searching for an interval
00017
00018 """
00019 __slots__ = ['joint_names','tolerances','max_step','cache_size']
00020 _slot_types = ['string[]','float64[]','duration','uint32']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 joint_names,tolerances,max_step,cache_size
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(ConfigGoal, self).__init__(*args, **kwds)
00038
00039 if self.joint_names is None:
00040 self.joint_names = []
00041 if self.tolerances is None:
00042 self.tolerances = []
00043 if self.max_step is None:
00044 self.max_step = genpy.Duration()
00045 if self.cache_size is None:
00046 self.cache_size = 0
00047 else:
00048 self.joint_names = []
00049 self.tolerances = []
00050 self.max_step = genpy.Duration()
00051 self.cache_size = 0
00052
00053 def _get_types(self):
00054 """
00055 internal API method
00056 """
00057 return self._slot_types
00058
00059 def serialize(self, buff):
00060 """
00061 serialize message into buffer
00062 :param buff: buffer, ``StringIO``
00063 """
00064 try:
00065 length = len(self.joint_names)
00066 buff.write(_struct_I.pack(length))
00067 for val1 in self.joint_names:
00068 length = len(val1)
00069 if python3 or type(val1) == unicode:
00070 val1 = val1.encode('utf-8')
00071 length = len(val1)
00072 buff.write(struct.pack('<I%ss'%length, length, val1))
00073 length = len(self.tolerances)
00074 buff.write(_struct_I.pack(length))
00075 pattern = '<%sd'%length
00076 buff.write(struct.pack(pattern, *self.tolerances))
00077 _x = self
00078 buff.write(_struct_2iI.pack(_x.max_step.secs, _x.max_step.nsecs, _x.cache_size))
00079 except struct.error as se: self._check_types(se)
00080 except TypeError as te: self._check_types(te)
00081
00082 def deserialize(self, str):
00083 """
00084 unpack serialized message in str into this message instance
00085 :param str: byte array of serialized message, ``str``
00086 """
00087 try:
00088 if self.max_step is None:
00089 self.max_step = genpy.Duration()
00090 end = 0
00091 start = end
00092 end += 4
00093 (length,) = _struct_I.unpack(str[start:end])
00094 self.joint_names = []
00095 for i in range(0, length):
00096 start = end
00097 end += 4
00098 (length,) = _struct_I.unpack(str[start:end])
00099 start = end
00100 end += length
00101 if python3:
00102 val1 = str[start:end].decode('utf-8')
00103 else:
00104 val1 = str[start:end]
00105 self.joint_names.append(val1)
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 pattern = '<%sd'%length
00110 start = end
00111 end += struct.calcsize(pattern)
00112 self.tolerances = struct.unpack(pattern, str[start:end])
00113 _x = self
00114 start = end
00115 end += 12
00116 (_x.max_step.secs, _x.max_step.nsecs, _x.cache_size,) = _struct_2iI.unpack(str[start:end])
00117 self.max_step.canon()
00118 return self
00119 except struct.error as e:
00120 raise genpy.DeserializationError(e)
00121
00122
00123 def serialize_numpy(self, buff, numpy):
00124 """
00125 serialize message with numpy array types into buffer
00126 :param buff: buffer, ``StringIO``
00127 :param numpy: numpy python module
00128 """
00129 try:
00130 length = len(self.joint_names)
00131 buff.write(_struct_I.pack(length))
00132 for val1 in self.joint_names:
00133 length = len(val1)
00134 if python3 or type(val1) == unicode:
00135 val1 = val1.encode('utf-8')
00136 length = len(val1)
00137 buff.write(struct.pack('<I%ss'%length, length, val1))
00138 length = len(self.tolerances)
00139 buff.write(_struct_I.pack(length))
00140 pattern = '<%sd'%length
00141 buff.write(self.tolerances.tostring())
00142 _x = self
00143 buff.write(_struct_2iI.pack(_x.max_step.secs, _x.max_step.nsecs, _x.cache_size))
00144 except struct.error as se: self._check_types(se)
00145 except TypeError as te: self._check_types(te)
00146
00147 def deserialize_numpy(self, str, numpy):
00148 """
00149 unpack serialized message in str into this message instance using numpy for array types
00150 :param str: byte array of serialized message, ``str``
00151 :param numpy: numpy python module
00152 """
00153 try:
00154 if self.max_step is None:
00155 self.max_step = genpy.Duration()
00156 end = 0
00157 start = end
00158 end += 4
00159 (length,) = _struct_I.unpack(str[start:end])
00160 self.joint_names = []
00161 for i in range(0, length):
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 start = end
00166 end += length
00167 if python3:
00168 val1 = str[start:end].decode('utf-8')
00169 else:
00170 val1 = str[start:end]
00171 self.joint_names.append(val1)
00172 start = end
00173 end += 4
00174 (length,) = _struct_I.unpack(str[start:end])
00175 pattern = '<%sd'%length
00176 start = end
00177 end += struct.calcsize(pattern)
00178 self.tolerances = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00179 _x = self
00180 start = end
00181 end += 12
00182 (_x.max_step.secs, _x.max_step.nsecs, _x.cache_size,) = _struct_2iI.unpack(str[start:end])
00183 self.max_step.canon()
00184 return self
00185 except struct.error as e:
00186 raise genpy.DeserializationError(e)
00187
00188 _struct_I = genpy.struct_I
00189 _struct_2iI = struct.Struct("<2iI")