_ArmHandGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from cogman_msgs/ArmHandGoal.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 
00009 class ArmHandGoal(genpy.Message):
00010   _md5sum = "3a564cf8a4d7611dab9e91da15079bfc"
00011   _type = "cogman_msgs/ArmHandGoal"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00014 string command              # 'arm_cart_loid', 'arm_cart_pose', 'arm_cart_name', 'arm_joints', 'arm_joint_name', 'reach_primitive', 'hand_primitive', 'lift', 'put_down'
00015 string pose_name            # When moving to pre-defined poses, cointains the name
00016 float32[] joint_angles      # If command is 'arm_joints', the joint angles
00017 geometry_msgs/Pose end_effector_pose  # command=arm_cart_pose: where the arm should go
00018 uint64 end_effector_loid    # one lo_id where the arm should go
00019 string hand_primitive       # Allowed strings: open open_thumb90 3pinch 2pinch cup_top peace handshake noop. Used when command is 'finger_primitive'
00020 string object_type          # If command is 'reach_primitive', it will define how to grasp (orientation ...)
00021 uint64[] obstacle_ids       # List of lo_id's corresponding to obstacles
00022 float32 distance            # For reach_primitive: distance from grasp point to approach point (m). For 'lift', distance to lift up (m)
00023 float32 supporting_plane    # Height of the table (m)
00024 
00025 ================================================================================
00026 MSG: geometry_msgs/Pose
00027 # A representation of pose in free space, composed of postion and orientation. 
00028 Point position
00029 Quaternion orientation
00030 
00031 ================================================================================
00032 MSG: geometry_msgs/Point
00033 # This contains the position of a point in free space
00034 float64 x
00035 float64 y
00036 float64 z
00037 
00038 ================================================================================
00039 MSG: geometry_msgs/Quaternion
00040 # This represents an orientation in free space in quaternion form.
00041 
00042 float64 x
00043 float64 y
00044 float64 z
00045 float64 w
00046 
00047 """
00048   __slots__ = ['command','pose_name','joint_angles','end_effector_pose','end_effector_loid','hand_primitive','object_type','obstacle_ids','distance','supporting_plane']
00049   _slot_types = ['string','string','float32[]','geometry_msgs/Pose','uint64','string','string','uint64[]','float32','float32']
00050 
00051   def __init__(self, *args, **kwds):
00052     """
00053     Constructor. Any message fields that are implicitly/explicitly
00054     set to None will be assigned a default value. The recommend
00055     use is keyword arguments as this is more robust to future message
00056     changes.  You cannot mix in-order arguments and keyword arguments.
00057 
00058     The available fields are:
00059        command,pose_name,joint_angles,end_effector_pose,end_effector_loid,hand_primitive,object_type,obstacle_ids,distance,supporting_plane
00060 
00061     :param args: complete set of field values, in .msg order
00062     :param kwds: use keyword arguments corresponding to message field names
00063     to set specific fields.
00064     """
00065     if args or kwds:
00066       super(ArmHandGoal, self).__init__(*args, **kwds)
00067       #message fields cannot be None, assign default values for those that are
00068       if self.command is None:
00069         self.command = ''
00070       if self.pose_name is None:
00071         self.pose_name = ''
00072       if self.joint_angles is None:
00073         self.joint_angles = []
00074       if self.end_effector_pose is None:
00075         self.end_effector_pose = geometry_msgs.msg.Pose()
00076       if self.end_effector_loid is None:
00077         self.end_effector_loid = 0
00078       if self.hand_primitive is None:
00079         self.hand_primitive = ''
00080       if self.object_type is None:
00081         self.object_type = ''
00082       if self.obstacle_ids is None:
00083         self.obstacle_ids = []
00084       if self.distance is None:
00085         self.distance = 0.
00086       if self.supporting_plane is None:
00087         self.supporting_plane = 0.
00088     else:
00089       self.command = ''
00090       self.pose_name = ''
00091       self.joint_angles = []
00092       self.end_effector_pose = geometry_msgs.msg.Pose()
00093       self.end_effector_loid = 0
00094       self.hand_primitive = ''
00095       self.object_type = ''
00096       self.obstacle_ids = []
00097       self.distance = 0.
00098       self.supporting_plane = 0.
00099 
00100   def _get_types(self):
00101     """
00102     internal API method
00103     """
00104     return self._slot_types
00105 
00106   def serialize(self, buff):
00107     """
00108     serialize message into buffer
00109     :param buff: buffer, ``StringIO``
00110     """
00111     try:
00112       _x = self.command
00113       length = len(_x)
00114       if python3 or type(_x) == unicode:
00115         _x = _x.encode('utf-8')
00116         length = len(_x)
00117       buff.write(struct.pack('<I%ss'%length, length, _x))
00118       _x = self.pose_name
00119       length = len(_x)
00120       if python3 or type(_x) == unicode:
00121         _x = _x.encode('utf-8')
00122         length = len(_x)
00123       buff.write(struct.pack('<I%ss'%length, length, _x))
00124       length = len(self.joint_angles)
00125       buff.write(_struct_I.pack(length))
00126       pattern = '<%sf'%length
00127       buff.write(struct.pack(pattern, *self.joint_angles))
00128       _x = self
00129       buff.write(_struct_7dQ.pack(_x.end_effector_pose.position.x, _x.end_effector_pose.position.y, _x.end_effector_pose.position.z, _x.end_effector_pose.orientation.x, _x.end_effector_pose.orientation.y, _x.end_effector_pose.orientation.z, _x.end_effector_pose.orientation.w, _x.end_effector_loid))
00130       _x = self.hand_primitive
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       _x = self.object_type
00137       length = len(_x)
00138       if python3 or type(_x) == unicode:
00139         _x = _x.encode('utf-8')
00140         length = len(_x)
00141       buff.write(struct.pack('<I%ss'%length, length, _x))
00142       length = len(self.obstacle_ids)
00143       buff.write(_struct_I.pack(length))
00144       pattern = '<%sQ'%length
00145       buff.write(struct.pack(pattern, *self.obstacle_ids))
00146       _x = self
00147       buff.write(_struct_2f.pack(_x.distance, _x.supporting_plane))
00148     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00149     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00150 
00151   def deserialize(self, str):
00152     """
00153     unpack serialized message in str into this message instance
00154     :param str: byte array of serialized message, ``str``
00155     """
00156     try:
00157       if self.end_effector_pose is None:
00158         self.end_effector_pose = geometry_msgs.msg.Pose()
00159       end = 0
00160       start = end
00161       end += 4
00162       (length,) = _struct_I.unpack(str[start:end])
00163       start = end
00164       end += length
00165       if python3:
00166         self.command = str[start:end].decode('utf-8')
00167       else:
00168         self.command = str[start:end]
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       start = end
00173       end += length
00174       if python3:
00175         self.pose_name = str[start:end].decode('utf-8')
00176       else:
00177         self.pose_name = str[start:end]
00178       start = end
00179       end += 4
00180       (length,) = _struct_I.unpack(str[start:end])
00181       pattern = '<%sf'%length
00182       start = end
00183       end += struct.calcsize(pattern)
00184       self.joint_angles = struct.unpack(pattern, str[start:end])
00185       _x = self
00186       start = end
00187       end += 64
00188       (_x.end_effector_pose.position.x, _x.end_effector_pose.position.y, _x.end_effector_pose.position.z, _x.end_effector_pose.orientation.x, _x.end_effector_pose.orientation.y, _x.end_effector_pose.orientation.z, _x.end_effector_pose.orientation.w, _x.end_effector_loid,) = _struct_7dQ.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         self.hand_primitive = str[start:end].decode('utf-8')
00196       else:
00197         self.hand_primitive = str[start:end]
00198       start = end
00199       end += 4
00200       (length,) = _struct_I.unpack(str[start:end])
00201       start = end
00202       end += length
00203       if python3:
00204         self.object_type = str[start:end].decode('utf-8')
00205       else:
00206         self.object_type = str[start:end]
00207       start = end
00208       end += 4
00209       (length,) = _struct_I.unpack(str[start:end])
00210       pattern = '<%sQ'%length
00211       start = end
00212       end += struct.calcsize(pattern)
00213       self.obstacle_ids = struct.unpack(pattern, str[start:end])
00214       _x = self
00215       start = end
00216       end += 8
00217       (_x.distance, _x.supporting_plane,) = _struct_2f.unpack(str[start:end])
00218       return self
00219     except struct.error as e:
00220       raise genpy.DeserializationError(e) #most likely buffer underfill
00221 
00222 
00223   def serialize_numpy(self, buff, numpy):
00224     """
00225     serialize message with numpy array types into buffer
00226     :param buff: buffer, ``StringIO``
00227     :param numpy: numpy python module
00228     """
00229     try:
00230       _x = self.command
00231       length = len(_x)
00232       if python3 or type(_x) == unicode:
00233         _x = _x.encode('utf-8')
00234         length = len(_x)
00235       buff.write(struct.pack('<I%ss'%length, length, _x))
00236       _x = self.pose_name
00237       length = len(_x)
00238       if python3 or type(_x) == unicode:
00239         _x = _x.encode('utf-8')
00240         length = len(_x)
00241       buff.write(struct.pack('<I%ss'%length, length, _x))
00242       length = len(self.joint_angles)
00243       buff.write(_struct_I.pack(length))
00244       pattern = '<%sf'%length
00245       buff.write(self.joint_angles.tostring())
00246       _x = self
00247       buff.write(_struct_7dQ.pack(_x.end_effector_pose.position.x, _x.end_effector_pose.position.y, _x.end_effector_pose.position.z, _x.end_effector_pose.orientation.x, _x.end_effector_pose.orientation.y, _x.end_effector_pose.orientation.z, _x.end_effector_pose.orientation.w, _x.end_effector_loid))
00248       _x = self.hand_primitive
00249       length = len(_x)
00250       if python3 or type(_x) == unicode:
00251         _x = _x.encode('utf-8')
00252         length = len(_x)
00253       buff.write(struct.pack('<I%ss'%length, length, _x))
00254       _x = self.object_type
00255       length = len(_x)
00256       if python3 or type(_x) == unicode:
00257         _x = _x.encode('utf-8')
00258         length = len(_x)
00259       buff.write(struct.pack('<I%ss'%length, length, _x))
00260       length = len(self.obstacle_ids)
00261       buff.write(_struct_I.pack(length))
00262       pattern = '<%sQ'%length
00263       buff.write(self.obstacle_ids.tostring())
00264       _x = self
00265       buff.write(_struct_2f.pack(_x.distance, _x.supporting_plane))
00266     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00267     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00268 
00269   def deserialize_numpy(self, str, numpy):
00270     """
00271     unpack serialized message in str into this message instance using numpy for array types
00272     :param str: byte array of serialized message, ``str``
00273     :param numpy: numpy python module
00274     """
00275     try:
00276       if self.end_effector_pose is None:
00277         self.end_effector_pose = geometry_msgs.msg.Pose()
00278       end = 0
00279       start = end
00280       end += 4
00281       (length,) = _struct_I.unpack(str[start:end])
00282       start = end
00283       end += length
00284       if python3:
00285         self.command = str[start:end].decode('utf-8')
00286       else:
00287         self.command = str[start:end]
00288       start = end
00289       end += 4
00290       (length,) = _struct_I.unpack(str[start:end])
00291       start = end
00292       end += length
00293       if python3:
00294         self.pose_name = str[start:end].decode('utf-8')
00295       else:
00296         self.pose_name = str[start:end]
00297       start = end
00298       end += 4
00299       (length,) = _struct_I.unpack(str[start:end])
00300       pattern = '<%sf'%length
00301       start = end
00302       end += struct.calcsize(pattern)
00303       self.joint_angles = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00304       _x = self
00305       start = end
00306       end += 64
00307       (_x.end_effector_pose.position.x, _x.end_effector_pose.position.y, _x.end_effector_pose.position.z, _x.end_effector_pose.orientation.x, _x.end_effector_pose.orientation.y, _x.end_effector_pose.orientation.z, _x.end_effector_pose.orientation.w, _x.end_effector_loid,) = _struct_7dQ.unpack(str[start:end])
00308       start = end
00309       end += 4
00310       (length,) = _struct_I.unpack(str[start:end])
00311       start = end
00312       end += length
00313       if python3:
00314         self.hand_primitive = str[start:end].decode('utf-8')
00315       else:
00316         self.hand_primitive = 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.object_type = str[start:end].decode('utf-8')
00324       else:
00325         self.object_type = str[start:end]
00326       start = end
00327       end += 4
00328       (length,) = _struct_I.unpack(str[start:end])
00329       pattern = '<%sQ'%length
00330       start = end
00331       end += struct.calcsize(pattern)
00332       self.obstacle_ids = numpy.frombuffer(str[start:end], dtype=numpy.uint64, count=length)
00333       _x = self
00334       start = end
00335       end += 8
00336       (_x.distance, _x.supporting_plane,) = _struct_2f.unpack(str[start:end])
00337       return self
00338     except struct.error as e:
00339       raise genpy.DeserializationError(e) #most likely buffer underfill
00340 
00341 _struct_I = genpy.struct_I
00342 _struct_7dQ = struct.Struct("<7dQ")
00343 _struct_2f = struct.Struct("<2f")


cogman_msgs
Author(s): Alexis Maldonado
autogenerated on Mon Oct 6 2014 00:48:49