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