00001 """autogenerated by genpy from srs_msgs/DBGrasp.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 std_msgs.msg
00009
00010 class DBGrasp(genpy.Message):
00011 _md5sum = "d25a83b2040a10d845751c83e9e78981"
00012 _type = "srs_msgs/DBGrasp"
00013 _has_header = False
00014 _full_text = """int32 object_id
00015 string hand_type
00016 float64[] sdh_joint_values
00017 geometry_msgs/PoseStamped pre_grasp
00018 geometry_msgs/PoseStamped grasp
00019 string category
00020
00021 ================================================================================
00022 MSG: geometry_msgs/PoseStamped
00023 # A Pose with reference coordinate frame and timestamp
00024 Header header
00025 Pose pose
00026
00027 ================================================================================
00028 MSG: std_msgs/Header
00029 # Standard metadata for higher-level stamped data types.
00030 # This is generally used to communicate timestamped data
00031 # in a particular coordinate frame.
00032 #
00033 # sequence ID: consecutively increasing ID
00034 uint32 seq
00035 #Two-integer timestamp that is expressed as:
00036 # * stamp.secs: seconds (stamp_secs) since epoch
00037 # * stamp.nsecs: nanoseconds since stamp_secs
00038 # time-handling sugar is provided by the client library
00039 time stamp
00040 #Frame this data is associated with
00041 # 0: no frame
00042 # 1: global frame
00043 string frame_id
00044
00045 ================================================================================
00046 MSG: geometry_msgs/Pose
00047 # A representation of pose in free space, composed of postion and orientation.
00048 Point position
00049 Quaternion orientation
00050
00051 ================================================================================
00052 MSG: geometry_msgs/Point
00053 # This contains the position of a point in free space
00054 float64 x
00055 float64 y
00056 float64 z
00057
00058 ================================================================================
00059 MSG: geometry_msgs/Quaternion
00060 # This represents an orientation in free space in quaternion form.
00061
00062 float64 x
00063 float64 y
00064 float64 z
00065 float64 w
00066
00067 """
00068 __slots__ = ['object_id','hand_type','sdh_joint_values','pre_grasp','grasp','category']
00069 _slot_types = ['int32','string','float64[]','geometry_msgs/PoseStamped','geometry_msgs/PoseStamped','string']
00070
00071 def __init__(self, *args, **kwds):
00072 """
00073 Constructor. Any message fields that are implicitly/explicitly
00074 set to None will be assigned a default value. The recommend
00075 use is keyword arguments as this is more robust to future message
00076 changes. You cannot mix in-order arguments and keyword arguments.
00077
00078 The available fields are:
00079 object_id,hand_type,sdh_joint_values,pre_grasp,grasp,category
00080
00081 :param args: complete set of field values, in .msg order
00082 :param kwds: use keyword arguments corresponding to message field names
00083 to set specific fields.
00084 """
00085 if args or kwds:
00086 super(DBGrasp, self).__init__(*args, **kwds)
00087
00088 if self.object_id is None:
00089 self.object_id = 0
00090 if self.hand_type is None:
00091 self.hand_type = ''
00092 if self.sdh_joint_values is None:
00093 self.sdh_joint_values = []
00094 if self.pre_grasp is None:
00095 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00096 if self.grasp is None:
00097 self.grasp = geometry_msgs.msg.PoseStamped()
00098 if self.category is None:
00099 self.category = ''
00100 else:
00101 self.object_id = 0
00102 self.hand_type = ''
00103 self.sdh_joint_values = []
00104 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00105 self.grasp = geometry_msgs.msg.PoseStamped()
00106 self.category = ''
00107
00108 def _get_types(self):
00109 """
00110 internal API method
00111 """
00112 return self._slot_types
00113
00114 def serialize(self, buff):
00115 """
00116 serialize message into buffer
00117 :param buff: buffer, ``StringIO``
00118 """
00119 try:
00120 buff.write(_struct_i.pack(self.object_id))
00121 _x = self.hand_type
00122 length = len(_x)
00123 if python3 or type(_x) == unicode:
00124 _x = _x.encode('utf-8')
00125 length = len(_x)
00126 buff.write(struct.pack('<I%ss'%length, length, _x))
00127 length = len(self.sdh_joint_values)
00128 buff.write(_struct_I.pack(length))
00129 pattern = '<%sd'%length
00130 buff.write(struct.pack(pattern, *self.sdh_joint_values))
00131 _x = self
00132 buff.write(_struct_3I.pack(_x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs))
00133 _x = self.pre_grasp.header.frame_id
00134 length = len(_x)
00135 if python3 or type(_x) == unicode:
00136 _x = _x.encode('utf-8')
00137 length = len(_x)
00138 buff.write(struct.pack('<I%ss'%length, length, _x))
00139 _x = self
00140 buff.write(_struct_7d3I.pack(_x.pre_grasp.pose.position.x, _x.pre_grasp.pose.position.y, _x.pre_grasp.pose.position.z, _x.pre_grasp.pose.orientation.x, _x.pre_grasp.pose.orientation.y, _x.pre_grasp.pose.orientation.z, _x.pre_grasp.pose.orientation.w, _x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs))
00141 _x = self.grasp.header.frame_id
00142 length = len(_x)
00143 if python3 or type(_x) == unicode:
00144 _x = _x.encode('utf-8')
00145 length = len(_x)
00146 buff.write(struct.pack('<I%ss'%length, length, _x))
00147 _x = self
00148 buff.write(_struct_7d.pack(_x.grasp.pose.position.x, _x.grasp.pose.position.y, _x.grasp.pose.position.z, _x.grasp.pose.orientation.x, _x.grasp.pose.orientation.y, _x.grasp.pose.orientation.z, _x.grasp.pose.orientation.w))
00149 _x = self.category
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 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00156 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00157
00158 def deserialize(self, str):
00159 """
00160 unpack serialized message in str into this message instance
00161 :param str: byte array of serialized message, ``str``
00162 """
00163 try:
00164 if self.pre_grasp is None:
00165 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00166 if self.grasp is None:
00167 self.grasp = geometry_msgs.msg.PoseStamped()
00168 end = 0
00169 start = end
00170 end += 4
00171 (self.object_id,) = _struct_i.unpack(str[start:end])
00172 start = end
00173 end += 4
00174 (length,) = _struct_I.unpack(str[start:end])
00175 start = end
00176 end += length
00177 if python3:
00178 self.hand_type = str[start:end].decode('utf-8')
00179 else:
00180 self.hand_type = str[start:end]
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 pattern = '<%sd'%length
00185 start = end
00186 end += struct.calcsize(pattern)
00187 self.sdh_joint_values = struct.unpack(pattern, str[start:end])
00188 _x = self
00189 start = end
00190 end += 12
00191 (_x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 start = end
00196 end += length
00197 if python3:
00198 self.pre_grasp.header.frame_id = str[start:end].decode('utf-8')
00199 else:
00200 self.pre_grasp.header.frame_id = str[start:end]
00201 _x = self
00202 start = end
00203 end += 68
00204 (_x.pre_grasp.pose.position.x, _x.pre_grasp.pose.position.y, _x.pre_grasp.pose.position.z, _x.pre_grasp.pose.orientation.x, _x.pre_grasp.pose.orientation.y, _x.pre_grasp.pose.orientation.z, _x.pre_grasp.pose.orientation.w, _x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00205 start = end
00206 end += 4
00207 (length,) = _struct_I.unpack(str[start:end])
00208 start = end
00209 end += length
00210 if python3:
00211 self.grasp.header.frame_id = str[start:end].decode('utf-8')
00212 else:
00213 self.grasp.header.frame_id = str[start:end]
00214 _x = self
00215 start = end
00216 end += 56
00217 (_x.grasp.pose.position.x, _x.grasp.pose.position.y, _x.grasp.pose.position.z, _x.grasp.pose.orientation.x, _x.grasp.pose.orientation.y, _x.grasp.pose.orientation.z, _x.grasp.pose.orientation.w,) = _struct_7d.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.category = str[start:end].decode('utf-8')
00225 else:
00226 self.category = str[start:end]
00227 return self
00228 except struct.error as e:
00229 raise genpy.DeserializationError(e)
00230
00231
00232 def serialize_numpy(self, buff, numpy):
00233 """
00234 serialize message with numpy array types into buffer
00235 :param buff: buffer, ``StringIO``
00236 :param numpy: numpy python module
00237 """
00238 try:
00239 buff.write(_struct_i.pack(self.object_id))
00240 _x = self.hand_type
00241 length = len(_x)
00242 if python3 or type(_x) == unicode:
00243 _x = _x.encode('utf-8')
00244 length = len(_x)
00245 buff.write(struct.pack('<I%ss'%length, length, _x))
00246 length = len(self.sdh_joint_values)
00247 buff.write(_struct_I.pack(length))
00248 pattern = '<%sd'%length
00249 buff.write(self.sdh_joint_values.tostring())
00250 _x = self
00251 buff.write(_struct_3I.pack(_x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs))
00252 _x = self.pre_grasp.header.frame_id
00253 length = len(_x)
00254 if python3 or type(_x) == unicode:
00255 _x = _x.encode('utf-8')
00256 length = len(_x)
00257 buff.write(struct.pack('<I%ss'%length, length, _x))
00258 _x = self
00259 buff.write(_struct_7d3I.pack(_x.pre_grasp.pose.position.x, _x.pre_grasp.pose.position.y, _x.pre_grasp.pose.position.z, _x.pre_grasp.pose.orientation.x, _x.pre_grasp.pose.orientation.y, _x.pre_grasp.pose.orientation.z, _x.pre_grasp.pose.orientation.w, _x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs))
00260 _x = self.grasp.header.frame_id
00261 length = len(_x)
00262 if python3 or type(_x) == unicode:
00263 _x = _x.encode('utf-8')
00264 length = len(_x)
00265 buff.write(struct.pack('<I%ss'%length, length, _x))
00266 _x = self
00267 buff.write(_struct_7d.pack(_x.grasp.pose.position.x, _x.grasp.pose.position.y, _x.grasp.pose.position.z, _x.grasp.pose.orientation.x, _x.grasp.pose.orientation.y, _x.grasp.pose.orientation.z, _x.grasp.pose.orientation.w))
00268 _x = self.category
00269 length = len(_x)
00270 if python3 or type(_x) == unicode:
00271 _x = _x.encode('utf-8')
00272 length = len(_x)
00273 buff.write(struct.pack('<I%ss'%length, length, _x))
00274 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00275 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00276
00277 def deserialize_numpy(self, str, numpy):
00278 """
00279 unpack serialized message in str into this message instance using numpy for array types
00280 :param str: byte array of serialized message, ``str``
00281 :param numpy: numpy python module
00282 """
00283 try:
00284 if self.pre_grasp is None:
00285 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00286 if self.grasp is None:
00287 self.grasp = geometry_msgs.msg.PoseStamped()
00288 end = 0
00289 start = end
00290 end += 4
00291 (self.object_id,) = _struct_i.unpack(str[start:end])
00292 start = end
00293 end += 4
00294 (length,) = _struct_I.unpack(str[start:end])
00295 start = end
00296 end += length
00297 if python3:
00298 self.hand_type = str[start:end].decode('utf-8')
00299 else:
00300 self.hand_type = str[start:end]
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 pattern = '<%sd'%length
00305 start = end
00306 end += struct.calcsize(pattern)
00307 self.sdh_joint_values = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00308 _x = self
00309 start = end
00310 end += 12
00311 (_x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00312 start = end
00313 end += 4
00314 (length,) = _struct_I.unpack(str[start:end])
00315 start = end
00316 end += length
00317 if python3:
00318 self.pre_grasp.header.frame_id = str[start:end].decode('utf-8')
00319 else:
00320 self.pre_grasp.header.frame_id = str[start:end]
00321 _x = self
00322 start = end
00323 end += 68
00324 (_x.pre_grasp.pose.position.x, _x.pre_grasp.pose.position.y, _x.pre_grasp.pose.position.z, _x.pre_grasp.pose.orientation.x, _x.pre_grasp.pose.orientation.y, _x.pre_grasp.pose.orientation.z, _x.pre_grasp.pose.orientation.w, _x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00325 start = end
00326 end += 4
00327 (length,) = _struct_I.unpack(str[start:end])
00328 start = end
00329 end += length
00330 if python3:
00331 self.grasp.header.frame_id = str[start:end].decode('utf-8')
00332 else:
00333 self.grasp.header.frame_id = str[start:end]
00334 _x = self
00335 start = end
00336 end += 56
00337 (_x.grasp.pose.position.x, _x.grasp.pose.position.y, _x.grasp.pose.position.z, _x.grasp.pose.orientation.x, _x.grasp.pose.orientation.y, _x.grasp.pose.orientation.z, _x.grasp.pose.orientation.w,) = _struct_7d.unpack(str[start:end])
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.category = str[start:end].decode('utf-8')
00345 else:
00346 self.category = str[start:end]
00347 return self
00348 except struct.error as e:
00349 raise genpy.DeserializationError(e)
00350
00351 _struct_I = genpy.struct_I
00352 _struct_i = struct.Struct("<i")
00353 _struct_3I = struct.Struct("<3I")
00354 _struct_7d = struct.Struct("<7d")
00355 _struct_7d3I = struct.Struct("<7d3I")