_Grasp.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_msgs/Grasp.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 geometry_msgs.msg
00008 import srs_msgs.msg
00009 import std_msgs.msg
00010 
00011 class Grasp(genpy.Message):
00012   _md5sum = "b4ba413db436f6f49754dff4bc4a1739"
00013   _type = "srs_msgs/Grasp"
00014   _has_header = False #flag to mark the presence of a Header object
00015   _full_text = """srs_msgs/DBGrasp[] grasp_configuration
00016 
00017 ================================================================================
00018 MSG: srs_msgs/DBGrasp
00019 int32 object_id
00020 string hand_type
00021 float64[] sdh_joint_values
00022 geometry_msgs/PoseStamped pre_grasp
00023 geometry_msgs/PoseStamped grasp
00024 string category
00025 
00026 ================================================================================
00027 MSG: geometry_msgs/PoseStamped
00028 # A Pose with reference coordinate frame and timestamp
00029 Header header
00030 Pose pose
00031 
00032 ================================================================================
00033 MSG: std_msgs/Header
00034 # Standard metadata for higher-level stamped data types.
00035 # This is generally used to communicate timestamped data 
00036 # in a particular coordinate frame.
00037 # 
00038 # sequence ID: consecutively increasing ID 
00039 uint32 seq
00040 #Two-integer timestamp that is expressed as:
00041 # * stamp.secs: seconds (stamp_secs) since epoch
00042 # * stamp.nsecs: nanoseconds since stamp_secs
00043 # time-handling sugar is provided by the client library
00044 time stamp
00045 #Frame this data is associated with
00046 # 0: no frame
00047 # 1: global frame
00048 string frame_id
00049 
00050 ================================================================================
00051 MSG: geometry_msgs/Pose
00052 # A representation of pose in free space, composed of postion and orientation. 
00053 Point position
00054 Quaternion orientation
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: geometry_msgs/Quaternion
00065 # This represents an orientation in free space in quaternion form.
00066 
00067 float64 x
00068 float64 y
00069 float64 z
00070 float64 w
00071 
00072 """
00073   __slots__ = ['grasp_configuration']
00074   _slot_types = ['srs_msgs/DBGrasp[]']
00075 
00076   def __init__(self, *args, **kwds):
00077     """
00078     Constructor. Any message fields that are implicitly/explicitly
00079     set to None will be assigned a default value. The recommend
00080     use is keyword arguments as this is more robust to future message
00081     changes.  You cannot mix in-order arguments and keyword arguments.
00082 
00083     The available fields are:
00084        grasp_configuration
00085 
00086     :param args: complete set of field values, in .msg order
00087     :param kwds: use keyword arguments corresponding to message field names
00088     to set specific fields.
00089     """
00090     if args or kwds:
00091       super(Grasp, self).__init__(*args, **kwds)
00092       #message fields cannot be None, assign default values for those that are
00093       if self.grasp_configuration is None:
00094         self.grasp_configuration = []
00095     else:
00096       self.grasp_configuration = []
00097 
00098   def _get_types(self):
00099     """
00100     internal API method
00101     """
00102     return self._slot_types
00103 
00104   def serialize(self, buff):
00105     """
00106     serialize message into buffer
00107     :param buff: buffer, ``StringIO``
00108     """
00109     try:
00110       length = len(self.grasp_configuration)
00111       buff.write(_struct_I.pack(length))
00112       for val1 in self.grasp_configuration:
00113         buff.write(_struct_i.pack(val1.object_id))
00114         _x = val1.hand_type
00115         length = len(_x)
00116         if python3 or type(_x) == unicode:
00117           _x = _x.encode('utf-8')
00118           length = len(_x)
00119         buff.write(struct.pack('<I%ss'%length, length, _x))
00120         length = len(val1.sdh_joint_values)
00121         buff.write(_struct_I.pack(length))
00122         pattern = '<%sd'%length
00123         buff.write(struct.pack(pattern, *val1.sdh_joint_values))
00124         _v1 = val1.pre_grasp
00125         _v2 = _v1.header
00126         buff.write(_struct_I.pack(_v2.seq))
00127         _v3 = _v2.stamp
00128         _x = _v3
00129         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00130         _x = _v2.frame_id
00131         length = len(_x)
00132         if python3 or type(_x) == unicode:
00133           _x = _x.encode('utf-8')
00134           length = len(_x)
00135         buff.write(struct.pack('<I%ss'%length, length, _x))
00136         _v4 = _v1.pose
00137         _v5 = _v4.position
00138         _x = _v5
00139         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00140         _v6 = _v4.orientation
00141         _x = _v6
00142         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00143         _v7 = val1.grasp
00144         _v8 = _v7.header
00145         buff.write(_struct_I.pack(_v8.seq))
00146         _v9 = _v8.stamp
00147         _x = _v9
00148         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00149         _x = _v8.frame_id
00150         length = len(_x)
00151         if python3 or type(_x) == unicode:
00152           _x = _x.encode('utf-8')
00153           length = len(_x)
00154         buff.write(struct.pack('<I%ss'%length, length, _x))
00155         _v10 = _v7.pose
00156         _v11 = _v10.position
00157         _x = _v11
00158         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00159         _v12 = _v10.orientation
00160         _x = _v12
00161         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00162         _x = val1.category
00163         length = len(_x)
00164         if python3 or type(_x) == unicode:
00165           _x = _x.encode('utf-8')
00166           length = len(_x)
00167         buff.write(struct.pack('<I%ss'%length, length, _x))
00168     except struct.error as se: self._check_types(se)
00169     except TypeError as te: self._check_types(te)
00170 
00171   def deserialize(self, str):
00172     """
00173     unpack serialized message in str into this message instance
00174     :param str: byte array of serialized message, ``str``
00175     """
00176     try:
00177       if self.grasp_configuration is None:
00178         self.grasp_configuration = None
00179       end = 0
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       self.grasp_configuration = []
00184       for i in range(0, length):
00185         val1 = srs_msgs.msg.DBGrasp()
00186         start = end
00187         end += 4
00188         (val1.object_id,) = _struct_i.unpack(str[start:end])
00189         start = end
00190         end += 4
00191         (length,) = _struct_I.unpack(str[start:end])
00192         start = end
00193         end += length
00194         if python3:
00195           val1.hand_type = str[start:end].decode('utf-8')
00196         else:
00197           val1.hand_type = str[start:end]
00198         start = end
00199         end += 4
00200         (length,) = _struct_I.unpack(str[start:end])
00201         pattern = '<%sd'%length
00202         start = end
00203         end += struct.calcsize(pattern)
00204         val1.sdh_joint_values = struct.unpack(pattern, str[start:end])
00205         _v13 = val1.pre_grasp
00206         _v14 = _v13.header
00207         start = end
00208         end += 4
00209         (_v14.seq,) = _struct_I.unpack(str[start:end])
00210         _v15 = _v14.stamp
00211         _x = _v15
00212         start = end
00213         end += 8
00214         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00215         start = end
00216         end += 4
00217         (length,) = _struct_I.unpack(str[start:end])
00218         start = end
00219         end += length
00220         if python3:
00221           _v14.frame_id = str[start:end].decode('utf-8')
00222         else:
00223           _v14.frame_id = str[start:end]
00224         _v16 = _v13.pose
00225         _v17 = _v16.position
00226         _x = _v17
00227         start = end
00228         end += 24
00229         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00230         _v18 = _v16.orientation
00231         _x = _v18
00232         start = end
00233         end += 32
00234         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00235         _v19 = val1.grasp
00236         _v20 = _v19.header
00237         start = end
00238         end += 4
00239         (_v20.seq,) = _struct_I.unpack(str[start:end])
00240         _v21 = _v20.stamp
00241         _x = _v21
00242         start = end
00243         end += 8
00244         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00245         start = end
00246         end += 4
00247         (length,) = _struct_I.unpack(str[start:end])
00248         start = end
00249         end += length
00250         if python3:
00251           _v20.frame_id = str[start:end].decode('utf-8')
00252         else:
00253           _v20.frame_id = str[start:end]
00254         _v22 = _v19.pose
00255         _v23 = _v22.position
00256         _x = _v23
00257         start = end
00258         end += 24
00259         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00260         _v24 = _v22.orientation
00261         _x = _v24
00262         start = end
00263         end += 32
00264         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00265         start = end
00266         end += 4
00267         (length,) = _struct_I.unpack(str[start:end])
00268         start = end
00269         end += length
00270         if python3:
00271           val1.category = str[start:end].decode('utf-8')
00272         else:
00273           val1.category = str[start:end]
00274         self.grasp_configuration.append(val1)
00275       return self
00276     except struct.error as e:
00277       raise genpy.DeserializationError(e) #most likely buffer underfill
00278 
00279 
00280   def serialize_numpy(self, buff, numpy):
00281     """
00282     serialize message with numpy array types into buffer
00283     :param buff: buffer, ``StringIO``
00284     :param numpy: numpy python module
00285     """
00286     try:
00287       length = len(self.grasp_configuration)
00288       buff.write(_struct_I.pack(length))
00289       for val1 in self.grasp_configuration:
00290         buff.write(_struct_i.pack(val1.object_id))
00291         _x = val1.hand_type
00292         length = len(_x)
00293         if python3 or type(_x) == unicode:
00294           _x = _x.encode('utf-8')
00295           length = len(_x)
00296         buff.write(struct.pack('<I%ss'%length, length, _x))
00297         length = len(val1.sdh_joint_values)
00298         buff.write(_struct_I.pack(length))
00299         pattern = '<%sd'%length
00300         buff.write(val1.sdh_joint_values.tostring())
00301         _v25 = val1.pre_grasp
00302         _v26 = _v25.header
00303         buff.write(_struct_I.pack(_v26.seq))
00304         _v27 = _v26.stamp
00305         _x = _v27
00306         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00307         _x = _v26.frame_id
00308         length = len(_x)
00309         if python3 or type(_x) == unicode:
00310           _x = _x.encode('utf-8')
00311           length = len(_x)
00312         buff.write(struct.pack('<I%ss'%length, length, _x))
00313         _v28 = _v25.pose
00314         _v29 = _v28.position
00315         _x = _v29
00316         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00317         _v30 = _v28.orientation
00318         _x = _v30
00319         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00320         _v31 = val1.grasp
00321         _v32 = _v31.header
00322         buff.write(_struct_I.pack(_v32.seq))
00323         _v33 = _v32.stamp
00324         _x = _v33
00325         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00326         _x = _v32.frame_id
00327         length = len(_x)
00328         if python3 or type(_x) == unicode:
00329           _x = _x.encode('utf-8')
00330           length = len(_x)
00331         buff.write(struct.pack('<I%ss'%length, length, _x))
00332         _v34 = _v31.pose
00333         _v35 = _v34.position
00334         _x = _v35
00335         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00336         _v36 = _v34.orientation
00337         _x = _v36
00338         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00339         _x = val1.category
00340         length = len(_x)
00341         if python3 or type(_x) == unicode:
00342           _x = _x.encode('utf-8')
00343           length = len(_x)
00344         buff.write(struct.pack('<I%ss'%length, length, _x))
00345     except struct.error as se: self._check_types(se)
00346     except TypeError as te: self._check_types(te)
00347 
00348   def deserialize_numpy(self, str, numpy):
00349     """
00350     unpack serialized message in str into this message instance using numpy for array types
00351     :param str: byte array of serialized message, ``str``
00352     :param numpy: numpy python module
00353     """
00354     try:
00355       if self.grasp_configuration is None:
00356         self.grasp_configuration = None
00357       end = 0
00358       start = end
00359       end += 4
00360       (length,) = _struct_I.unpack(str[start:end])
00361       self.grasp_configuration = []
00362       for i in range(0, length):
00363         val1 = srs_msgs.msg.DBGrasp()
00364         start = end
00365         end += 4
00366         (val1.object_id,) = _struct_i.unpack(str[start:end])
00367         start = end
00368         end += 4
00369         (length,) = _struct_I.unpack(str[start:end])
00370         start = end
00371         end += length
00372         if python3:
00373           val1.hand_type = str[start:end].decode('utf-8')
00374         else:
00375           val1.hand_type = str[start:end]
00376         start = end
00377         end += 4
00378         (length,) = _struct_I.unpack(str[start:end])
00379         pattern = '<%sd'%length
00380         start = end
00381         end += struct.calcsize(pattern)
00382         val1.sdh_joint_values = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00383         _v37 = val1.pre_grasp
00384         _v38 = _v37.header
00385         start = end
00386         end += 4
00387         (_v38.seq,) = _struct_I.unpack(str[start:end])
00388         _v39 = _v38.stamp
00389         _x = _v39
00390         start = end
00391         end += 8
00392         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00393         start = end
00394         end += 4
00395         (length,) = _struct_I.unpack(str[start:end])
00396         start = end
00397         end += length
00398         if python3:
00399           _v38.frame_id = str[start:end].decode('utf-8')
00400         else:
00401           _v38.frame_id = str[start:end]
00402         _v40 = _v37.pose
00403         _v41 = _v40.position
00404         _x = _v41
00405         start = end
00406         end += 24
00407         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00408         _v42 = _v40.orientation
00409         _x = _v42
00410         start = end
00411         end += 32
00412         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00413         _v43 = val1.grasp
00414         _v44 = _v43.header
00415         start = end
00416         end += 4
00417         (_v44.seq,) = _struct_I.unpack(str[start:end])
00418         _v45 = _v44.stamp
00419         _x = _v45
00420         start = end
00421         end += 8
00422         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00423         start = end
00424         end += 4
00425         (length,) = _struct_I.unpack(str[start:end])
00426         start = end
00427         end += length
00428         if python3:
00429           _v44.frame_id = str[start:end].decode('utf-8')
00430         else:
00431           _v44.frame_id = str[start:end]
00432         _v46 = _v43.pose
00433         _v47 = _v46.position
00434         _x = _v47
00435         start = end
00436         end += 24
00437         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00438         _v48 = _v46.orientation
00439         _x = _v48
00440         start = end
00441         end += 32
00442         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00443         start = end
00444         end += 4
00445         (length,) = _struct_I.unpack(str[start:end])
00446         start = end
00447         end += length
00448         if python3:
00449           val1.category = str[start:end].decode('utf-8')
00450         else:
00451           val1.category = str[start:end]
00452         self.grasp_configuration.append(val1)
00453       return self
00454     except struct.error as e:
00455       raise genpy.DeserializationError(e) #most likely buffer underfill
00456 
00457 _struct_I = genpy.struct_I
00458 _struct_i = struct.Struct("<i")
00459 _struct_4d = struct.Struct("<4d")
00460 _struct_2I = struct.Struct("<2I")
00461 _struct_3d = struct.Struct("<3d")


srs_msgs
Author(s): renxi
autogenerated on Sun Jan 5 2014 12:00:23