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


arm_navigation_msgs
Author(s): Gil Jones
autogenerated on Mon Dec 2 2013 12:31:50