00001 """autogenerated by genpy from nasa_r2_common_msgs/ControllerJointSettings.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 ControllerJointSettings(genpy.Message):
00009 _md5sum = "2855ccfdd34b7753606f0f176bc1bb94"
00010 _type = "nasa_r2_common_msgs/ControllerJointSettings"
00011 _has_header = False
00012 _full_text = """string[] joint_names
00013 float64[] jointVelocityLimits
00014 float64[] jointAccelerationLimits
00015
00016 """
00017 __slots__ = ['joint_names','jointVelocityLimits','jointAccelerationLimits']
00018 _slot_types = ['string[]','float64[]','float64[]']
00019
00020 def __init__(self, *args, **kwds):
00021 """
00022 Constructor. Any message fields that are implicitly/explicitly
00023 set to None will be assigned a default value. The recommend
00024 use is keyword arguments as this is more robust to future message
00025 changes. You cannot mix in-order arguments and keyword arguments.
00026
00027 The available fields are:
00028 joint_names,jointVelocityLimits,jointAccelerationLimits
00029
00030 :param args: complete set of field values, in .msg order
00031 :param kwds: use keyword arguments corresponding to message field names
00032 to set specific fields.
00033 """
00034 if args or kwds:
00035 super(ControllerJointSettings, self).__init__(*args, **kwds)
00036
00037 if self.joint_names is None:
00038 self.joint_names = []
00039 if self.jointVelocityLimits is None:
00040 self.jointVelocityLimits = []
00041 if self.jointAccelerationLimits is None:
00042 self.jointAccelerationLimits = []
00043 else:
00044 self.joint_names = []
00045 self.jointVelocityLimits = []
00046 self.jointAccelerationLimits = []
00047
00048 def _get_types(self):
00049 """
00050 internal API method
00051 """
00052 return self._slot_types
00053
00054 def serialize(self, buff):
00055 """
00056 serialize message into buffer
00057 :param buff: buffer, ``StringIO``
00058 """
00059 try:
00060 length = len(self.joint_names)
00061 buff.write(_struct_I.pack(length))
00062 for val1 in self.joint_names:
00063 length = len(val1)
00064 if python3 or type(val1) == unicode:
00065 val1 = val1.encode('utf-8')
00066 length = len(val1)
00067 buff.write(struct.pack('<I%ss'%length, length, val1))
00068 length = len(self.jointVelocityLimits)
00069 buff.write(_struct_I.pack(length))
00070 pattern = '<%sd'%length
00071 buff.write(struct.pack(pattern, *self.jointVelocityLimits))
00072 length = len(self.jointAccelerationLimits)
00073 buff.write(_struct_I.pack(length))
00074 pattern = '<%sd'%length
00075 buff.write(struct.pack(pattern, *self.jointAccelerationLimits))
00076 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00077 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00078
00079 def deserialize(self, str):
00080 """
00081 unpack serialized message in str into this message instance
00082 :param str: byte array of serialized message, ``str``
00083 """
00084 try:
00085 end = 0
00086 start = end
00087 end += 4
00088 (length,) = _struct_I.unpack(str[start:end])
00089 self.joint_names = []
00090 for i in range(0, length):
00091 start = end
00092 end += 4
00093 (length,) = _struct_I.unpack(str[start:end])
00094 start = end
00095 end += length
00096 if python3:
00097 val1 = str[start:end].decode('utf-8')
00098 else:
00099 val1 = str[start:end]
00100 self.joint_names.append(val1)
00101 start = end
00102 end += 4
00103 (length,) = _struct_I.unpack(str[start:end])
00104 pattern = '<%sd'%length
00105 start = end
00106 end += struct.calcsize(pattern)
00107 self.jointVelocityLimits = struct.unpack(pattern, str[start:end])
00108 start = end
00109 end += 4
00110 (length,) = _struct_I.unpack(str[start:end])
00111 pattern = '<%sd'%length
00112 start = end
00113 end += struct.calcsize(pattern)
00114 self.jointAccelerationLimits = struct.unpack(pattern, str[start:end])
00115 return self
00116 except struct.error as e:
00117 raise genpy.DeserializationError(e)
00118
00119
00120 def serialize_numpy(self, buff, numpy):
00121 """
00122 serialize message with numpy array types into buffer
00123 :param buff: buffer, ``StringIO``
00124 :param numpy: numpy python module
00125 """
00126 try:
00127 length = len(self.joint_names)
00128 buff.write(_struct_I.pack(length))
00129 for val1 in self.joint_names:
00130 length = len(val1)
00131 if python3 or type(val1) == unicode:
00132 val1 = val1.encode('utf-8')
00133 length = len(val1)
00134 buff.write(struct.pack('<I%ss'%length, length, val1))
00135 length = len(self.jointVelocityLimits)
00136 buff.write(_struct_I.pack(length))
00137 pattern = '<%sd'%length
00138 buff.write(self.jointVelocityLimits.tostring())
00139 length = len(self.jointAccelerationLimits)
00140 buff.write(_struct_I.pack(length))
00141 pattern = '<%sd'%length
00142 buff.write(self.jointAccelerationLimits.tostring())
00143 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00144 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00145
00146 def deserialize_numpy(self, str, numpy):
00147 """
00148 unpack serialized message in str into this message instance using numpy for array types
00149 :param str: byte array of serialized message, ``str``
00150 :param numpy: numpy python module
00151 """
00152 try:
00153 end = 0
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 self.joint_names = []
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.joint_names.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.jointVelocityLimits = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
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.jointAccelerationLimits = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00183 return self
00184 except struct.error as e:
00185 raise genpy.DeserializationError(e)
00186
00187 _struct_I = genpy.struct_I