_JointTrajectoryReplan.py
Go to the documentation of this file.
00001 """autogenerated by genpy from nasa_r2_common_msgs/JointTrajectoryReplan.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 nasa_r2_common_msgs.msg
00009 import genpy
00010 import std_msgs.msg
00011 
00012 class JointTrajectoryReplan(genpy.Message):
00013   _md5sum = "52e14a24d46f80cd4ed4e7a40daa0c1e"
00014   _type = "nasa_r2_common_msgs/JointTrajectoryReplan"
00015   _has_header = True #flag to mark the presence of a Header object
00016   _full_text = """Header header
00017 ReplanType[] replan
00018 trajectory_msgs/JointTrajectory trajectory
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: nasa_r2_common_msgs/ReplanType
00040 uint8 type
00041 
00042 uint8 NONE = 0
00043 uint8 SOFT = 1
00044 uint8 HARD = 2
00045 uint8 STOP = 3
00046 uint8 PAUSE = 4
00047 uint8 CONTINUE = 5
00048 
00049 ================================================================================
00050 MSG: trajectory_msgs/JointTrajectory
00051 Header header
00052 string[] joint_names
00053 JointTrajectoryPoint[] points
00054 ================================================================================
00055 MSG: trajectory_msgs/JointTrajectoryPoint
00056 float64[] positions
00057 float64[] velocities
00058 float64[] accelerations
00059 duration time_from_start
00060 """
00061   __slots__ = ['header','replan','trajectory']
00062   _slot_types = ['std_msgs/Header','nasa_r2_common_msgs/ReplanType[]','trajectory_msgs/JointTrajectory']
00063 
00064   def __init__(self, *args, **kwds):
00065     """
00066     Constructor. Any message fields that are implicitly/explicitly
00067     set to None will be assigned a default value. The recommend
00068     use is keyword arguments as this is more robust to future message
00069     changes.  You cannot mix in-order arguments and keyword arguments.
00070 
00071     The available fields are:
00072        header,replan,trajectory
00073 
00074     :param args: complete set of field values, in .msg order
00075     :param kwds: use keyword arguments corresponding to message field names
00076     to set specific fields.
00077     """
00078     if args or kwds:
00079       super(JointTrajectoryReplan, self).__init__(*args, **kwds)
00080       #message fields cannot be None, assign default values for those that are
00081       if self.header is None:
00082         self.header = std_msgs.msg.Header()
00083       if self.replan is None:
00084         self.replan = []
00085       if self.trajectory is None:
00086         self.trajectory = trajectory_msgs.msg.JointTrajectory()
00087     else:
00088       self.header = std_msgs.msg.Header()
00089       self.replan = []
00090       self.trajectory = trajectory_msgs.msg.JointTrajectory()
00091 
00092   def _get_types(self):
00093     """
00094     internal API method
00095     """
00096     return self._slot_types
00097 
00098   def serialize(self, buff):
00099     """
00100     serialize message into buffer
00101     :param buff: buffer, ``StringIO``
00102     """
00103     try:
00104       _x = self
00105       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00106       _x = self.header.frame_id
00107       length = len(_x)
00108       if python3 or type(_x) == unicode:
00109         _x = _x.encode('utf-8')
00110         length = len(_x)
00111       buff.write(struct.pack('<I%ss'%length, length, _x))
00112       length = len(self.replan)
00113       buff.write(_struct_I.pack(length))
00114       for val1 in self.replan:
00115         buff.write(_struct_B.pack(val1.type))
00116       _x = self
00117       buff.write(_struct_3I.pack(_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs))
00118       _x = self.trajectory.header.frame_id
00119       length = len(_x)
00120       if python3 or type(_x) == unicode:
00121         _x = _x.encode('utf-8')
00122         length = len(_x)
00123       buff.write(struct.pack('<I%ss'%length, length, _x))
00124       length = len(self.trajectory.joint_names)
00125       buff.write(_struct_I.pack(length))
00126       for val1 in self.trajectory.joint_names:
00127         length = len(val1)
00128         if python3 or type(val1) == unicode:
00129           val1 = val1.encode('utf-8')
00130           length = len(val1)
00131         buff.write(struct.pack('<I%ss'%length, length, val1))
00132       length = len(self.trajectory.points)
00133       buff.write(_struct_I.pack(length))
00134       for val1 in self.trajectory.points:
00135         length = len(val1.positions)
00136         buff.write(_struct_I.pack(length))
00137         pattern = '<%sd'%length
00138         buff.write(struct.pack(pattern, *val1.positions))
00139         length = len(val1.velocities)
00140         buff.write(_struct_I.pack(length))
00141         pattern = '<%sd'%length
00142         buff.write(struct.pack(pattern, *val1.velocities))
00143         length = len(val1.accelerations)
00144         buff.write(_struct_I.pack(length))
00145         pattern = '<%sd'%length
00146         buff.write(struct.pack(pattern, *val1.accelerations))
00147         _v1 = val1.time_from_start
00148         _x = _v1
00149         buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00150     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00151     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00152 
00153   def deserialize(self, str):
00154     """
00155     unpack serialized message in str into this message instance
00156     :param str: byte array of serialized message, ``str``
00157     """
00158     try:
00159       if self.header is None:
00160         self.header = std_msgs.msg.Header()
00161       if self.replan is None:
00162         self.replan = None
00163       if self.trajectory is None:
00164         self.trajectory = trajectory_msgs.msg.JointTrajectory()
00165       end = 0
00166       _x = self
00167       start = end
00168       end += 12
00169       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00170       start = end
00171       end += 4
00172       (length,) = _struct_I.unpack(str[start:end])
00173       start = end
00174       end += length
00175       if python3:
00176         self.header.frame_id = str[start:end].decode('utf-8')
00177       else:
00178         self.header.frame_id = str[start:end]
00179       start = end
00180       end += 4
00181       (length,) = _struct_I.unpack(str[start:end])
00182       self.replan = []
00183       for i in range(0, length):
00184         val1 = nasa_r2_common_msgs.msg.ReplanType()
00185         start = end
00186         end += 1
00187         (val1.type,) = _struct_B.unpack(str[start:end])
00188         self.replan.append(val1)
00189       _x = self
00190       start = end
00191       end += 12
00192       (_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00193       start = end
00194       end += 4
00195       (length,) = _struct_I.unpack(str[start:end])
00196       start = end
00197       end += length
00198       if python3:
00199         self.trajectory.header.frame_id = str[start:end].decode('utf-8')
00200       else:
00201         self.trajectory.header.frame_id = str[start:end]
00202       start = end
00203       end += 4
00204       (length,) = _struct_I.unpack(str[start:end])
00205       self.trajectory.joint_names = []
00206       for i in range(0, length):
00207         start = end
00208         end += 4
00209         (length,) = _struct_I.unpack(str[start:end])
00210         start = end
00211         end += length
00212         if python3:
00213           val1 = str[start:end].decode('utf-8')
00214         else:
00215           val1 = str[start:end]
00216         self.trajectory.joint_names.append(val1)
00217       start = end
00218       end += 4
00219       (length,) = _struct_I.unpack(str[start:end])
00220       self.trajectory.points = []
00221       for i in range(0, length):
00222         val1 = trajectory_msgs.msg.JointTrajectoryPoint()
00223         start = end
00224         end += 4
00225         (length,) = _struct_I.unpack(str[start:end])
00226         pattern = '<%sd'%length
00227         start = end
00228         end += struct.calcsize(pattern)
00229         val1.positions = struct.unpack(pattern, str[start:end])
00230         start = end
00231         end += 4
00232         (length,) = _struct_I.unpack(str[start:end])
00233         pattern = '<%sd'%length
00234         start = end
00235         end += struct.calcsize(pattern)
00236         val1.velocities = struct.unpack(pattern, str[start:end])
00237         start = end
00238         end += 4
00239         (length,) = _struct_I.unpack(str[start:end])
00240         pattern = '<%sd'%length
00241         start = end
00242         end += struct.calcsize(pattern)
00243         val1.accelerations = struct.unpack(pattern, str[start:end])
00244         _v2 = val1.time_from_start
00245         _x = _v2
00246         start = end
00247         end += 8
00248         (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00249         self.trajectory.points.append(val1)
00250       return self
00251     except struct.error as e:
00252       raise genpy.DeserializationError(e) #most likely buffer underfill
00253 
00254 
00255   def serialize_numpy(self, buff, numpy):
00256     """
00257     serialize message with numpy array types into buffer
00258     :param buff: buffer, ``StringIO``
00259     :param numpy: numpy python module
00260     """
00261     try:
00262       _x = self
00263       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00264       _x = self.header.frame_id
00265       length = len(_x)
00266       if python3 or type(_x) == unicode:
00267         _x = _x.encode('utf-8')
00268         length = len(_x)
00269       buff.write(struct.pack('<I%ss'%length, length, _x))
00270       length = len(self.replan)
00271       buff.write(_struct_I.pack(length))
00272       for val1 in self.replan:
00273         buff.write(_struct_B.pack(val1.type))
00274       _x = self
00275       buff.write(_struct_3I.pack(_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs))
00276       _x = self.trajectory.header.frame_id
00277       length = len(_x)
00278       if python3 or type(_x) == unicode:
00279         _x = _x.encode('utf-8')
00280         length = len(_x)
00281       buff.write(struct.pack('<I%ss'%length, length, _x))
00282       length = len(self.trajectory.joint_names)
00283       buff.write(_struct_I.pack(length))
00284       for val1 in self.trajectory.joint_names:
00285         length = len(val1)
00286         if python3 or type(val1) == unicode:
00287           val1 = val1.encode('utf-8')
00288           length = len(val1)
00289         buff.write(struct.pack('<I%ss'%length, length, val1))
00290       length = len(self.trajectory.points)
00291       buff.write(_struct_I.pack(length))
00292       for val1 in self.trajectory.points:
00293         length = len(val1.positions)
00294         buff.write(_struct_I.pack(length))
00295         pattern = '<%sd'%length
00296         buff.write(val1.positions.tostring())
00297         length = len(val1.velocities)
00298         buff.write(_struct_I.pack(length))
00299         pattern = '<%sd'%length
00300         buff.write(val1.velocities.tostring())
00301         length = len(val1.accelerations)
00302         buff.write(_struct_I.pack(length))
00303         pattern = '<%sd'%length
00304         buff.write(val1.accelerations.tostring())
00305         _v3 = val1.time_from_start
00306         _x = _v3
00307         buff.write(_struct_2i.pack(_x.secs, _x.nsecs))
00308     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00309     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00310 
00311   def deserialize_numpy(self, str, numpy):
00312     """
00313     unpack serialized message in str into this message instance using numpy for array types
00314     :param str: byte array of serialized message, ``str``
00315     :param numpy: numpy python module
00316     """
00317     try:
00318       if self.header is None:
00319         self.header = std_msgs.msg.Header()
00320       if self.replan is None:
00321         self.replan = None
00322       if self.trajectory is None:
00323         self.trajectory = trajectory_msgs.msg.JointTrajectory()
00324       end = 0
00325       _x = self
00326       start = end
00327       end += 12
00328       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00329       start = end
00330       end += 4
00331       (length,) = _struct_I.unpack(str[start:end])
00332       start = end
00333       end += length
00334       if python3:
00335         self.header.frame_id = str[start:end].decode('utf-8')
00336       else:
00337         self.header.frame_id = str[start:end]
00338       start = end
00339       end += 4
00340       (length,) = _struct_I.unpack(str[start:end])
00341       self.replan = []
00342       for i in range(0, length):
00343         val1 = nasa_r2_common_msgs.msg.ReplanType()
00344         start = end
00345         end += 1
00346         (val1.type,) = _struct_B.unpack(str[start:end])
00347         self.replan.append(val1)
00348       _x = self
00349       start = end
00350       end += 12
00351       (_x.trajectory.header.seq, _x.trajectory.header.stamp.secs, _x.trajectory.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00352       start = end
00353       end += 4
00354       (length,) = _struct_I.unpack(str[start:end])
00355       start = end
00356       end += length
00357       if python3:
00358         self.trajectory.header.frame_id = str[start:end].decode('utf-8')
00359       else:
00360         self.trajectory.header.frame_id = str[start:end]
00361       start = end
00362       end += 4
00363       (length,) = _struct_I.unpack(str[start:end])
00364       self.trajectory.joint_names = []
00365       for i in range(0, length):
00366         start = end
00367         end += 4
00368         (length,) = _struct_I.unpack(str[start:end])
00369         start = end
00370         end += length
00371         if python3:
00372           val1 = str[start:end].decode('utf-8')
00373         else:
00374           val1 = str[start:end]
00375         self.trajectory.joint_names.append(val1)
00376       start = end
00377       end += 4
00378       (length,) = _struct_I.unpack(str[start:end])
00379       self.trajectory.points = []
00380       for i in range(0, length):
00381         val1 = trajectory_msgs.msg.JointTrajectoryPoint()
00382         start = end
00383         end += 4
00384         (length,) = _struct_I.unpack(str[start:end])
00385         pattern = '<%sd'%length
00386         start = end
00387         end += struct.calcsize(pattern)
00388         val1.positions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00389         start = end
00390         end += 4
00391         (length,) = _struct_I.unpack(str[start:end])
00392         pattern = '<%sd'%length
00393         start = end
00394         end += struct.calcsize(pattern)
00395         val1.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00396         start = end
00397         end += 4
00398         (length,) = _struct_I.unpack(str[start:end])
00399         pattern = '<%sd'%length
00400         start = end
00401         end += struct.calcsize(pattern)
00402         val1.accelerations = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00403         _v4 = val1.time_from_start
00404         _x = _v4
00405         start = end
00406         end += 8
00407         (_x.secs, _x.nsecs,) = _struct_2i.unpack(str[start:end])
00408         self.trajectory.points.append(val1)
00409       return self
00410     except struct.error as e:
00411       raise genpy.DeserializationError(e) #most likely buffer underfill
00412 
00413 _struct_I = genpy.struct_I
00414 _struct_3I = struct.Struct("<3I")
00415 _struct_B = struct.Struct("<B")
00416 _struct_2i = struct.Struct("<2i")


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34