00001 """autogenerated by genpy from nao_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 = "d206ff6714336d8099e6c534bc7eb204"
00013 _type = "nao_msgs/JointTrajectoryGoal"
00014 _has_header = False
00015 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00016 # goal: a joint angle trajectory
00017 trajectory_msgs/JointTrajectory trajectory
00018 # flag whether motion is absolute (=0, default) or relative (=1)
00019 uint8 relative
00020
00021 ================================================================================
00022 MSG: trajectory_msgs/JointTrajectory
00023 Header header
00024 string[] joint_names
00025 JointTrajectoryPoint[] points
00026 ================================================================================
00027 MSG: std_msgs/Header
00028 # Standard metadata for higher-level stamped data types.
00029 # This is generally used to communicate timestamped data
00030 # in a particular coordinate frame.
00031 #
00032 # sequence ID: consecutively increasing ID
00033 uint32 seq
00034 #Two-integer timestamp that is expressed as:
00035 # * stamp.secs: seconds (stamp_secs) since epoch
00036 # * stamp.nsecs: nanoseconds since stamp_secs
00037 # time-handling sugar is provided by the client library
00038 time stamp
00039 #Frame this data is associated with
00040 # 0: no frame
00041 # 1: global frame
00042 string frame_id
00043
00044 ================================================================================
00045 MSG: trajectory_msgs/JointTrajectoryPoint
00046 float64[] positions
00047 float64[] velocities
00048 float64[] accelerations
00049 duration time_from_start
00050 """
00051 __slots__ = ['trajectory','relative']
00052 _slot_types = ['trajectory_msgs/JointTrajectory','uint8']
00053
00054 def __init__(self, *args, **kwds):
00055 """
00056 Constructor. Any message fields that are implicitly/explicitly
00057 set to None will be assigned a default value. The recommend
00058 use is keyword arguments as this is more robust to future message
00059 changes. You cannot mix in-order arguments and keyword arguments.
00060
00061 The available fields are:
00062 trajectory,relative
00063
00064 :param args: complete set of field values, in .msg order
00065 :param kwds: use keyword arguments corresponding to message field names
00066 to set specific fields.
00067 """
00068 if args or kwds:
00069 super(JointTrajectoryGoal, self).__init__(*args, **kwds)
00070
00071 if self.trajectory is None:
00072 self.trajectory = trajectory_msgs.msg.JointTrajectory()
00073 if self.relative is None:
00074 self.relative = 0
00075 else:
00076 self.trajectory = trajectory_msgs.msg.JointTrajectory()
00077 self.relative = 0
00078
00079 def _get_types(self):
00080 """
00081 internal API method
00082 """
00083 return self._slot_types
00084
00085 def serialize(self, buff):
00086 """
00087 serialize message into buffer
00088 :param buff: buffer, ``StringIO``
00089 """
00090 try:
00091 _x = self
00092 buff.write(_struct_3I.pack(_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs))
00093 _x = self.trajectory.header.frame_id
00094 length = len(_x)
00095 if python3 or type(_x) == unicode:
00096 _x = _x.encode('utf-8')
00097 length = len(_x)
00098 buff.write(struct.pack('<I%ss'%length, length, _x))
00099 length = len(self.trajectory.joint_names)
00100 buff.write(_struct_I.pack(length))
00101 for val1 in self.trajectory.joint_names:
00102 length = len(val1)
00103 if python3 or type(val1) == unicode:
00104 val1 = val1.encode('utf-8')
00105 length = len(val1)
00106 buff.write(struct.pack('<I%ss'%length, length, val1))
00107 length = len(self.trajectory.points)
00108 buff.write(_struct_I.pack(length))
00109 for val1 in self.trajectory.points:
00110 length = len(val1.positions)
00111 buff.write(_struct_I.pack(length))
00112 pattern = '<%sd'%length
00113 buff.write(struct.pack(pattern, *val1.positions))
00114 length = len(val1.velocities)
00115 buff.write(_struct_I.pack(length))
00116 pattern = '<%sd'%length
00117 buff.write(struct.pack(pattern, *val1.velocities))
00118 length = len(val1.accelerations)
00119 buff.write(_struct_I.pack(length))
00120 pattern = '<%sd'%length
00121 buff.write(struct.pack(pattern, *val1.accelerations))
00122 _v1 = val1.time_from_start
00123 _x = _v1
00124 buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00125 buff.write(_struct_B.pack(self.relative))
00126 except struct.error as se: self._check_types(se)
00127 except TypeError as te: self._check_types(te)
00128
00129 def deserialize(self, str):
00130 """
00131 unpack serialized message in str into this message instance
00132 :param str: byte array of serialized message, ``str``
00133 """
00134 try:
00135 if self.trajectory is None:
00136 self.trajectory = trajectory_msgs.msg.JointTrajectory()
00137 end = 0
00138 _x = self
00139 start = end
00140 end += 12
00141 (_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 start = end
00146 end += length
00147 if python3:
00148 self.trajectory.header.frame_id = str[start:end].decode('utf-8')
00149 else:
00150 self.trajectory.header.frame_id = str[start:end]
00151 start = end
00152 end += 4
00153 (length,) = _struct_I.unpack(str[start:end])
00154 self.trajectory.joint_names = []
00155 for i in range(0, length):
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 start = end
00160 end += length
00161 if python3:
00162 val1 = str[start:end].decode('utf-8')
00163 else:
00164 val1 = str[start:end]
00165 self.trajectory.joint_names.append(val1)
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 self.trajectory.points = []
00170 for i in range(0, length):
00171 val1 = trajectory_msgs.msg.JointTrajectoryPoint()
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.positions = 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.velocities = struct.unpack(pattern, str[start:end])
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 pattern = '<%sd'%length
00190 start = end
00191 end += struct.calcsize(pattern)
00192 val1.accelerations = struct.unpack(pattern, str[start:end])
00193 _v2 = val1.time_from_start
00194 _x = _v2
00195 start = end
00196 end += 8
00197 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00198 self.trajectory.points.append(val1)
00199 start = end
00200 end += 1
00201 (self.relative,) = _struct_B.unpack(str[start:end])
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_3I.pack(_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs))
00216 _x = self.trajectory.header.frame_id
00217 length = len(_x)
00218 if python3 or type(_x) == unicode:
00219 _x = _x.encode('utf-8')
00220 length = len(_x)
00221 buff.write(struct.pack('<I%ss'%length, length, _x))
00222 length = len(self.trajectory.joint_names)
00223 buff.write(_struct_I.pack(length))
00224 for val1 in self.trajectory.joint_names:
00225 length = len(val1)
00226 if python3 or type(val1) == unicode:
00227 val1 = val1.encode('utf-8')
00228 length = len(val1)
00229 buff.write(struct.pack('<I%ss'%length, length, val1))
00230 length = len(self.trajectory.points)
00231 buff.write(_struct_I.pack(length))
00232 for val1 in self.trajectory.points:
00233 length = len(val1.positions)
00234 buff.write(_struct_I.pack(length))
00235 pattern = '<%sd'%length
00236 buff.write(val1.positions.tostring())
00237 length = len(val1.velocities)
00238 buff.write(_struct_I.pack(length))
00239 pattern = '<%sd'%length
00240 buff.write(val1.velocities.tostring())
00241 length = len(val1.accelerations)
00242 buff.write(_struct_I.pack(length))
00243 pattern = '<%sd'%length
00244 buff.write(val1.accelerations.tostring())
00245 _v3 = val1.time_from_start
00246 _x = _v3
00247 buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00248 buff.write(_struct_B.pack(self.relative))
00249 except struct.error as se: self._check_types(se)
00250 except TypeError as te: self._check_types(te)
00251
00252 def deserialize_numpy(self, str, numpy):
00253 """
00254 unpack serialized message in str into this message instance using numpy for array types
00255 :param str: byte array of serialized message, ``str``
00256 :param numpy: numpy python module
00257 """
00258 try:
00259 if self.trajectory is None:
00260 self.trajectory = trajectory_msgs.msg.JointTrajectory()
00261 end = 0
00262 _x = self
00263 start = end
00264 end += 12
00265 (_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00266 start = end
00267 end += 4
00268 (length,) = _struct_I.unpack(str[start:end])
00269 start = end
00270 end += length
00271 if python3:
00272 self.trajectory.header.frame_id = str[start:end].decode('utf-8')
00273 else:
00274 self.trajectory.header.frame_id = str[start:end]
00275 start = end
00276 end += 4
00277 (length,) = _struct_I.unpack(str[start:end])
00278 self.trajectory.joint_names = []
00279 for i in range(0, length):
00280 start = end
00281 end += 4
00282 (length,) = _struct_I.unpack(str[start:end])
00283 start = end
00284 end += length
00285 if python3:
00286 val1 = str[start:end].decode('utf-8')
00287 else:
00288 val1 = str[start:end]
00289 self.trajectory.joint_names.append(val1)
00290 start = end
00291 end += 4
00292 (length,) = _struct_I.unpack(str[start:end])
00293 self.trajectory.points = []
00294 for i in range(0, length):
00295 val1 = trajectory_msgs.msg.JointTrajectoryPoint()
00296 start = end
00297 end += 4
00298 (length,) = _struct_I.unpack(str[start:end])
00299 pattern = '<%sd'%length
00300 start = end
00301 end += struct.calcsize(pattern)
00302 val1.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00303 start = end
00304 end += 4
00305 (length,) = _struct_I.unpack(str[start:end])
00306 pattern = '<%sd'%length
00307 start = end
00308 end += struct.calcsize(pattern)
00309 val1.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00310 start = end
00311 end += 4
00312 (length,) = _struct_I.unpack(str[start:end])
00313 pattern = '<%sd'%length
00314 start = end
00315 end += struct.calcsize(pattern)
00316 val1.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00317 _v4 = val1.time_from_start
00318 _x = _v4
00319 start = end
00320 end += 8
00321 (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00322 self.trajectory.points.append(val1)
00323 start = end
00324 end += 1
00325 (self.relative,) = _struct_B.unpack(str[start:end])
00326 return self
00327 except struct.error as e:
00328 raise genpy.DeserializationError(e)
00329
00330 _struct_I = genpy.struct_I
00331 _struct_3I = struct.Struct("<3I")
00332 _struct_B = struct.Struct("<B")
00333 _struct_2i = struct.Struct("<2i")