00001 """autogenerated by genpy from kdl_arm_kinematics/KDLWeights.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 KDLWeights(genpy.Message):
00009 _md5sum = "986315cd29a99987092b708377dfd2ce"
00010 _type = "kdl_arm_kinematics/KDLWeights"
00011 _has_header = False
00012 _full_text = """byte INVALID_MODE = 0
00013 byte SET_TS = 1
00014 byte SET_JS = 2
00015 byte SET_LAMBDA = 4
00016 byte SET_TS_JS = 3
00017
00018 byte mode # or-combination of values to set
00019 float64[36] weight_ts # the 6x6 matrix of task space weights in row-major order
00020 float64[] weight_js # the joints x joints matrix of joint space weights in row-major order
00021 float64 lambda # Lambda value
00022
00023 """
00024
00025 INVALID_MODE = 0
00026 SET_TS = 1
00027 SET_JS = 2
00028 SET_LAMBDA = 4
00029 SET_TS_JS = 3
00030
00031 __slots__ = ['mode','weight_ts','weight_js','lambda_']
00032 _slot_types = ['byte','float64[36]','float64[]','float64']
00033
00034 def __init__(self, *args, **kwds):
00035 """
00036 Constructor. Any message fields that are implicitly/explicitly
00037 set to None will be assigned a default value. The recommend
00038 use is keyword arguments as this is more robust to future message
00039 changes. You cannot mix in-order arguments and keyword arguments.
00040
00041 The available fields are:
00042 mode,weight_ts,weight_js,lambda_
00043
00044 :param args: complete set of field values, in .msg order
00045 :param kwds: use keyword arguments corresponding to message field names
00046 to set specific fields.
00047 """
00048 if args or kwds:
00049 super(KDLWeights, self).__init__(*args, **kwds)
00050
00051 if self.mode is None:
00052 self.mode = 0
00053 if self.weight_ts is None:
00054 self.weight_ts = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00055 if self.weight_js is None:
00056 self.weight_js = []
00057 if self.lambda_ is None:
00058 self.lambda_ = 0.
00059 else:
00060 self.mode = 0
00061 self.weight_ts = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
00062 self.weight_js = []
00063 self.lambda_ = 0.
00064
00065 def _get_types(self):
00066 """
00067 internal API method
00068 """
00069 return self._slot_types
00070
00071 def serialize(self, buff):
00072 """
00073 serialize message into buffer
00074 :param buff: buffer, ``StringIO``
00075 """
00076 try:
00077 buff.write(_struct_b.pack(self.mode))
00078 buff.write(_struct_36d.pack(*self.weight_ts))
00079 length = len(self.weight_js)
00080 buff.write(_struct_I.pack(length))
00081 pattern = '<%sd'%length
00082 buff.write(struct.pack(pattern, *self.weight_js))
00083 buff.write(_struct_d.pack(self.lambda_))
00084 except struct.error as se: self._check_types(se)
00085 except TypeError as te: self._check_types(te)
00086
00087 def deserialize(self, str):
00088 """
00089 unpack serialized message in str into this message instance
00090 :param str: byte array of serialized message, ``str``
00091 """
00092 try:
00093 end = 0
00094 start = end
00095 end += 1
00096 (self.mode,) = _struct_b.unpack(str[start:end])
00097 start = end
00098 end += 288
00099 self.weight_ts = _struct_36d.unpack(str[start:end])
00100 start = end
00101 end += 4
00102 (length,) = _struct_I.unpack(str[start:end])
00103 pattern = '<%sd'%length
00104 start = end
00105 end += struct.calcsize(pattern)
00106 self.weight_js = struct.unpack(pattern, str[start:end])
00107 start = end
00108 end += 8
00109 (self.lambda_,) = _struct_d.unpack(str[start:end])
00110 return self
00111 except struct.error as e:
00112 raise genpy.DeserializationError(e)
00113
00114
00115 def serialize_numpy(self, buff, numpy):
00116 """
00117 serialize message with numpy array types into buffer
00118 :param buff: buffer, ``StringIO``
00119 :param numpy: numpy python module
00120 """
00121 try:
00122 buff.write(_struct_b.pack(self.mode))
00123 buff.write(self.weight_ts.tostring())
00124 length = len(self.weight_js)
00125 buff.write(_struct_I.pack(length))
00126 pattern = '<%sd'%length
00127 buff.write(self.weight_js.tostring())
00128 buff.write(_struct_d.pack(self.lambda_))
00129 except struct.error as se: self._check_types(se)
00130 except TypeError as te: self._check_types(te)
00131
00132 def deserialize_numpy(self, str, numpy):
00133 """
00134 unpack serialized message in str into this message instance using numpy for array types
00135 :param str: byte array of serialized message, ``str``
00136 :param numpy: numpy python module
00137 """
00138 try:
00139 end = 0
00140 start = end
00141 end += 1
00142 (self.mode,) = _struct_b.unpack(str[start:end])
00143 start = end
00144 end += 288
00145 self.weight_ts = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=36)
00146 start = end
00147 end += 4
00148 (length,) = _struct_I.unpack(str[start:end])
00149 pattern = '<%sd'%length
00150 start = end
00151 end += struct.calcsize(pattern)
00152 self.weight_js = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00153 start = end
00154 end += 8
00155 (self.lambda_,) = _struct_d.unpack(str[start:end])
00156 return self
00157 except struct.error as e:
00158 raise genpy.DeserializationError(e)
00159
00160 _struct_I = genpy.struct_I
00161 _struct_36d = struct.Struct("<36d")
00162 _struct_b = struct.Struct("<b")
00163 _struct_d = struct.Struct("<d")