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


openrave_msgs
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 14:07:55