_PositionConstraint.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm_navigation_msgs/PositionConstraint.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 arm_navigation_msgs.msg
00008 import geometry_msgs.msg
00009 import std_msgs.msg
00010 
00011 class PositionConstraint(genpy.Message):
00012   _md5sum = "7e3d9697e64b346b9d3cb7311bb88ccb"
00013   _type = "arm_navigation_msgs/PositionConstraint"
00014   _has_header = True #flag to mark the presence of a Header object
00015   _full_text = """# This message contains the definition of a position constraint.
00016 Header header
00017 
00018 # The robot link this constraint refers to
00019 string link_name
00020 
00021 # The offset (in the link frame) for the target point on the link we are planning for
00022 geometry_msgs/Point target_point_offset
00023 
00024 # The nominal/target position for the point we are planning for
00025 geometry_msgs/Point position
00026 
00027 # The shape of the bounded region that constrains the position of the end-effector
00028 # This region is always centered at the position defined above
00029 arm_navigation_msgs/Shape constraint_region_shape
00030 
00031 # The orientation of the bounded region that constrains the position of the end-effector. 
00032 # This allows the specification of non-axis aligned constraints
00033 geometry_msgs/Quaternion constraint_region_orientation
00034 
00035 # Constraint weighting factor - a weight for this constraint
00036 float64 weight
00037 
00038 ================================================================================
00039 MSG: std_msgs/Header
00040 # Standard metadata for higher-level stamped data types.
00041 # This is generally used to communicate timestamped data 
00042 # in a particular coordinate frame.
00043 # 
00044 # sequence ID: consecutively increasing ID 
00045 uint32 seq
00046 #Two-integer timestamp that is expressed as:
00047 # * stamp.secs: seconds (stamp_secs) since epoch
00048 # * stamp.nsecs: nanoseconds since stamp_secs
00049 # time-handling sugar is provided by the client library
00050 time stamp
00051 #Frame this data is associated with
00052 # 0: no frame
00053 # 1: global frame
00054 string frame_id
00055 
00056 ================================================================================
00057 MSG: geometry_msgs/Point
00058 # This contains the position of a point in free space
00059 float64 x
00060 float64 y
00061 float64 z
00062 
00063 ================================================================================
00064 MSG: arm_navigation_msgs/Shape
00065 byte SPHERE=0
00066 byte BOX=1
00067 byte CYLINDER=2
00068 byte MESH=3
00069 
00070 byte type
00071 
00072 
00073 #### define sphere, box, cylinder ####
00074 # the origin of each shape is considered at the shape's center
00075 
00076 # for sphere
00077 # radius := dimensions[0]
00078 
00079 # for cylinder
00080 # radius := dimensions[0]
00081 # length := dimensions[1]
00082 # the length is along the Z axis
00083 
00084 # for box
00085 # size_x := dimensions[0]
00086 # size_y := dimensions[1]
00087 # size_z := dimensions[2]
00088 float64[] dimensions
00089 
00090 
00091 #### define mesh ####
00092 
00093 # list of triangles; triangle k is defined by tre vertices located
00094 # at indices triangles[3k], triangles[3k+1], triangles[3k+2]
00095 int32[] triangles
00096 geometry_msgs/Point[] vertices
00097 
00098 ================================================================================
00099 MSG: geometry_msgs/Quaternion
00100 # This represents an orientation in free space in quaternion form.
00101 
00102 float64 x
00103 float64 y
00104 float64 z
00105 float64 w
00106 
00107 """
00108   __slots__ = ['header','link_name','target_point_offset','position','constraint_region_shape','constraint_region_orientation','weight']
00109   _slot_types = ['std_msgs/Header','string','geometry_msgs/Point','geometry_msgs/Point','arm_navigation_msgs/Shape','geometry_msgs/Quaternion','float64']
00110 
00111   def __init__(self, *args, **kwds):
00112     """
00113     Constructor. Any message fields that are implicitly/explicitly
00114     set to None will be assigned a default value. The recommend
00115     use is keyword arguments as this is more robust to future message
00116     changes.  You cannot mix in-order arguments and keyword arguments.
00117 
00118     The available fields are:
00119        header,link_name,target_point_offset,position,constraint_region_shape,constraint_region_orientation,weight
00120 
00121     :param args: complete set of field values, in .msg order
00122     :param kwds: use keyword arguments corresponding to message field names
00123     to set specific fields.
00124     """
00125     if args or kwds:
00126       super(PositionConstraint, self).__init__(*args, **kwds)
00127       #message fields cannot be None, assign default values for those that are
00128       if self.header is None:
00129         self.header = std_msgs.msg.Header()
00130       if self.link_name is None:
00131         self.link_name = ''
00132       if self.target_point_offset is None:
00133         self.target_point_offset = geometry_msgs.msg.Point()
00134       if self.position is None:
00135         self.position = geometry_msgs.msg.Point()
00136       if self.constraint_region_shape is None:
00137         self.constraint_region_shape = arm_navigation_msgs.msg.Shape()
00138       if self.constraint_region_orientation is None:
00139         self.constraint_region_orientation = geometry_msgs.msg.Quaternion()
00140       if self.weight is None:
00141         self.weight = 0.
00142     else:
00143       self.header = std_msgs.msg.Header()
00144       self.link_name = ''
00145       self.target_point_offset = geometry_msgs.msg.Point()
00146       self.position = geometry_msgs.msg.Point()
00147       self.constraint_region_shape = arm_navigation_msgs.msg.Shape()
00148       self.constraint_region_orientation = geometry_msgs.msg.Quaternion()
00149       self.weight = 0.
00150 
00151   def _get_types(self):
00152     """
00153     internal API method
00154     """
00155     return self._slot_types
00156 
00157   def serialize(self, buff):
00158     """
00159     serialize message into buffer
00160     :param buff: buffer, ``StringIO``
00161     """
00162     try:
00163       _x = self
00164       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00165       _x = self.header.frame_id
00166       length = len(_x)
00167       if python3 or type(_x) == unicode:
00168         _x = _x.encode('utf-8')
00169         length = len(_x)
00170       buff.write(struct.pack('<I%ss'%length, length, _x))
00171       _x = self.link_name
00172       length = len(_x)
00173       if python3 or type(_x) == unicode:
00174         _x = _x.encode('utf-8')
00175         length = len(_x)
00176       buff.write(struct.pack('<I%ss'%length, length, _x))
00177       _x = self
00178       buff.write(_struct_6db.pack(_x.target_point_offset.x, _x.target_point_offset.y, _x.target_point_offset.z, _x.position.x, _x.position.y, _x.position.z, _x.constraint_region_shape.type))
00179       length = len(self.constraint_region_shape.dimensions)
00180       buff.write(_struct_I.pack(length))
00181       pattern = '<%sd'%length
00182       buff.write(struct.pack(pattern, *self.constraint_region_shape.dimensions))
00183       length = len(self.constraint_region_shape.triangles)
00184       buff.write(_struct_I.pack(length))
00185       pattern = '<%si'%length
00186       buff.write(struct.pack(pattern, *self.constraint_region_shape.triangles))
00187       length = len(self.constraint_region_shape.vertices)
00188       buff.write(_struct_I.pack(length))
00189       for val1 in self.constraint_region_shape.vertices:
00190         _x = val1
00191         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00192       _x = self
00193       buff.write(_struct_5d.pack(_x.constraint_region_orientation.x, _x.constraint_region_orientation.y, _x.constraint_region_orientation.z, _x.constraint_region_orientation.w, _x.weight))
00194     except struct.error as se: self._check_types(se)
00195     except TypeError as te: self._check_types(te)
00196 
00197   def deserialize(self, str):
00198     """
00199     unpack serialized message in str into this message instance
00200     :param str: byte array of serialized message, ``str``
00201     """
00202     try:
00203       if self.header is None:
00204         self.header = std_msgs.msg.Header()
00205       if self.target_point_offset is None:
00206         self.target_point_offset = geometry_msgs.msg.Point()
00207       if self.position is None:
00208         self.position = geometry_msgs.msg.Point()
00209       if self.constraint_region_shape is None:
00210         self.constraint_region_shape = arm_navigation_msgs.msg.Shape()
00211       if self.constraint_region_orientation is None:
00212         self.constraint_region_orientation = geometry_msgs.msg.Quaternion()
00213       end = 0
00214       _x = self
00215       start = end
00216       end += 12
00217       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00218       start = end
00219       end += 4
00220       (length,) = _struct_I.unpack(str[start:end])
00221       start = end
00222       end += length
00223       if python3:
00224         self.header.frame_id = str[start:end].decode('utf-8')
00225       else:
00226         self.header.frame_id = str[start:end]
00227       start = end
00228       end += 4
00229       (length,) = _struct_I.unpack(str[start:end])
00230       start = end
00231       end += length
00232       if python3:
00233         self.link_name = str[start:end].decode('utf-8')
00234       else:
00235         self.link_name = str[start:end]
00236       _x = self
00237       start = end
00238       end += 49
00239       (_x.target_point_offset.x, _x.target_point_offset.y, _x.target_point_offset.z, _x.position.x, _x.position.y, _x.position.z, _x.constraint_region_shape.type,) = _struct_6db.unpack(str[start:end])
00240       start = end
00241       end += 4
00242       (length,) = _struct_I.unpack(str[start:end])
00243       pattern = '<%sd'%length
00244       start = end
00245       end += struct.calcsize(pattern)
00246       self.constraint_region_shape.dimensions = struct.unpack(pattern, str[start:end])
00247       start = end
00248       end += 4
00249       (length,) = _struct_I.unpack(str[start:end])
00250       pattern = '<%si'%length
00251       start = end
00252       end += struct.calcsize(pattern)
00253       self.constraint_region_shape.triangles = struct.unpack(pattern, str[start:end])
00254       start = end
00255       end += 4
00256       (length,) = _struct_I.unpack(str[start:end])
00257       self.constraint_region_shape.vertices = []
00258       for i in range(0, length):
00259         val1 = geometry_msgs.msg.Point()
00260         _x = val1
00261         start = end
00262         end += 24
00263         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00264         self.constraint_region_shape.vertices.append(val1)
00265       _x = self
00266       start = end
00267       end += 40
00268       (_x.constraint_region_orientation.x, _x.constraint_region_orientation.y, _x.constraint_region_orientation.z, _x.constraint_region_orientation.w, _x.weight,) = _struct_5d.unpack(str[start:end])
00269       return self
00270     except struct.error as e:
00271       raise genpy.DeserializationError(e) #most likely buffer underfill
00272 
00273 
00274   def serialize_numpy(self, buff, numpy):
00275     """
00276     serialize message with numpy array types into buffer
00277     :param buff: buffer, ``StringIO``
00278     :param numpy: numpy python module
00279     """
00280     try:
00281       _x = self
00282       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00283       _x = self.header.frame_id
00284       length = len(_x)
00285       if python3 or type(_x) == unicode:
00286         _x = _x.encode('utf-8')
00287         length = len(_x)
00288       buff.write(struct.pack('<I%ss'%length, length, _x))
00289       _x = self.link_name
00290       length = len(_x)
00291       if python3 or type(_x) == unicode:
00292         _x = _x.encode('utf-8')
00293         length = len(_x)
00294       buff.write(struct.pack('<I%ss'%length, length, _x))
00295       _x = self
00296       buff.write(_struct_6db.pack(_x.target_point_offset.x, _x.target_point_offset.y, _x.target_point_offset.z, _x.position.x, _x.position.y, _x.position.z, _x.constraint_region_shape.type))
00297       length = len(self.constraint_region_shape.dimensions)
00298       buff.write(_struct_I.pack(length))
00299       pattern = '<%sd'%length
00300       buff.write(self.constraint_region_shape.dimensions.tostring())
00301       length = len(self.constraint_region_shape.triangles)
00302       buff.write(_struct_I.pack(length))
00303       pattern = '<%si'%length
00304       buff.write(self.constraint_region_shape.triangles.tostring())
00305       length = len(self.constraint_region_shape.vertices)
00306       buff.write(_struct_I.pack(length))
00307       for val1 in self.constraint_region_shape.vertices:
00308         _x = val1
00309         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00310       _x = self
00311       buff.write(_struct_5d.pack(_x.constraint_region_orientation.x, _x.constraint_region_orientation.y, _x.constraint_region_orientation.z, _x.constraint_region_orientation.w, _x.weight))
00312     except struct.error as se: self._check_types(se)
00313     except TypeError as te: self._check_types(te)
00314 
00315   def deserialize_numpy(self, str, numpy):
00316     """
00317     unpack serialized message in str into this message instance using numpy for array types
00318     :param str: byte array of serialized message, ``str``
00319     :param numpy: numpy python module
00320     """
00321     try:
00322       if self.header is None:
00323         self.header = std_msgs.msg.Header()
00324       if self.target_point_offset is None:
00325         self.target_point_offset = geometry_msgs.msg.Point()
00326       if self.position is None:
00327         self.position = geometry_msgs.msg.Point()
00328       if self.constraint_region_shape is None:
00329         self.constraint_region_shape = arm_navigation_msgs.msg.Shape()
00330       if self.constraint_region_orientation is None:
00331         self.constraint_region_orientation = geometry_msgs.msg.Quaternion()
00332       end = 0
00333       _x = self
00334       start = end
00335       end += 12
00336       (_x.header.seq, _x.header.stamp.secs, _x.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.header.frame_id = str[start:end].decode('utf-8')
00344       else:
00345         self.header.frame_id = str[start:end]
00346       start = end
00347       end += 4
00348       (length,) = _struct_I.unpack(str[start:end])
00349       start = end
00350       end += length
00351       if python3:
00352         self.link_name = str[start:end].decode('utf-8')
00353       else:
00354         self.link_name = str[start:end]
00355       _x = self
00356       start = end
00357       end += 49
00358       (_x.target_point_offset.x, _x.target_point_offset.y, _x.target_point_offset.z, _x.position.x, _x.position.y, _x.position.z, _x.constraint_region_shape.type,) = _struct_6db.unpack(str[start:end])
00359       start = end
00360       end += 4
00361       (length,) = _struct_I.unpack(str[start:end])
00362       pattern = '<%sd'%length
00363       start = end
00364       end += struct.calcsize(pattern)
00365       self.constraint_region_shape.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00366       start = end
00367       end += 4
00368       (length,) = _struct_I.unpack(str[start:end])
00369       pattern = '<%si'%length
00370       start = end
00371       end += struct.calcsize(pattern)
00372       self.constraint_region_shape.triangles = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00373       start = end
00374       end += 4
00375       (length,) = _struct_I.unpack(str[start:end])
00376       self.constraint_region_shape.vertices = []
00377       for i in range(0, length):
00378         val1 = geometry_msgs.msg.Point()
00379         _x = val1
00380         start = end
00381         end += 24
00382         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00383         self.constraint_region_shape.vertices.append(val1)
00384       _x = self
00385       start = end
00386       end += 40
00387       (_x.constraint_region_orientation.x, _x.constraint_region_orientation.y, _x.constraint_region_orientation.z, _x.constraint_region_orientation.w, _x.weight,) = _struct_5d.unpack(str[start:end])
00388       return self
00389     except struct.error as e:
00390       raise genpy.DeserializationError(e) #most likely buffer underfill
00391 
00392 _struct_I = genpy.struct_I
00393 _struct_5d = struct.Struct("<5d")
00394 _struct_3I = struct.Struct("<3I")
00395 _struct_6db = struct.Struct("<6db")
00396 _struct_3d = struct.Struct("<3d")


arm_navigation_msgs
Author(s): Gil Jones
autogenerated on Thu Dec 12 2013 11:08:10