00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperFindContactActionGoal.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 genpy
00008 import actionlib_msgs.msg
00009 import pr2_gripper_sensor_msgs.msg
00010 import std_msgs.msg
00011
00012 class PR2GripperFindContactActionGoal(genpy.Message):
00013 _md5sum = "50fc3f7e604d4e257a2e38e3aa3f204e"
00014 _type = "pr2_gripper_sensor_msgs/PR2GripperFindContactActionGoal"
00015 _has_header = True
00016 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00017
00018 Header header
00019 actionlib_msgs/GoalID goal_id
00020 PR2GripperFindContactGoal goal
00021
00022 ================================================================================
00023 MSG: std_msgs/Header
00024 # Standard metadata for higher-level stamped data types.
00025 # This is generally used to communicate timestamped data
00026 # in a particular coordinate frame.
00027 #
00028 # sequence ID: consecutively increasing ID
00029 uint32 seq
00030 #Two-integer timestamp that is expressed as:
00031 # * stamp.secs: seconds (stamp_secs) since epoch
00032 # * stamp.nsecs: nanoseconds since stamp_secs
00033 # time-handling sugar is provided by the client library
00034 time stamp
00035 #Frame this data is associated with
00036 # 0: no frame
00037 # 1: global frame
00038 string frame_id
00039
00040 ================================================================================
00041 MSG: actionlib_msgs/GoalID
00042 # The stamp should store the time at which this goal was requested.
00043 # It is used by an action server when it tries to preempt all
00044 # goals that were requested before a certain time
00045 time stamp
00046
00047 # The id provides a way to associate feedback and
00048 # result message with specific goal requests. The id
00049 # specified must be unique.
00050 string id
00051
00052
00053 ================================================================================
00054 MSG: pr2_gripper_sensor_msgs/PR2GripperFindContactGoal
00055 # ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00056 # Contact action used to close fingers and find object contacts
00057 # quickly while still stopping fast in real-time to not damage
00058 # objects
00059
00060 #goal
00061 PR2GripperFindContactCommand command
00062
00063 ================================================================================
00064 MSG: pr2_gripper_sensor_msgs/PR2GripperFindContactCommand
00065 # set true if you want to calibrate the fingertip sensors on the start
00066 # of the find_contact action. While this is not necessary (and
00067 # the default value will not calibrate the sensors) for best
00068 # performance it is recommended that you set this to true each time
00069 # you are calling find_contact and are confident the fingertips are
00070 # not touching anything
00071 # NOTE: SHOULD ONLY BE TRUE WHEN BOTH FINGERS ARE TOUCHING NOTHING
00072 bool zero_fingertip_sensors
00073
00074 # the finger contact conditions that determine what our goal is
00075 # Leaving this field blank will result in the robot closing until
00076 # contact on BOTH fingers is achieved
00077 int8 contact_conditions
00078
00079 # predefined values for the above contact_conditions variable
00080 int8 BOTH = 0 # both fingers must make contact
00081 int8 LEFT = 1 # just the left finger
00082 int8 RIGHT = 2 # just the right finger
00083 int8 EITHER = 3 # either finger, we don't care which
00084
00085 """
00086 __slots__ = ['header','goal_id','goal']
00087 _slot_types = ['std_msgs/Header','actionlib_msgs/GoalID','pr2_gripper_sensor_msgs/PR2GripperFindContactGoal']
00088
00089 def __init__(self, *args, **kwds):
00090 """
00091 Constructor. Any message fields that are implicitly/explicitly
00092 set to None will be assigned a default value. The recommend
00093 use is keyword arguments as this is more robust to future message
00094 changes. You cannot mix in-order arguments and keyword arguments.
00095
00096 The available fields are:
00097 header,goal_id,goal
00098
00099 :param args: complete set of field values, in .msg order
00100 :param kwds: use keyword arguments corresponding to message field names
00101 to set specific fields.
00102 """
00103 if args or kwds:
00104 super(PR2GripperFindContactActionGoal, self).__init__(*args, **kwds)
00105
00106 if self.header is None:
00107 self.header = std_msgs.msg.Header()
00108 if self.goal_id is None:
00109 self.goal_id = actionlib_msgs.msg.GoalID()
00110 if self.goal is None:
00111 self.goal = pr2_gripper_sensor_msgs.msg.PR2GripperFindContactGoal()
00112 else:
00113 self.header = std_msgs.msg.Header()
00114 self.goal_id = actionlib_msgs.msg.GoalID()
00115 self.goal = pr2_gripper_sensor_msgs.msg.PR2GripperFindContactGoal()
00116
00117 def _get_types(self):
00118 """
00119 internal API method
00120 """
00121 return self._slot_types
00122
00123 def serialize(self, buff):
00124 """
00125 serialize message into buffer
00126 :param buff: buffer, ``StringIO``
00127 """
00128 try:
00129 _x = self
00130 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00131 _x = self.header.frame_id
00132 length = len(_x)
00133 if python3 or type(_x) == unicode:
00134 _x = _x.encode('utf-8')
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 _x = self
00138 buff.write(_struct_2I.pack(_x.goal_id.stamp.secs, _x.goal_id.stamp.nsecs))
00139 _x = self.goal_id.id
00140 length = len(_x)
00141 if python3 or type(_x) == unicode:
00142 _x = _x.encode('utf-8')
00143 length = len(_x)
00144 buff.write(struct.pack('<I%ss'%length, length, _x))
00145 _x = self
00146 buff.write(_struct_Bb.pack(_x.goal.command.zero_fingertip_sensors, _x.goal.command.contact_conditions))
00147 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00148 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00149
00150 def deserialize(self, str):
00151 """
00152 unpack serialized message in str into this message instance
00153 :param str: byte array of serialized message, ``str``
00154 """
00155 try:
00156 if self.header is None:
00157 self.header = std_msgs.msg.Header()
00158 if self.goal_id is None:
00159 self.goal_id = actionlib_msgs.msg.GoalID()
00160 if self.goal is None:
00161 self.goal = pr2_gripper_sensor_msgs.msg.PR2GripperFindContactGoal()
00162 end = 0
00163 _x = self
00164 start = end
00165 end += 12
00166 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 start = end
00171 end += length
00172 if python3:
00173 self.header.frame_id = str[start:end].decode('utf-8')
00174 else:
00175 self.header.frame_id = str[start:end]
00176 _x = self
00177 start = end
00178 end += 8
00179 (_x.goal_id.stamp.secs, _x.goal_id.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 if python3:
00186 self.goal_id.id = str[start:end].decode('utf-8')
00187 else:
00188 self.goal_id.id = str[start:end]
00189 _x = self
00190 start = end
00191 end += 2
00192 (_x.goal.command.zero_fingertip_sensors, _x.goal.command.contact_conditions,) = _struct_Bb.unpack(str[start:end])
00193 self.goal.command.zero_fingertip_sensors = bool(self.goal.command.zero_fingertip_sensors)
00194 return self
00195 except struct.error as e:
00196 raise genpy.DeserializationError(e)
00197
00198
00199 def serialize_numpy(self, buff, numpy):
00200 """
00201 serialize message with numpy array types into buffer
00202 :param buff: buffer, ``StringIO``
00203 :param numpy: numpy python module
00204 """
00205 try:
00206 _x = self
00207 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00208 _x = self.header.frame_id
00209 length = len(_x)
00210 if python3 or type(_x) == unicode:
00211 _x = _x.encode('utf-8')
00212 length = len(_x)
00213 buff.write(struct.pack('<I%ss'%length, length, _x))
00214 _x = self
00215 buff.write(_struct_2I.pack(_x.goal_id.stamp.secs, _x.goal_id.stamp.nsecs))
00216 _x = self.goal_id.id
00217 length = len(_x)
00218 if python3 or type(_x) == unicode:
00219 _x = _x.encode('utf-8')
00220 length = len(_x)
00221 buff.write(struct.pack('<I%ss'%length, length, _x))
00222 _x = self
00223 buff.write(_struct_Bb.pack(_x.goal.command.zero_fingertip_sensors, _x.goal.command.contact_conditions))
00224 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00225 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00226
00227 def deserialize_numpy(self, str, numpy):
00228 """
00229 unpack serialized message in str into this message instance using numpy for array types
00230 :param str: byte array of serialized message, ``str``
00231 :param numpy: numpy python module
00232 """
00233 try:
00234 if self.header is None:
00235 self.header = std_msgs.msg.Header()
00236 if self.goal_id is None:
00237 self.goal_id = actionlib_msgs.msg.GoalID()
00238 if self.goal is None:
00239 self.goal = pr2_gripper_sensor_msgs.msg.PR2GripperFindContactGoal()
00240 end = 0
00241 _x = self
00242 start = end
00243 end += 12
00244 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.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 self.header.frame_id = str[start:end].decode('utf-8')
00252 else:
00253 self.header.frame_id = str[start:end]
00254 _x = self
00255 start = end
00256 end += 8
00257 (_x.goal_id.stamp.secs, _x.goal_id.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00258 start = end
00259 end += 4
00260 (length,) = _struct_I.unpack(str[start:end])
00261 start = end
00262 end += length
00263 if python3:
00264 self.goal_id.id = str[start:end].decode('utf-8')
00265 else:
00266 self.goal_id.id = str[start:end]
00267 _x = self
00268 start = end
00269 end += 2
00270 (_x.goal.command.zero_fingertip_sensors, _x.goal.command.contact_conditions,) = _struct_Bb.unpack(str[start:end])
00271 self.goal.command.zero_fingertip_sensors = bool(self.goal.command.zero_fingertip_sensors)
00272 return self
00273 except struct.error as e:
00274 raise genpy.DeserializationError(e)
00275
00276 _struct_I = genpy.struct_I
00277 _struct_3I = struct.Struct("<3I")
00278 _struct_2I = struct.Struct("<2I")
00279 _struct_Bb = struct.Struct("<Bb")