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