00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperEventDetectorActionResult.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 PR2GripperEventDetectorActionResult(genpy.Message):
00013 _md5sum = "a8c6f42e274ecd861ad072720ef9894b"
00014 _type = "pr2_gripper_sensor_msgs/PR2GripperEventDetectorActionResult"
00015 _has_header = True
00016 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00017
00018 Header header
00019 actionlib_msgs/GoalStatus status
00020 PR2GripperEventDetectorResult result
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/GoalStatus
00042 GoalID goal_id
00043 uint8 status
00044 uint8 PENDING = 0 # The goal has yet to be processed by the action server
00045 uint8 ACTIVE = 1 # The goal is currently being processed by the action server
00046 uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing
00047 # and has since completed its execution (Terminal State)
00048 uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)
00049 uint8 ABORTED = 4 # The goal was aborted during execution by the action server due
00050 # to some failure (Terminal State)
00051 uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,
00052 # because the goal was unattainable or invalid (Terminal State)
00053 uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing
00054 # and has not yet completed execution
00055 uint8 RECALLING = 7 # The goal received a cancel request before it started executing,
00056 # but the action server has not yet confirmed that the goal is canceled
00057 uint8 RECALLED = 8 # The goal received a cancel request before it started executing
00058 # and was successfully cancelled (Terminal State)
00059 uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be
00060 # sent over the wire by an action server
00061
00062 #Allow for the user to associate a string with GoalStatus for debugging
00063 string text
00064
00065
00066 ================================================================================
00067 MSG: actionlib_msgs/GoalID
00068 # The stamp should store the time at which this goal was requested.
00069 # It is used by an action server when it tries to preempt all
00070 # goals that were requested before a certain time
00071 time stamp
00072
00073 # The id provides a way to associate feedback and
00074 # result message with specific goal requests. The id
00075 # specified must be unique.
00076 string id
00077
00078
00079 ================================================================================
00080 MSG: pr2_gripper_sensor_msgs/PR2GripperEventDetectorResult
00081 # ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00082 #results
00083 PR2GripperEventDetectorData data
00084
00085 ================================================================================
00086 MSG: pr2_gripper_sensor_msgs/PR2GripperEventDetectorData
00087 # Time the data was recorded at
00088 time stamp
00089
00090 # true if the trigger conditions have been met
00091 # (see PR2GripperEventDetectorCommand)
00092 bool trigger_conditions_met
00093
00094 # true if the pressure sensors detected a slip event
00095 # slip events occur when the finger pressure sensors
00096 # high-freq. content exceeds the slip_trigger_magnitude variable
00097 # (see PR2GripperEventDetectorCommand)
00098 bool slip_event
00099
00100 # true if the hand-mounted accelerometer detected a contact acceleration
00101 # acceleration events occur when the palm accelerometer
00102 # high-freq. content exceeds the acc_trigger_magnitude variable
00103 # (see PR2GripperEventDetectorCommand)
00104 bool acceleration_event
00105
00106 # the high-freq acceleration vector that was last seen (x,y,z)
00107 float64[3] acceleration_vector
00108 """
00109 __slots__ = ['header','status','result']
00110 _slot_types = ['std_msgs/Header','actionlib_msgs/GoalStatus','pr2_gripper_sensor_msgs/PR2GripperEventDetectorResult']
00111
00112 def __init__(self, *args, **kwds):
00113 """
00114 Constructor. Any message fields that are implicitly/explicitly
00115 set to None will be assigned a default value. The recommend
00116 use is keyword arguments as this is more robust to future message
00117 changes. You cannot mix in-order arguments and keyword arguments.
00118
00119 The available fields are:
00120 header,status,result
00121
00122 :param args: complete set of field values, in .msg order
00123 :param kwds: use keyword arguments corresponding to message field names
00124 to set specific fields.
00125 """
00126 if args or kwds:
00127 super(PR2GripperEventDetectorActionResult, self).__init__(*args, **kwds)
00128
00129 if self.header is None:
00130 self.header = std_msgs.msg.Header()
00131 if self.status is None:
00132 self.status = actionlib_msgs.msg.GoalStatus()
00133 if self.result is None:
00134 self.result = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorResult()
00135 else:
00136 self.header = std_msgs.msg.Header()
00137 self.status = actionlib_msgs.msg.GoalStatus()
00138 self.result = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorResult()
00139
00140 def _get_types(self):
00141 """
00142 internal API method
00143 """
00144 return self._slot_types
00145
00146 def serialize(self, buff):
00147 """
00148 serialize message into buffer
00149 :param buff: buffer, ``StringIO``
00150 """
00151 try:
00152 _x = self
00153 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00154 _x = self.header.frame_id
00155 length = len(_x)
00156 if python3 or type(_x) == unicode:
00157 _x = _x.encode('utf-8')
00158 length = len(_x)
00159 buff.write(struct.pack('<I%ss'%length, length, _x))
00160 _x = self
00161 buff.write(_struct_2I.pack(_x.status.goal_id.stamp.secs, _x.status.goal_id.stamp.nsecs))
00162 _x = self.status.goal_id.id
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 buff.write(_struct_B.pack(self.status.status))
00169 _x = self.status.text
00170 length = len(_x)
00171 if python3 or type(_x) == unicode:
00172 _x = _x.encode('utf-8')
00173 length = len(_x)
00174 buff.write(struct.pack('<I%ss'%length, length, _x))
00175 _x = self
00176 buff.write(_struct_2I3B.pack(_x.result.data.stamp.secs, _x.result.data.stamp.nsecs, _x.result.data.trigger_conditions_met, _x.result.data.slip_event, _x.result.data.acceleration_event))
00177 buff.write(_struct_3d.pack(*self.result.data.acceleration_vector))
00178 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00179 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00180
00181 def deserialize(self, str):
00182 """
00183 unpack serialized message in str into this message instance
00184 :param str: byte array of serialized message, ``str``
00185 """
00186 try:
00187 if self.header is None:
00188 self.header = std_msgs.msg.Header()
00189 if self.status is None:
00190 self.status = actionlib_msgs.msg.GoalStatus()
00191 if self.result is None:
00192 self.result = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorResult()
00193 end = 0
00194 _x = self
00195 start = end
00196 end += 12
00197 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(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.header.frame_id = str[start:end].decode('utf-8')
00205 else:
00206 self.header.frame_id = str[start:end]
00207 _x = self
00208 start = end
00209 end += 8
00210 (_x.status.goal_id.stamp.secs, _x.status.goal_id.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00211 start = end
00212 end += 4
00213 (length,) = _struct_I.unpack(str[start:end])
00214 start = end
00215 end += length
00216 if python3:
00217 self.status.goal_id.id = str[start:end].decode('utf-8')
00218 else:
00219 self.status.goal_id.id = str[start:end]
00220 start = end
00221 end += 1
00222 (self.status.status,) = _struct_B.unpack(str[start:end])
00223 start = end
00224 end += 4
00225 (length,) = _struct_I.unpack(str[start:end])
00226 start = end
00227 end += length
00228 if python3:
00229 self.status.text = str[start:end].decode('utf-8')
00230 else:
00231 self.status.text = str[start:end]
00232 _x = self
00233 start = end
00234 end += 11
00235 (_x.result.data.stamp.secs, _x.result.data.stamp.nsecs, _x.result.data.trigger_conditions_met, _x.result.data.slip_event, _x.result.data.acceleration_event,) = _struct_2I3B.unpack(str[start:end])
00236 self.result.data.trigger_conditions_met = bool(self.result.data.trigger_conditions_met)
00237 self.result.data.slip_event = bool(self.result.data.slip_event)
00238 self.result.data.acceleration_event = bool(self.result.data.acceleration_event)
00239 start = end
00240 end += 24
00241 self.result.data.acceleration_vector = _struct_3d.unpack(str[start:end])
00242 return self
00243 except struct.error as e:
00244 raise genpy.DeserializationError(e)
00245
00246
00247 def serialize_numpy(self, buff, numpy):
00248 """
00249 serialize message with numpy array types into buffer
00250 :param buff: buffer, ``StringIO``
00251 :param numpy: numpy python module
00252 """
00253 try:
00254 _x = self
00255 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00256 _x = self.header.frame_id
00257 length = len(_x)
00258 if python3 or type(_x) == unicode:
00259 _x = _x.encode('utf-8')
00260 length = len(_x)
00261 buff.write(struct.pack('<I%ss'%length, length, _x))
00262 _x = self
00263 buff.write(_struct_2I.pack(_x.status.goal_id.stamp.secs, _x.status.goal_id.stamp.nsecs))
00264 _x = self.status.goal_id.id
00265 length = len(_x)
00266 if python3 or type(_x) == unicode:
00267 _x = _x.encode('utf-8')
00268 length = len(_x)
00269 buff.write(struct.pack('<I%ss'%length, length, _x))
00270 buff.write(_struct_B.pack(self.status.status))
00271 _x = self.status.text
00272 length = len(_x)
00273 if python3 or type(_x) == unicode:
00274 _x = _x.encode('utf-8')
00275 length = len(_x)
00276 buff.write(struct.pack('<I%ss'%length, length, _x))
00277 _x = self
00278 buff.write(_struct_2I3B.pack(_x.result.data.stamp.secs, _x.result.data.stamp.nsecs, _x.result.data.trigger_conditions_met, _x.result.data.slip_event, _x.result.data.acceleration_event))
00279 buff.write(self.result.data.acceleration_vector.tostring())
00280 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00281 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00282
00283 def deserialize_numpy(self, str, numpy):
00284 """
00285 unpack serialized message in str into this message instance using numpy for array types
00286 :param str: byte array of serialized message, ``str``
00287 :param numpy: numpy python module
00288 """
00289 try:
00290 if self.header is None:
00291 self.header = std_msgs.msg.Header()
00292 if self.status is None:
00293 self.status = actionlib_msgs.msg.GoalStatus()
00294 if self.result is None:
00295 self.result = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorResult()
00296 end = 0
00297 _x = self
00298 start = end
00299 end += 12
00300 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 start = end
00305 end += length
00306 if python3:
00307 self.header.frame_id = str[start:end].decode('utf-8')
00308 else:
00309 self.header.frame_id = str[start:end]
00310 _x = self
00311 start = end
00312 end += 8
00313 (_x.status.goal_id.stamp.secs, _x.status.goal_id.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00314 start = end
00315 end += 4
00316 (length,) = _struct_I.unpack(str[start:end])
00317 start = end
00318 end += length
00319 if python3:
00320 self.status.goal_id.id = str[start:end].decode('utf-8')
00321 else:
00322 self.status.goal_id.id = str[start:end]
00323 start = end
00324 end += 1
00325 (self.status.status,) = _struct_B.unpack(str[start:end])
00326 start = end
00327 end += 4
00328 (length,) = _struct_I.unpack(str[start:end])
00329 start = end
00330 end += length
00331 if python3:
00332 self.status.text = str[start:end].decode('utf-8')
00333 else:
00334 self.status.text = str[start:end]
00335 _x = self
00336 start = end
00337 end += 11
00338 (_x.result.data.stamp.secs, _x.result.data.stamp.nsecs, _x.result.data.trigger_conditions_met, _x.result.data.slip_event, _x.result.data.acceleration_event,) = _struct_2I3B.unpack(str[start:end])
00339 self.result.data.trigger_conditions_met = bool(self.result.data.trigger_conditions_met)
00340 self.result.data.slip_event = bool(self.result.data.slip_event)
00341 self.result.data.acceleration_event = bool(self.result.data.acceleration_event)
00342 start = end
00343 end += 24
00344 self.result.data.acceleration_vector = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=3)
00345 return self
00346 except struct.error as e:
00347 raise genpy.DeserializationError(e)
00348
00349 _struct_I = genpy.struct_I
00350 _struct_3I = struct.Struct("<3I")
00351 _struct_B = struct.Struct("<B")
00352 _struct_2I3B = struct.Struct("<2I3B")
00353 _struct_2I = struct.Struct("<2I")
00354 _struct_3d = struct.Struct("<3d")