00001 """autogenerated by genpy from srs_msgs/FeasibleGrasp.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 FeasibleGrasp(genpy.Message):
00011 _md5sum = "9658a5b41d8711f740084a7614774730"
00012 _type = "srs_msgs/FeasibleGrasp"
00013 _has_header = False
00014 _full_text = """float64[] sdh_joint_values
00015 string target_link #link which should be moved to pre_grasp (e.g. sdh_palm_link)
00016 geometry_msgs/PoseStamped grasp
00017 geometry_msgs/PoseStamped pre_grasp
00018 float64 surface_distance
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__ = ['sdh_joint_values','target_link','grasp','pre_grasp','surface_distance','category']
00069 _slot_types = ['float64[]','string','geometry_msgs/PoseStamped','geometry_msgs/PoseStamped','float64','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 sdh_joint_values,target_link,grasp,pre_grasp,surface_distance,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(FeasibleGrasp, self).__init__(*args, **kwds)
00087
00088 if self.sdh_joint_values is None:
00089 self.sdh_joint_values = []
00090 if self.target_link is None:
00091 self.target_link = ''
00092 if self.grasp is None:
00093 self.grasp = geometry_msgs.msg.PoseStamped()
00094 if self.pre_grasp is None:
00095 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00096 if self.surface_distance is None:
00097 self.surface_distance = 0.
00098 if self.category is None:
00099 self.category = ''
00100 else:
00101 self.sdh_joint_values = []
00102 self.target_link = ''
00103 self.grasp = geometry_msgs.msg.PoseStamped()
00104 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00105 self.surface_distance = 0.
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 length = len(self.sdh_joint_values)
00121 buff.write(_struct_I.pack(length))
00122 pattern = '<%sd'%length
00123 buff.write(struct.pack(pattern, *self.sdh_joint_values))
00124 _x = self.target_link
00125 length = len(_x)
00126 if python3 or type(_x) == unicode:
00127 _x = _x.encode('utf-8')
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 _x = self
00131 buff.write(_struct_3I.pack(_x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs))
00132 _x = self.grasp.header.frame_id
00133 length = len(_x)
00134 if python3 or type(_x) == unicode:
00135 _x = _x.encode('utf-8')
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 _x = self
00139 buff.write(_struct_7d3I.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, _x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs))
00140 _x = self.pre_grasp.header.frame_id
00141 length = len(_x)
00142 if python3 or type(_x) == unicode:
00143 _x = _x.encode('utf-8')
00144 length = len(_x)
00145 buff.write(struct.pack('<I%ss'%length, length, _x))
00146 _x = self
00147 buff.write(_struct_8d.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.surface_distance))
00148 _x = self.category
00149 length = len(_x)
00150 if python3 or type(_x) == unicode:
00151 _x = _x.encode('utf-8')
00152 length = len(_x)
00153 buff.write(struct.pack('<I%ss'%length, length, _x))
00154 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00155 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00156
00157 def deserialize(self, str):
00158 """
00159 unpack serialized message in str into this message instance
00160 :param str: byte array of serialized message, ``str``
00161 """
00162 try:
00163 if self.grasp is None:
00164 self.grasp = geometry_msgs.msg.PoseStamped()
00165 if self.pre_grasp is None:
00166 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00167 end = 0
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 pattern = '<%sd'%length
00172 start = end
00173 end += struct.calcsize(pattern)
00174 self.sdh_joint_values = struct.unpack(pattern, str[start:end])
00175 start = end
00176 end += 4
00177 (length,) = _struct_I.unpack(str[start:end])
00178 start = end
00179 end += length
00180 if python3:
00181 self.target_link = str[start:end].decode('utf-8')
00182 else:
00183 self.target_link = str[start:end]
00184 _x = self
00185 start = end
00186 end += 12
00187 (_x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00188 start = end
00189 end += 4
00190 (length,) = _struct_I.unpack(str[start:end])
00191 start = end
00192 end += length
00193 if python3:
00194 self.grasp.header.frame_id = str[start:end].decode('utf-8')
00195 else:
00196 self.grasp.header.frame_id = str[start:end]
00197 _x = self
00198 start = end
00199 end += 68
00200 (_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, _x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00201 start = end
00202 end += 4
00203 (length,) = _struct_I.unpack(str[start:end])
00204 start = end
00205 end += length
00206 if python3:
00207 self.pre_grasp.header.frame_id = str[start:end].decode('utf-8')
00208 else:
00209 self.pre_grasp.header.frame_id = str[start:end]
00210 _x = self
00211 start = end
00212 end += 64
00213 (_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.surface_distance,) = _struct_8d.unpack(str[start:end])
00214 start = end
00215 end += 4
00216 (length,) = _struct_I.unpack(str[start:end])
00217 start = end
00218 end += length
00219 if python3:
00220 self.category = str[start:end].decode('utf-8')
00221 else:
00222 self.category = str[start:end]
00223 return self
00224 except struct.error as e:
00225 raise genpy.DeserializationError(e)
00226
00227
00228 def serialize_numpy(self, buff, numpy):
00229 """
00230 serialize message with numpy array types into buffer
00231 :param buff: buffer, ``StringIO``
00232 :param numpy: numpy python module
00233 """
00234 try:
00235 length = len(self.sdh_joint_values)
00236 buff.write(_struct_I.pack(length))
00237 pattern = '<%sd'%length
00238 buff.write(self.sdh_joint_values.tostring())
00239 _x = self.target_link
00240 length = len(_x)
00241 if python3 or type(_x) == unicode:
00242 _x = _x.encode('utf-8')
00243 length = len(_x)
00244 buff.write(struct.pack('<I%ss'%length, length, _x))
00245 _x = self
00246 buff.write(_struct_3I.pack(_x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs))
00247 _x = self.grasp.header.frame_id
00248 length = len(_x)
00249 if python3 or type(_x) == unicode:
00250 _x = _x.encode('utf-8')
00251 length = len(_x)
00252 buff.write(struct.pack('<I%ss'%length, length, _x))
00253 _x = self
00254 buff.write(_struct_7d3I.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, _x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs))
00255 _x = self.pre_grasp.header.frame_id
00256 length = len(_x)
00257 if python3 or type(_x) == unicode:
00258 _x = _x.encode('utf-8')
00259 length = len(_x)
00260 buff.write(struct.pack('<I%ss'%length, length, _x))
00261 _x = self
00262 buff.write(_struct_8d.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.surface_distance))
00263 _x = self.category
00264 length = len(_x)
00265 if python3 or type(_x) == unicode:
00266 _x = _x.encode('utf-8')
00267 length = len(_x)
00268 buff.write(struct.pack('<I%ss'%length, length, _x))
00269 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00270 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00271
00272 def deserialize_numpy(self, str, numpy):
00273 """
00274 unpack serialized message in str into this message instance using numpy for array types
00275 :param str: byte array of serialized message, ``str``
00276 :param numpy: numpy python module
00277 """
00278 try:
00279 if self.grasp is None:
00280 self.grasp = geometry_msgs.msg.PoseStamped()
00281 if self.pre_grasp is None:
00282 self.pre_grasp = geometry_msgs.msg.PoseStamped()
00283 end = 0
00284 start = end
00285 end += 4
00286 (length,) = _struct_I.unpack(str[start:end])
00287 pattern = '<%sd'%length
00288 start = end
00289 end += struct.calcsize(pattern)
00290 self.sdh_joint_values = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 start = end
00295 end += length
00296 if python3:
00297 self.target_link = str[start:end].decode('utf-8')
00298 else:
00299 self.target_link = str[start:end]
00300 _x = self
00301 start = end
00302 end += 12
00303 (_x.grasp.header.seq, _x.grasp.header.stamp.secs, _x.grasp.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00304 start = end
00305 end += 4
00306 (length,) = _struct_I.unpack(str[start:end])
00307 start = end
00308 end += length
00309 if python3:
00310 self.grasp.header.frame_id = str[start:end].decode('utf-8')
00311 else:
00312 self.grasp.header.frame_id = str[start:end]
00313 _x = self
00314 start = end
00315 end += 68
00316 (_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, _x.pre_grasp.header.seq, _x.pre_grasp.header.stamp.secs, _x.pre_grasp.header.stamp.nsecs,) = _struct_7d3I.unpack(str[start:end])
00317 start = end
00318 end += 4
00319 (length,) = _struct_I.unpack(str[start:end])
00320 start = end
00321 end += length
00322 if python3:
00323 self.pre_grasp.header.frame_id = str[start:end].decode('utf-8')
00324 else:
00325 self.pre_grasp.header.frame_id = str[start:end]
00326 _x = self
00327 start = end
00328 end += 64
00329 (_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.surface_distance,) = _struct_8d.unpack(str[start:end])
00330 start = end
00331 end += 4
00332 (length,) = _struct_I.unpack(str[start:end])
00333 start = end
00334 end += length
00335 if python3:
00336 self.category = str[start:end].decode('utf-8')
00337 else:
00338 self.category = str[start:end]
00339 return self
00340 except struct.error as e:
00341 raise genpy.DeserializationError(e)
00342
00343 _struct_I = genpy.struct_I
00344 _struct_3I = struct.Struct("<3I")
00345 _struct_7d3I = struct.Struct("<7d3I")
00346 _struct_8d = struct.Struct("<8d")