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