_cop_get_object_shape.py
Go to the documentation of this file.
00001 """autogenerated by genpy from vision_srvs/cop_get_object_shapeRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class cop_get_object_shapeRequest(genpy.Message):
00009   _md5sum = "039cdc2e4e021929b349f87d86d0ea70"
00010   _type = "vision_srvs/cop_get_object_shapeRequest"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """
00013 
00014 uint64 object_id
00015 
00016 """
00017   __slots__ = ['object_id']
00018   _slot_types = ['uint64']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        object_id
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(cop_get_object_shapeRequest, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.object_id is None:
00038         self.object_id = 0
00039     else:
00040       self.object_id = 0
00041 
00042   def _get_types(self):
00043     """
00044     internal API method
00045     """
00046     return self._slot_types
00047 
00048   def serialize(self, buff):
00049     """
00050     serialize message into buffer
00051     :param buff: buffer, ``StringIO``
00052     """
00053     try:
00054       buff.write(_struct_Q.pack(self.object_id))
00055     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00056     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00057 
00058   def deserialize(self, str):
00059     """
00060     unpack serialized message in str into this message instance
00061     :param str: byte array of serialized message, ``str``
00062     """
00063     try:
00064       end = 0
00065       start = end
00066       end += 8
00067       (self.object_id,) = _struct_Q.unpack(str[start:end])
00068       return self
00069     except struct.error as e:
00070       raise genpy.DeserializationError(e) #most likely buffer underfill
00071 
00072 
00073   def serialize_numpy(self, buff, numpy):
00074     """
00075     serialize message with numpy array types into buffer
00076     :param buff: buffer, ``StringIO``
00077     :param numpy: numpy python module
00078     """
00079     try:
00080       buff.write(_struct_Q.pack(self.object_id))
00081     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00082     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00083 
00084   def deserialize_numpy(self, str, numpy):
00085     """
00086     unpack serialized message in str into this message instance using numpy for array types
00087     :param str: byte array of serialized message, ``str``
00088     :param numpy: numpy python module
00089     """
00090     try:
00091       end = 0
00092       start = end
00093       end += 8
00094       (self.object_id,) = _struct_Q.unpack(str[start:end])
00095       return self
00096     except struct.error as e:
00097       raise genpy.DeserializationError(e) #most likely buffer underfill
00098 
00099 _struct_I = genpy.struct_I
00100 _struct_Q = struct.Struct("<Q")
00101 """autogenerated by genpy from vision_srvs/cop_get_object_shapeResponse.msg. Do not edit."""
00102 import sys
00103 python3 = True if sys.hexversion > 0x03000000 else False
00104 import genpy
00105 import struct
00106 
00107 import arm_navigation_msgs.msg
00108 import geometry_msgs.msg
00109 
00110 class cop_get_object_shapeResponse(genpy.Message):
00111   _md5sum = "54b403d09f468fc327f67c2993792640"
00112   _type = "vision_srvs/cop_get_object_shapeResponse"
00113   _has_header = False #flag to mark the presence of a Header object
00114   _full_text = """arm_navigation_msgs/Shape shape
00115 
00116 
00117 ================================================================================
00118 MSG: arm_navigation_msgs/Shape
00119 byte SPHERE=0
00120 byte BOX=1
00121 byte CYLINDER=2
00122 byte MESH=3
00123 
00124 byte type
00125 
00126 
00127 #### define sphere, box, cylinder ####
00128 # the origin of each shape is considered at the shape's center
00129 
00130 # for sphere
00131 # radius := dimensions[0]
00132 
00133 # for cylinder
00134 # radius := dimensions[0]
00135 # length := dimensions[1]
00136 # the length is along the Z axis
00137 
00138 # for box
00139 # size_x := dimensions[0]
00140 # size_y := dimensions[1]
00141 # size_z := dimensions[2]
00142 float64[] dimensions
00143 
00144 
00145 #### define mesh ####
00146 
00147 # list of triangles; triangle k is defined by tre vertices located
00148 # at indices triangles[3k], triangles[3k+1], triangles[3k+2]
00149 int32[] triangles
00150 geometry_msgs/Point[] vertices
00151 
00152 ================================================================================
00153 MSG: geometry_msgs/Point
00154 # This contains the position of a point in free space
00155 float64 x
00156 float64 y
00157 float64 z
00158 
00159 """
00160   __slots__ = ['shape']
00161   _slot_types = ['arm_navigation_msgs/Shape']
00162 
00163   def __init__(self, *args, **kwds):
00164     """
00165     Constructor. Any message fields that are implicitly/explicitly
00166     set to None will be assigned a default value. The recommend
00167     use is keyword arguments as this is more robust to future message
00168     changes.  You cannot mix in-order arguments and keyword arguments.
00169 
00170     The available fields are:
00171        shape
00172 
00173     :param args: complete set of field values, in .msg order
00174     :param kwds: use keyword arguments corresponding to message field names
00175     to set specific fields.
00176     """
00177     if args or kwds:
00178       super(cop_get_object_shapeResponse, self).__init__(*args, **kwds)
00179       #message fields cannot be None, assign default values for those that are
00180       if self.shape is None:
00181         self.shape = arm_navigation_msgs.msg.Shape()
00182     else:
00183       self.shape = arm_navigation_msgs.msg.Shape()
00184 
00185   def _get_types(self):
00186     """
00187     internal API method
00188     """
00189     return self._slot_types
00190 
00191   def serialize(self, buff):
00192     """
00193     serialize message into buffer
00194     :param buff: buffer, ``StringIO``
00195     """
00196     try:
00197       buff.write(_struct_b.pack(self.shape.type))
00198       length = len(self.shape.dimensions)
00199       buff.write(_struct_I.pack(length))
00200       pattern = '<%sd'%length
00201       buff.write(struct.pack(pattern, *self.shape.dimensions))
00202       length = len(self.shape.triangles)
00203       buff.write(_struct_I.pack(length))
00204       pattern = '<%si'%length
00205       buff.write(struct.pack(pattern, *self.shape.triangles))
00206       length = len(self.shape.vertices)
00207       buff.write(_struct_I.pack(length))
00208       for val1 in self.shape.vertices:
00209         _x = val1
00210         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00211     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00212     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00213 
00214   def deserialize(self, str):
00215     """
00216     unpack serialized message in str into this message instance
00217     :param str: byte array of serialized message, ``str``
00218     """
00219     try:
00220       if self.shape is None:
00221         self.shape = arm_navigation_msgs.msg.Shape()
00222       end = 0
00223       start = end
00224       end += 1
00225       (self.shape.type,) = _struct_b.unpack(str[start:end])
00226       start = end
00227       end += 4
00228       (length,) = _struct_I.unpack(str[start:end])
00229       pattern = '<%sd'%length
00230       start = end
00231       end += struct.calcsize(pattern)
00232       self.shape.dimensions = struct.unpack(pattern, str[start:end])
00233       start = end
00234       end += 4
00235       (length,) = _struct_I.unpack(str[start:end])
00236       pattern = '<%si'%length
00237       start = end
00238       end += struct.calcsize(pattern)
00239       self.shape.triangles = struct.unpack(pattern, str[start:end])
00240       start = end
00241       end += 4
00242       (length,) = _struct_I.unpack(str[start:end])
00243       self.shape.vertices = []
00244       for i in range(0, length):
00245         val1 = geometry_msgs.msg.Point()
00246         _x = val1
00247         start = end
00248         end += 24
00249         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00250         self.shape.vertices.append(val1)
00251       return self
00252     except struct.error as e:
00253       raise genpy.DeserializationError(e) #most likely buffer underfill
00254 
00255 
00256   def serialize_numpy(self, buff, numpy):
00257     """
00258     serialize message with numpy array types into buffer
00259     :param buff: buffer, ``StringIO``
00260     :param numpy: numpy python module
00261     """
00262     try:
00263       buff.write(_struct_b.pack(self.shape.type))
00264       length = len(self.shape.dimensions)
00265       buff.write(_struct_I.pack(length))
00266       pattern = '<%sd'%length
00267       buff.write(self.shape.dimensions.tostring())
00268       length = len(self.shape.triangles)
00269       buff.write(_struct_I.pack(length))
00270       pattern = '<%si'%length
00271       buff.write(self.shape.triangles.tostring())
00272       length = len(self.shape.vertices)
00273       buff.write(_struct_I.pack(length))
00274       for val1 in self.shape.vertices:
00275         _x = val1
00276         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00277     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00278     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00279 
00280   def deserialize_numpy(self, str, numpy):
00281     """
00282     unpack serialized message in str into this message instance using numpy for array types
00283     :param str: byte array of serialized message, ``str``
00284     :param numpy: numpy python module
00285     """
00286     try:
00287       if self.shape is None:
00288         self.shape = arm_navigation_msgs.msg.Shape()
00289       end = 0
00290       start = end
00291       end += 1
00292       (self.shape.type,) = _struct_b.unpack(str[start:end])
00293       start = end
00294       end += 4
00295       (length,) = _struct_I.unpack(str[start:end])
00296       pattern = '<%sd'%length
00297       start = end
00298       end += struct.calcsize(pattern)
00299       self.shape.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00300       start = end
00301       end += 4
00302       (length,) = _struct_I.unpack(str[start:end])
00303       pattern = '<%si'%length
00304       start = end
00305       end += struct.calcsize(pattern)
00306       self.shape.triangles = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00307       start = end
00308       end += 4
00309       (length,) = _struct_I.unpack(str[start:end])
00310       self.shape.vertices = []
00311       for i in range(0, length):
00312         val1 = geometry_msgs.msg.Point()
00313         _x = val1
00314         start = end
00315         end += 24
00316         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00317         self.shape.vertices.append(val1)
00318       return self
00319     except struct.error as e:
00320       raise genpy.DeserializationError(e) #most likely buffer underfill
00321 
00322 _struct_I = genpy.struct_I
00323 _struct_b = struct.Struct("<b")
00324 _struct_3d = struct.Struct("<3d")
00325 class cop_get_object_shape(object):
00326   _type          = 'vision_srvs/cop_get_object_shape'
00327   _md5sum = '132d121b47840325dd1e8dd0ce3c372d'
00328   _request_class  = cop_get_object_shapeRequest
00329   _response_class = cop_get_object_shapeResponse


vision_srvs
Author(s): Ulrich F Klank
autogenerated on Mon Oct 6 2014 00:48:11