00001 """autogenerated by genpy from pr2_mechanism_controllers/BaseControllerState.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 geometry_msgs.msg
00008
00009 class BaseControllerState(genpy.Message):
00010 _md5sum = "7a488aa492f9175d5fa35e22e56c4b28"
00011 _type = "pr2_mechanism_controllers/BaseControllerState"
00012 _has_header = False
00013 _full_text = """geometry_msgs/Twist command
00014 float64[] joint_velocity_measured
00015 float64[] joint_velocity_commanded
00016 float64[] joint_velocity_error
00017 float64[] joint_effort_measured
00018 float64[] joint_effort_commanded
00019 float64[] joint_effort_error
00020 string[] joint_names
00021
00022
00023 ================================================================================
00024 MSG: geometry_msgs/Twist
00025 # This expresses velocity in free space broken into its linear and angular parts.
00026 Vector3 linear
00027 Vector3 angular
00028
00029 ================================================================================
00030 MSG: geometry_msgs/Vector3
00031 # This represents a vector in free space.
00032
00033 float64 x
00034 float64 y
00035 float64 z
00036 """
00037 __slots__ = ['command','joint_velocity_measured','joint_velocity_commanded','joint_velocity_error','joint_effort_measured','joint_effort_commanded','joint_effort_error','joint_names']
00038 _slot_types = ['geometry_msgs/Twist','float64[]','float64[]','float64[]','float64[]','float64[]','float64[]','string[]']
00039
00040 def __init__(self, *args, **kwds):
00041 """
00042 Constructor. Any message fields that are implicitly/explicitly
00043 set to None will be assigned a default value. The recommend
00044 use is keyword arguments as this is more robust to future message
00045 changes. You cannot mix in-order arguments and keyword arguments.
00046
00047 The available fields are:
00048 command,joint_velocity_measured,joint_velocity_commanded,joint_velocity_error,joint_effort_measured,joint_effort_commanded,joint_effort_error,joint_names
00049
00050 :param args: complete set of field values, in .msg order
00051 :param kwds: use keyword arguments corresponding to message field names
00052 to set specific fields.
00053 """
00054 if args or kwds:
00055 super(BaseControllerState, self).__init__(*args, **kwds)
00056
00057 if self.command is None:
00058 self.command = geometry_msgs.msg.Twist()
00059 if self.joint_velocity_measured is None:
00060 self.joint_velocity_measured = []
00061 if self.joint_velocity_commanded is None:
00062 self.joint_velocity_commanded = []
00063 if self.joint_velocity_error is None:
00064 self.joint_velocity_error = []
00065 if self.joint_effort_measured is None:
00066 self.joint_effort_measured = []
00067 if self.joint_effort_commanded is None:
00068 self.joint_effort_commanded = []
00069 if self.joint_effort_error is None:
00070 self.joint_effort_error = []
00071 if self.joint_names is None:
00072 self.joint_names = []
00073 else:
00074 self.command = geometry_msgs.msg.Twist()
00075 self.joint_velocity_measured = []
00076 self.joint_velocity_commanded = []
00077 self.joint_velocity_error = []
00078 self.joint_effort_measured = []
00079 self.joint_effort_commanded = []
00080 self.joint_effort_error = []
00081 self.joint_names = []
00082
00083 def _get_types(self):
00084 """
00085 internal API method
00086 """
00087 return self._slot_types
00088
00089 def serialize(self, buff):
00090 """
00091 serialize message into buffer
00092 :param buff: buffer, ``StringIO``
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_6d.pack(_x.command.linear.x, _x.command.linear.y, _x.command.linear.z, _x.command.angular.x, _x.command.angular.y, _x.command.angular.z))
00097 length = len(self.joint_velocity_measured)
00098 buff.write(_struct_I.pack(length))
00099 pattern = '<%sd'%length
00100 buff.write(struct.pack(pattern, *self.joint_velocity_measured))
00101 length = len(self.joint_velocity_commanded)
00102 buff.write(_struct_I.pack(length))
00103 pattern = '<%sd'%length
00104 buff.write(struct.pack(pattern, *self.joint_velocity_commanded))
00105 length = len(self.joint_velocity_error)
00106 buff.write(_struct_I.pack(length))
00107 pattern = '<%sd'%length
00108 buff.write(struct.pack(pattern, *self.joint_velocity_error))
00109 length = len(self.joint_effort_measured)
00110 buff.write(_struct_I.pack(length))
00111 pattern = '<%sd'%length
00112 buff.write(struct.pack(pattern, *self.joint_effort_measured))
00113 length = len(self.joint_effort_commanded)
00114 buff.write(_struct_I.pack(length))
00115 pattern = '<%sd'%length
00116 buff.write(struct.pack(pattern, *self.joint_effort_commanded))
00117 length = len(self.joint_effort_error)
00118 buff.write(_struct_I.pack(length))
00119 pattern = '<%sd'%length
00120 buff.write(struct.pack(pattern, *self.joint_effort_error))
00121 length = len(self.joint_names)
00122 buff.write(_struct_I.pack(length))
00123 for val1 in self.joint_names:
00124 length = len(val1)
00125 if python3 or type(val1) == unicode:
00126 val1 = val1.encode('utf-8')
00127 length = len(val1)
00128 buff.write(struct.pack('<I%ss'%length, length, val1))
00129 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00130 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00131
00132 def deserialize(self, str):
00133 """
00134 unpack serialized message in str into this message instance
00135 :param str: byte array of serialized message, ``str``
00136 """
00137 try:
00138 if self.command is None:
00139 self.command = geometry_msgs.msg.Twist()
00140 end = 0
00141 _x = self
00142 start = end
00143 end += 48
00144 (_x.command.linear.x, _x.command.linear.y, _x.command.linear.z, _x.command.angular.x, _x.command.angular.y, _x.command.angular.z,) = _struct_6d.unpack(str[start:end])
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 pattern = '<%sd'%length
00149 start = end
00150 end += struct.calcsize(pattern)
00151 self.joint_velocity_measured = struct.unpack(pattern, str[start:end])
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 pattern = '<%sd'%length
00156 start = end
00157 end += struct.calcsize(pattern)
00158 self.joint_velocity_commanded = struct.unpack(pattern, str[start:end])
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 pattern = '<%sd'%length
00163 start = end
00164 end += struct.calcsize(pattern)
00165 self.joint_velocity_error = struct.unpack(pattern, str[start:end])
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 pattern = '<%sd'%length
00170 start = end
00171 end += struct.calcsize(pattern)
00172 self.joint_effort_measured = struct.unpack(pattern, str[start:end])
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 pattern = '<%sd'%length
00177 start = end
00178 end += struct.calcsize(pattern)
00179 self.joint_effort_commanded = struct.unpack(pattern, str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 pattern = '<%sd'%length
00184 start = end
00185 end += struct.calcsize(pattern)
00186 self.joint_effort_error = struct.unpack(pattern, str[start:end])
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 self.joint_names = []
00191 for i in range(0, length):
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 start = end
00196 end += length
00197 if python3:
00198 val1 = str[start:end].decode('utf-8')
00199 else:
00200 val1 = str[start:end]
00201 self.joint_names.append(val1)
00202 return self
00203 except struct.error as e:
00204 raise genpy.DeserializationError(e)
00205
00206
00207 def serialize_numpy(self, buff, numpy):
00208 """
00209 serialize message with numpy array types into buffer
00210 :param buff: buffer, ``StringIO``
00211 :param numpy: numpy python module
00212 """
00213 try:
00214 _x = self
00215 buff.write(_struct_6d.pack(_x.command.linear.x, _x.command.linear.y, _x.command.linear.z, _x.command.angular.x, _x.command.angular.y, _x.command.angular.z))
00216 length = len(self.joint_velocity_measured)
00217 buff.write(_struct_I.pack(length))
00218 pattern = '<%sd'%length
00219 buff.write(self.joint_velocity_measured.tostring())
00220 length = len(self.joint_velocity_commanded)
00221 buff.write(_struct_I.pack(length))
00222 pattern = '<%sd'%length
00223 buff.write(self.joint_velocity_commanded.tostring())
00224 length = len(self.joint_velocity_error)
00225 buff.write(_struct_I.pack(length))
00226 pattern = '<%sd'%length
00227 buff.write(self.joint_velocity_error.tostring())
00228 length = len(self.joint_effort_measured)
00229 buff.write(_struct_I.pack(length))
00230 pattern = '<%sd'%length
00231 buff.write(self.joint_effort_measured.tostring())
00232 length = len(self.joint_effort_commanded)
00233 buff.write(_struct_I.pack(length))
00234 pattern = '<%sd'%length
00235 buff.write(self.joint_effort_commanded.tostring())
00236 length = len(self.joint_effort_error)
00237 buff.write(_struct_I.pack(length))
00238 pattern = '<%sd'%length
00239 buff.write(self.joint_effort_error.tostring())
00240 length = len(self.joint_names)
00241 buff.write(_struct_I.pack(length))
00242 for val1 in self.joint_names:
00243 length = len(val1)
00244 if python3 or type(val1) == unicode:
00245 val1 = val1.encode('utf-8')
00246 length = len(val1)
00247 buff.write(struct.pack('<I%ss'%length, length, val1))
00248 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00249 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00250
00251 def deserialize_numpy(self, str, numpy):
00252 """
00253 unpack serialized message in str into this message instance using numpy for array types
00254 :param str: byte array of serialized message, ``str``
00255 :param numpy: numpy python module
00256 """
00257 try:
00258 if self.command is None:
00259 self.command = geometry_msgs.msg.Twist()
00260 end = 0
00261 _x = self
00262 start = end
00263 end += 48
00264 (_x.command.linear.x, _x.command.linear.y, _x.command.linear.z, _x.command.angular.x, _x.command.angular.y, _x.command.angular.z,) = _struct_6d.unpack(str[start:end])
00265 start = end
00266 end += 4
00267 (length,) = _struct_I.unpack(str[start:end])
00268 pattern = '<%sd'%length
00269 start = end
00270 end += struct.calcsize(pattern)
00271 self.joint_velocity_measured = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00272 start = end
00273 end += 4
00274 (length,) = _struct_I.unpack(str[start:end])
00275 pattern = '<%sd'%length
00276 start = end
00277 end += struct.calcsize(pattern)
00278 self.joint_velocity_commanded = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00279 start = end
00280 end += 4
00281 (length,) = _struct_I.unpack(str[start:end])
00282 pattern = '<%sd'%length
00283 start = end
00284 end += struct.calcsize(pattern)
00285 self.joint_velocity_error = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00286 start = end
00287 end += 4
00288 (length,) = _struct_I.unpack(str[start:end])
00289 pattern = '<%sd'%length
00290 start = end
00291 end += struct.calcsize(pattern)
00292 self.joint_effort_measured = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00293 start = end
00294 end += 4
00295 (length,) = _struct_I.unpack(str[start:end])
00296 pattern = '<%sd'%length
00297 start = end
00298 end += struct.calcsize(pattern)
00299 self.joint_effort_commanded = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00300 start = end
00301 end += 4
00302 (length,) = _struct_I.unpack(str[start:end])
00303 pattern = '<%sd'%length
00304 start = end
00305 end += struct.calcsize(pattern)
00306 self.joint_effort_error = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00307 start = end
00308 end += 4
00309 (length,) = _struct_I.unpack(str[start:end])
00310 self.joint_names = []
00311 for i in range(0, length):
00312 start = end
00313 end += 4
00314 (length,) = _struct_I.unpack(str[start:end])
00315 start = end
00316 end += length
00317 if python3:
00318 val1 = str[start:end].decode('utf-8')
00319 else:
00320 val1 = str[start:end]
00321 self.joint_names.append(val1)
00322 return self
00323 except struct.error as e:
00324 raise genpy.DeserializationError(e)
00325
00326 _struct_I = genpy.struct_I
00327 _struct_6d = struct.Struct("<6d")