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