00001 """autogenerated by genpy from pr2_controllers_msgs/JointTrajectoryControllerState.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 trajectory_msgs.msg
00008 import genpy
00009 import std_msgs.msg
00010
00011 class JointTrajectoryControllerState(genpy.Message):
00012 _md5sum = "b11d532a92ee589417fdd76559eb1d9e"
00013 _type = "pr2_controllers_msgs/JointTrajectoryControllerState"
00014 _has_header = True
00015 _full_text = """Header header
00016 string[] joint_names
00017 trajectory_msgs/JointTrajectoryPoint desired
00018 trajectory_msgs/JointTrajectoryPoint actual
00019 trajectory_msgs/JointTrajectoryPoint error # Redundant, but useful
00020
00021 ================================================================================
00022 MSG: std_msgs/Header
00023 # Standard metadata for higher-level stamped data types.
00024 # This is generally used to communicate timestamped data
00025 # in a particular coordinate frame.
00026 #
00027 # sequence ID: consecutively increasing ID
00028 uint32 seq
00029 #Two-integer timestamp that is expressed as:
00030 # * stamp.secs: seconds (stamp_secs) since epoch
00031 # * stamp.nsecs: nanoseconds since stamp_secs
00032 # time-handling sugar is provided by the client library
00033 time stamp
00034 #Frame this data is associated with
00035 # 0: no frame
00036 # 1: global frame
00037 string frame_id
00038
00039 ================================================================================
00040 MSG: trajectory_msgs/JointTrajectoryPoint
00041 float64[] positions
00042 float64[] velocities
00043 float64[] accelerations
00044 duration time_from_start
00045 """
00046 __slots__ = ['header','joint_names','desired','actual','error']
00047 _slot_types = ['std_msgs/Header','string[]','trajectory_msgs/JointTrajectoryPoint','trajectory_msgs/JointTrajectoryPoint','trajectory_msgs/JointTrajectoryPoint']
00048
00049 def __init__(self, *args, **kwds):
00050 """
00051 Constructor. Any message fields that are implicitly/explicitly
00052 set to None will be assigned a default value. The recommend
00053 use is keyword arguments as this is more robust to future message
00054 changes. You cannot mix in-order arguments and keyword arguments.
00055
00056 The available fields are:
00057 header,joint_names,desired,actual,error
00058
00059 :param args: complete set of field values, in .msg order
00060 :param kwds: use keyword arguments corresponding to message field names
00061 to set specific fields.
00062 """
00063 if args or kwds:
00064 super(JointTrajectoryControllerState, self).__init__(*args, **kwds)
00065
00066 if self.header is None:
00067 self.header = std_msgs.msg.Header()
00068 if self.joint_names is None:
00069 self.joint_names = []
00070 if self.desired is None:
00071 self.desired = trajectory_msgs.msg.JointTrajectoryPoint()
00072 if self.actual is None:
00073 self.actual = trajectory_msgs.msg.JointTrajectoryPoint()
00074 if self.error is None:
00075 self.error = trajectory_msgs.msg.JointTrajectoryPoint()
00076 else:
00077 self.header = std_msgs.msg.Header()
00078 self.joint_names = []
00079 self.desired = trajectory_msgs.msg.JointTrajectoryPoint()
00080 self.actual = trajectory_msgs.msg.JointTrajectoryPoint()
00081 self.error = trajectory_msgs.msg.JointTrajectoryPoint()
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_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00097 _x = self.header.frame_id
00098 length = len(_x)
00099 if python3 or type(_x) == unicode:
00100 _x = _x.encode('utf-8')
00101 length = len(_x)
00102 buff.write(struct.pack('<I%ss'%length, length, _x))
00103 length = len(self.joint_names)
00104 buff.write(_struct_I.pack(length))
00105 for val1 in self.joint_names:
00106 length = len(val1)
00107 if python3 or type(val1) == unicode:
00108 val1 = val1.encode('utf-8')
00109 length = len(val1)
00110 buff.write(struct.pack('<I%ss'%length, length, val1))
00111 length = len(self.desired.positions)
00112 buff.write(_struct_I.pack(length))
00113 pattern = '<%sd'%length
00114 buff.write(struct.pack(pattern, *self.desired.positions))
00115 length = len(self.desired.velocities)
00116 buff.write(_struct_I.pack(length))
00117 pattern = '<%sd'%length
00118 buff.write(struct.pack(pattern, *self.desired.velocities))
00119 length = len(self.desired.accelerations)
00120 buff.write(_struct_I.pack(length))
00121 pattern = '<%sd'%length
00122 buff.write(struct.pack(pattern, *self.desired.accelerations))
00123 _x = self
00124 buff.write(_struct_2i.pack(_x.desired.time_from_start.secs, _x.desired.time_from_start.nsecs))
00125 length = len(self.actual.positions)
00126 buff.write(_struct_I.pack(length))
00127 pattern = '<%sd'%length
00128 buff.write(struct.pack(pattern, *self.actual.positions))
00129 length = len(self.actual.velocities)
00130 buff.write(_struct_I.pack(length))
00131 pattern = '<%sd'%length
00132 buff.write(struct.pack(pattern, *self.actual.velocities))
00133 length = len(self.actual.accelerations)
00134 buff.write(_struct_I.pack(length))
00135 pattern = '<%sd'%length
00136 buff.write(struct.pack(pattern, *self.actual.accelerations))
00137 _x = self
00138 buff.write(_struct_2i.pack(_x.actual.time_from_start.secs, _x.actual.time_from_start.nsecs))
00139 length = len(self.error.positions)
00140 buff.write(_struct_I.pack(length))
00141 pattern = '<%sd'%length
00142 buff.write(struct.pack(pattern, *self.error.positions))
00143 length = len(self.error.velocities)
00144 buff.write(_struct_I.pack(length))
00145 pattern = '<%sd'%length
00146 buff.write(struct.pack(pattern, *self.error.velocities))
00147 length = len(self.error.accelerations)
00148 buff.write(_struct_I.pack(length))
00149 pattern = '<%sd'%length
00150 buff.write(struct.pack(pattern, *self.error.accelerations))
00151 _x = self
00152 buff.write(_struct_2i.pack(_x.error.time_from_start.secs, _x.error.time_from_start.nsecs))
00153 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00154 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00155
00156 def deserialize(self, str):
00157 """
00158 unpack serialized message in str into this message instance
00159 :param str: byte array of serialized message, ``str``
00160 """
00161 try:
00162 if self.header is None:
00163 self.header = std_msgs.msg.Header()
00164 if self.desired is None:
00165 self.desired = trajectory_msgs.msg.JointTrajectoryPoint()
00166 if self.actual is None:
00167 self.actual = trajectory_msgs.msg.JointTrajectoryPoint()
00168 if self.error is None:
00169 self.error = trajectory_msgs.msg.JointTrajectoryPoint()
00170 end = 0
00171 _x = self
00172 start = end
00173 end += 12
00174 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00175 start = end
00176 end += 4
00177 (length,) = _struct_I.unpack(str[start:end])
00178 start = end
00179 end += length
00180 if python3:
00181 self.header.frame_id = str[start:end].decode('utf-8')
00182 else:
00183 self.header.frame_id = str[start:end]
00184 start = end
00185 end += 4
00186 (length,) = _struct_I.unpack(str[start:end])
00187 self.joint_names = []
00188 for i in range(0, length):
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 start = end
00193 end += length
00194 if python3:
00195 val1 = str[start:end].decode('utf-8')
00196 else:
00197 val1 = str[start:end]
00198 self.joint_names.append(val1)
00199 start = end
00200 end += 4
00201 (length,) = _struct_I.unpack(str[start:end])
00202 pattern = '<%sd'%length
00203 start = end
00204 end += struct.calcsize(pattern)
00205 self.desired.positions = struct.unpack(pattern, str[start:end])
00206 start = end
00207 end += 4
00208 (length,) = _struct_I.unpack(str[start:end])
00209 pattern = '<%sd'%length
00210 start = end
00211 end += struct.calcsize(pattern)
00212 self.desired.velocities = struct.unpack(pattern, str[start:end])
00213 start = end
00214 end += 4
00215 (length,) = _struct_I.unpack(str[start:end])
00216 pattern = '<%sd'%length
00217 start = end
00218 end += struct.calcsize(pattern)
00219 self.desired.accelerations = struct.unpack(pattern, str[start:end])
00220 _x = self
00221 start = end
00222 end += 8
00223 (_x.desired.time_from_start.secs, _x.desired.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00224 start = end
00225 end += 4
00226 (length,) = _struct_I.unpack(str[start:end])
00227 pattern = '<%sd'%length
00228 start = end
00229 end += struct.calcsize(pattern)
00230 self.actual.positions = struct.unpack(pattern, str[start:end])
00231 start = end
00232 end += 4
00233 (length,) = _struct_I.unpack(str[start:end])
00234 pattern = '<%sd'%length
00235 start = end
00236 end += struct.calcsize(pattern)
00237 self.actual.velocities = struct.unpack(pattern, str[start:end])
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 pattern = '<%sd'%length
00242 start = end
00243 end += struct.calcsize(pattern)
00244 self.actual.accelerations = struct.unpack(pattern, str[start:end])
00245 _x = self
00246 start = end
00247 end += 8
00248 (_x.actual.time_from_start.secs, _x.actual.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00249 start = end
00250 end += 4
00251 (length,) = _struct_I.unpack(str[start:end])
00252 pattern = '<%sd'%length
00253 start = end
00254 end += struct.calcsize(pattern)
00255 self.error.positions = struct.unpack(pattern, str[start:end])
00256 start = end
00257 end += 4
00258 (length,) = _struct_I.unpack(str[start:end])
00259 pattern = '<%sd'%length
00260 start = end
00261 end += struct.calcsize(pattern)
00262 self.error.velocities = struct.unpack(pattern, str[start:end])
00263 start = end
00264 end += 4
00265 (length,) = _struct_I.unpack(str[start:end])
00266 pattern = '<%sd'%length
00267 start = end
00268 end += struct.calcsize(pattern)
00269 self.error.accelerations = struct.unpack(pattern, str[start:end])
00270 _x = self
00271 start = end
00272 end += 8
00273 (_x.error.time_from_start.secs, _x.error.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00274 return self
00275 except struct.error as e:
00276 raise genpy.DeserializationError(e)
00277
00278
00279 def serialize_numpy(self, buff, numpy):
00280 """
00281 serialize message with numpy array types into buffer
00282 :param buff: buffer, ``StringIO``
00283 :param numpy: numpy python module
00284 """
00285 try:
00286 _x = self
00287 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00288 _x = self.header.frame_id
00289 length = len(_x)
00290 if python3 or type(_x) == unicode:
00291 _x = _x.encode('utf-8')
00292 length = len(_x)
00293 buff.write(struct.pack('<I%ss'%length, length, _x))
00294 length = len(self.joint_names)
00295 buff.write(_struct_I.pack(length))
00296 for val1 in self.joint_names:
00297 length = len(val1)
00298 if python3 or type(val1) == unicode:
00299 val1 = val1.encode('utf-8')
00300 length = len(val1)
00301 buff.write(struct.pack('<I%ss'%length, length, val1))
00302 length = len(self.desired.positions)
00303 buff.write(_struct_I.pack(length))
00304 pattern = '<%sd'%length
00305 buff.write(self.desired.positions.tostring())
00306 length = len(self.desired.velocities)
00307 buff.write(_struct_I.pack(length))
00308 pattern = '<%sd'%length
00309 buff.write(self.desired.velocities.tostring())
00310 length = len(self.desired.accelerations)
00311 buff.write(_struct_I.pack(length))
00312 pattern = '<%sd'%length
00313 buff.write(self.desired.accelerations.tostring())
00314 _x = self
00315 buff.write(_struct_2i.pack(_x.desired.time_from_start.secs, _x.desired.time_from_start.nsecs))
00316 length = len(self.actual.positions)
00317 buff.write(_struct_I.pack(length))
00318 pattern = '<%sd'%length
00319 buff.write(self.actual.positions.tostring())
00320 length = len(self.actual.velocities)
00321 buff.write(_struct_I.pack(length))
00322 pattern = '<%sd'%length
00323 buff.write(self.actual.velocities.tostring())
00324 length = len(self.actual.accelerations)
00325 buff.write(_struct_I.pack(length))
00326 pattern = '<%sd'%length
00327 buff.write(self.actual.accelerations.tostring())
00328 _x = self
00329 buff.write(_struct_2i.pack(_x.actual.time_from_start.secs, _x.actual.time_from_start.nsecs))
00330 length = len(self.error.positions)
00331 buff.write(_struct_I.pack(length))
00332 pattern = '<%sd'%length
00333 buff.write(self.error.positions.tostring())
00334 length = len(self.error.velocities)
00335 buff.write(_struct_I.pack(length))
00336 pattern = '<%sd'%length
00337 buff.write(self.error.velocities.tostring())
00338 length = len(self.error.accelerations)
00339 buff.write(_struct_I.pack(length))
00340 pattern = '<%sd'%length
00341 buff.write(self.error.accelerations.tostring())
00342 _x = self
00343 buff.write(_struct_2i.pack(_x.error.time_from_start.secs, _x.error.time_from_start.nsecs))
00344 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00345 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00346
00347 def deserialize_numpy(self, str, numpy):
00348 """
00349 unpack serialized message in str into this message instance using numpy for array types
00350 :param str: byte array of serialized message, ``str``
00351 :param numpy: numpy python module
00352 """
00353 try:
00354 if self.header is None:
00355 self.header = std_msgs.msg.Header()
00356 if self.desired is None:
00357 self.desired = trajectory_msgs.msg.JointTrajectoryPoint()
00358 if self.actual is None:
00359 self.actual = trajectory_msgs.msg.JointTrajectoryPoint()
00360 if self.error is None:
00361 self.error = trajectory_msgs.msg.JointTrajectoryPoint()
00362 end = 0
00363 _x = self
00364 start = end
00365 end += 12
00366 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00367 start = end
00368 end += 4
00369 (length,) = _struct_I.unpack(str[start:end])
00370 start = end
00371 end += length
00372 if python3:
00373 self.header.frame_id = str[start:end].decode('utf-8')
00374 else:
00375 self.header.frame_id = str[start:end]
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 self.joint_names = []
00380 for i in range(0, length):
00381 start = end
00382 end += 4
00383 (length,) = _struct_I.unpack(str[start:end])
00384 start = end
00385 end += length
00386 if python3:
00387 val1 = str[start:end].decode('utf-8')
00388 else:
00389 val1 = str[start:end]
00390 self.joint_names.append(val1)
00391 start = end
00392 end += 4
00393 (length,) = _struct_I.unpack(str[start:end])
00394 pattern = '<%sd'%length
00395 start = end
00396 end += struct.calcsize(pattern)
00397 self.desired.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00398 start = end
00399 end += 4
00400 (length,) = _struct_I.unpack(str[start:end])
00401 pattern = '<%sd'%length
00402 start = end
00403 end += struct.calcsize(pattern)
00404 self.desired.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00405 start = end
00406 end += 4
00407 (length,) = _struct_I.unpack(str[start:end])
00408 pattern = '<%sd'%length
00409 start = end
00410 end += struct.calcsize(pattern)
00411 self.desired.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00412 _x = self
00413 start = end
00414 end += 8
00415 (_x.desired.time_from_start.secs, _x.desired.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00416 start = end
00417 end += 4
00418 (length,) = _struct_I.unpack(str[start:end])
00419 pattern = '<%sd'%length
00420 start = end
00421 end += struct.calcsize(pattern)
00422 self.actual.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00423 start = end
00424 end += 4
00425 (length,) = _struct_I.unpack(str[start:end])
00426 pattern = '<%sd'%length
00427 start = end
00428 end += struct.calcsize(pattern)
00429 self.actual.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00430 start = end
00431 end += 4
00432 (length,) = _struct_I.unpack(str[start:end])
00433 pattern = '<%sd'%length
00434 start = end
00435 end += struct.calcsize(pattern)
00436 self.actual.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00437 _x = self
00438 start = end
00439 end += 8
00440 (_x.actual.time_from_start.secs, _x.actual.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00441 start = end
00442 end += 4
00443 (length,) = _struct_I.unpack(str[start:end])
00444 pattern = '<%sd'%length
00445 start = end
00446 end += struct.calcsize(pattern)
00447 self.error.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00448 start = end
00449 end += 4
00450 (length,) = _struct_I.unpack(str[start:end])
00451 pattern = '<%sd'%length
00452 start = end
00453 end += struct.calcsize(pattern)
00454 self.error.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00455 start = end
00456 end += 4
00457 (length,) = _struct_I.unpack(str[start:end])
00458 pattern = '<%sd'%length
00459 start = end
00460 end += struct.calcsize(pattern)
00461 self.error.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00462 _x = self
00463 start = end
00464 end += 8
00465 (_x.error.time_from_start.secs, _x.error.time_from_start.nsecs,) = _struct_2i.unpack(str[start:end])
00466 return self
00467 except struct.error as e:
00468 raise genpy.DeserializationError(e)
00469
00470 _struct_I = genpy.struct_I
00471 _struct_3I = struct.Struct("<3I")
00472 _struct_2i = struct.Struct("<2i")