00001 """autogenerated by genpy from lwr_fri/FriJointImpedance.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class FriJointImpedance(genpy.Message):
00009 _md5sum = "0d99cffe99f4e45e313ffa6bb7c0de4e"
00010 _type = "lwr_fri/FriJointImpedance"
00011 _has_header = False
00012 _full_text = """float32[7] stiffness
00013 float32[7] damping
00014 """
00015 __slots__ = ['stiffness','damping']
00016 _slot_types = ['float32[7]','float32[7]']
00017
00018 def __init__(self, *args, **kwds):
00019 """
00020 Constructor. Any message fields that are implicitly/explicitly
00021 set to None will be assigned a default value. The recommend
00022 use is keyword arguments as this is more robust to future message
00023 changes. You cannot mix in-order arguments and keyword arguments.
00024
00025 The available fields are:
00026 stiffness,damping
00027
00028 :param args: complete set of field values, in .msg order
00029 :param kwds: use keyword arguments corresponding to message field names
00030 to set specific fields.
00031 """
00032 if args or kwds:
00033 super(FriJointImpedance, self).__init__(*args, **kwds)
00034
00035 if self.stiffness is None:
00036 self.stiffness = [0.,0.,0.,0.,0.,0.,0.]
00037 if self.damping is None:
00038 self.damping = [0.,0.,0.,0.,0.,0.,0.]
00039 else:
00040 self.stiffness = [0.,0.,0.,0.,0.,0.,0.]
00041 self.damping = [0.,0.,0.,0.,0.,0.,0.]
00042
00043 def _get_types(self):
00044 """
00045 internal API method
00046 """
00047 return self._slot_types
00048
00049 def serialize(self, buff):
00050 """
00051 serialize message into buffer
00052 :param buff: buffer, ``StringIO``
00053 """
00054 try:
00055 buff.write(_struct_7f.pack(*self.stiffness))
00056 buff.write(_struct_7f.pack(*self.damping))
00057 except struct.error as se: self._check_types(se)
00058 except TypeError as te: self._check_types(te)
00059
00060 def deserialize(self, str):
00061 """
00062 unpack serialized message in str into this message instance
00063 :param str: byte array of serialized message, ``str``
00064 """
00065 try:
00066 end = 0
00067 start = end
00068 end += 28
00069 self.stiffness = _struct_7f.unpack(str[start:end])
00070 start = end
00071 end += 28
00072 self.damping = _struct_7f.unpack(str[start:end])
00073 return self
00074 except struct.error as e:
00075 raise genpy.DeserializationError(e)
00076
00077
00078 def serialize_numpy(self, buff, numpy):
00079 """
00080 serialize message with numpy array types into buffer
00081 :param buff: buffer, ``StringIO``
00082 :param numpy: numpy python module
00083 """
00084 try:
00085 buff.write(self.stiffness.tostring())
00086 buff.write(self.damping.tostring())
00087 except struct.error as se: self._check_types(se)
00088 except TypeError as te: self._check_types(te)
00089
00090 def deserialize_numpy(self, str, numpy):
00091 """
00092 unpack serialized message in str into this message instance using numpy for array types
00093 :param str: byte array of serialized message, ``str``
00094 :param numpy: numpy python module
00095 """
00096 try:
00097 end = 0
00098 start = end
00099 end += 28
00100 self.stiffness = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=7)
00101 start = end
00102 end += 28
00103 self.damping = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=7)
00104 return self
00105 except struct.error as e:
00106 raise genpy.DeserializationError(e)
00107
00108 _struct_I = genpy.struct_I
00109 _struct_7f = struct.Struct("<7f")