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