00001 """autogenerated by genpy from katana_msgs/GripperControllerState.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 GripperControllerState(genpy.Message):
00010 _md5sum = "57ba9ed166f48062eddf3c6e509f2dc0"
00011 _type = "katana_msgs/GripperControllerState"
00012 _has_header = True
00013 _full_text = """# The actual and desired angles (in radian) of the gripper joints,
00014 # and the error between actual and desired.
00015 #
00016 # Each joint is uniquely identified by its name.
00017 #
00018 # The header specifies the time at which the joint states were recorded. All the joint states
00019 # in one message have to be recorded at the same time.
00020 #
00021 # This message consists of a multiple arrays, one for each part of the joint state.
00022 #
00023 # All arrays in this message should have the same size.
00024 # This is the only way to uniquely associate the joint name with the correct
00025 # states.
00026 Header header
00027
00028 string[] name
00029 float64[] actual
00030 float64[] desired
00031 float64[] error
00032
00033 ================================================================================
00034 MSG: std_msgs/Header
00035 # Standard metadata for higher-level stamped data types.
00036 # This is generally used to communicate timestamped data
00037 # in a particular coordinate frame.
00038 #
00039 # sequence ID: consecutively increasing ID
00040 uint32 seq
00041 #Two-integer timestamp that is expressed as:
00042 # * stamp.secs: seconds (stamp_secs) since epoch
00043 # * stamp.nsecs: nanoseconds since stamp_secs
00044 # time-handling sugar is provided by the client library
00045 time stamp
00046 #Frame this data is associated with
00047 # 0: no frame
00048 # 1: global frame
00049 string frame_id
00050
00051 """
00052 __slots__ = ['header','name','actual','desired','error']
00053 _slot_types = ['std_msgs/Header','string[]','float64[]','float64[]','float64[]']
00054
00055 def __init__(self, *args, **kwds):
00056 """
00057 Constructor. Any message fields that are implicitly/explicitly
00058 set to None will be assigned a default value. The recommend
00059 use is keyword arguments as this is more robust to future message
00060 changes. You cannot mix in-order arguments and keyword arguments.
00061
00062 The available fields are:
00063 header,name,actual,desired,error
00064
00065 :param args: complete set of field values, in .msg order
00066 :param kwds: use keyword arguments corresponding to message field names
00067 to set specific fields.
00068 """
00069 if args or kwds:
00070 super(GripperControllerState, self).__init__(*args, **kwds)
00071
00072 if self.header is None:
00073 self.header = std_msgs.msg.Header()
00074 if self.name is None:
00075 self.name = []
00076 if self.actual is None:
00077 self.actual = []
00078 if self.desired is None:
00079 self.desired = []
00080 if self.error is None:
00081 self.error = []
00082 else:
00083 self.header = std_msgs.msg.Header()
00084 self.name = []
00085 self.actual = []
00086 self.desired = []
00087 self.error = []
00088
00089 def _get_types(self):
00090 """
00091 internal API method
00092 """
00093 return self._slot_types
00094
00095 def serialize(self, buff):
00096 """
00097 serialize message into buffer
00098 :param buff: buffer, ``StringIO``
00099 """
00100 try:
00101 _x = self
00102 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00103 _x = self.header.frame_id
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 length = len(self.name)
00110 buff.write(_struct_I.pack(length))
00111 for val1 in self.name:
00112 length = len(val1)
00113 if python3 or type(val1) == unicode:
00114 val1 = val1.encode('utf-8')
00115 length = len(val1)
00116 buff.write(struct.pack('<I%ss'%length, length, val1))
00117 length = len(self.actual)
00118 buff.write(_struct_I.pack(length))
00119 pattern = '<%sd'%length
00120 buff.write(struct.pack(pattern, *self.actual))
00121 length = len(self.desired)
00122 buff.write(_struct_I.pack(length))
00123 pattern = '<%sd'%length
00124 buff.write(struct.pack(pattern, *self.desired))
00125 length = len(self.error)
00126 buff.write(_struct_I.pack(length))
00127 pattern = '<%sd'%length
00128 buff.write(struct.pack(pattern, *self.error))
00129 except struct.error as se: self._check_types(se)
00130 except TypeError as te: self._check_types(te)
00131
00132 def deserialize(self, str):
00133 """
00134 unpack serialized message in str into this message instance
00135 :param str: byte array of serialized message, ``str``
00136 """
00137 try:
00138 if self.header is None:
00139 self.header = std_msgs.msg.Header()
00140 end = 0
00141 _x = self
00142 start = end
00143 end += 12
00144 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 start = end
00149 end += length
00150 if python3:
00151 self.header.frame_id = str[start:end].decode('utf-8')
00152 else:
00153 self.header.frame_id = str[start:end]
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 self.name = []
00158 for i in range(0, length):
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 start = end
00163 end += length
00164 if python3:
00165 val1 = str[start:end].decode('utf-8')
00166 else:
00167 val1 = str[start:end]
00168 self.name.append(val1)
00169 start = end
00170 end += 4
00171 (length,) = _struct_I.unpack(str[start:end])
00172 pattern = '<%sd'%length
00173 start = end
00174 end += struct.calcsize(pattern)
00175 self.actual = struct.unpack(pattern, str[start:end])
00176 start = end
00177 end += 4
00178 (length,) = _struct_I.unpack(str[start:end])
00179 pattern = '<%sd'%length
00180 start = end
00181 end += struct.calcsize(pattern)
00182 self.desired = struct.unpack(pattern, str[start:end])
00183 start = end
00184 end += 4
00185 (length,) = _struct_I.unpack(str[start:end])
00186 pattern = '<%sd'%length
00187 start = end
00188 end += struct.calcsize(pattern)
00189 self.error = struct.unpack(pattern, str[start:end])
00190 return self
00191 except struct.error as e:
00192 raise genpy.DeserializationError(e)
00193
00194
00195 def serialize_numpy(self, buff, numpy):
00196 """
00197 serialize message with numpy array types into buffer
00198 :param buff: buffer, ``StringIO``
00199 :param numpy: numpy python module
00200 """
00201 try:
00202 _x = self
00203 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00204 _x = self.header.frame_id
00205 length = len(_x)
00206 if python3 or type(_x) == unicode:
00207 _x = _x.encode('utf-8')
00208 length = len(_x)
00209 buff.write(struct.pack('<I%ss'%length, length, _x))
00210 length = len(self.name)
00211 buff.write(_struct_I.pack(length))
00212 for val1 in self.name:
00213 length = len(val1)
00214 if python3 or type(val1) == unicode:
00215 val1 = val1.encode('utf-8')
00216 length = len(val1)
00217 buff.write(struct.pack('<I%ss'%length, length, val1))
00218 length = len(self.actual)
00219 buff.write(_struct_I.pack(length))
00220 pattern = '<%sd'%length
00221 buff.write(self.actual.tostring())
00222 length = len(self.desired)
00223 buff.write(_struct_I.pack(length))
00224 pattern = '<%sd'%length
00225 buff.write(self.desired.tostring())
00226 length = len(self.error)
00227 buff.write(_struct_I.pack(length))
00228 pattern = '<%sd'%length
00229 buff.write(self.error.tostring())
00230 except struct.error as se: self._check_types(se)
00231 except TypeError as te: self._check_types(te)
00232
00233 def deserialize_numpy(self, str, numpy):
00234 """
00235 unpack serialized message in str into this message instance using numpy for array types
00236 :param str: byte array of serialized message, ``str``
00237 :param numpy: numpy python module
00238 """
00239 try:
00240 if self.header is None:
00241 self.header = std_msgs.msg.Header()
00242 end = 0
00243 _x = self
00244 start = end
00245 end += 12
00246 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00247 start = end
00248 end += 4
00249 (length,) = _struct_I.unpack(str[start:end])
00250 start = end
00251 end += length
00252 if python3:
00253 self.header.frame_id = str[start:end].decode('utf-8')
00254 else:
00255 self.header.frame_id = str[start:end]
00256 start = end
00257 end += 4
00258 (length,) = _struct_I.unpack(str[start:end])
00259 self.name = []
00260 for i in range(0, length):
00261 start = end
00262 end += 4
00263 (length,) = _struct_I.unpack(str[start:end])
00264 start = end
00265 end += length
00266 if python3:
00267 val1 = str[start:end].decode('utf-8')
00268 else:
00269 val1 = str[start:end]
00270 self.name.append(val1)
00271 start = end
00272 end += 4
00273 (length,) = _struct_I.unpack(str[start:end])
00274 pattern = '<%sd'%length
00275 start = end
00276 end += struct.calcsize(pattern)
00277 self.actual = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00278 start = end
00279 end += 4
00280 (length,) = _struct_I.unpack(str[start:end])
00281 pattern = '<%sd'%length
00282 start = end
00283 end += struct.calcsize(pattern)
00284 self.desired = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00285 start = end
00286 end += 4
00287 (length,) = _struct_I.unpack(str[start:end])
00288 pattern = '<%sd'%length
00289 start = end
00290 end += struct.calcsize(pattern)
00291 self.error = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00292 return self
00293 except struct.error as e:
00294 raise genpy.DeserializationError(e)
00295
00296 _struct_I = genpy.struct_I
00297 _struct_3I = struct.Struct("<3I")