_RIQHandState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from riq_msgs/RIQHandState.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 riq_msgs.msg
00008 
00009 class RIQHandState(genpy.Message):
00010   _md5sum = "3ab70f8c0e9b67b0db99e45af2360afc"
00011   _type = "riq_msgs/RIQHandState"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# ROS state information from RobotIQ hand
00014 
00015 # Action status
00016 int8 FAULTED              = 0
00017 int8 IN_PROGRESS          = 1
00018 int8 ILLEGAL_OR_UNDEFINED = 2
00019 int8 SUCCESSFUL           = 3
00020 
00021 # Mode constants
00022 int8 CYLINDRICAL = 0
00023 int8 PINCH       = 1
00024 int8 SPHERIOD    = 2
00025 int8 SCISSORS    = 3
00026 
00027 # Grip
00028 int8 STOPPED   = 0
00029 int8 OPENED    = 1
00030 int8 CLOSED    = 2
00031 int8 INITIALIZING_OR_CHANGING = 3
00032 
00033 # Object detection status
00034 int8 NOT_DETECTED         = 0
00035 int8 DETECTED_1_FINGER    = 1
00036 int8 DETECTED_2_FINGERS   = 2
00037 int8 DETECTED_ALL_FINGERS = 3
00038 
00039 
00040 bool    operational  # True when RIQ hand is operational, 
00041                      # False if there is an error, or hand has not been initialized
00042 
00043 int8    status       # Result of last requested action
00044                      #  SUCCESSFULL, FAULTED, IN_PROGRESS, ILLEGAL_OR_UNDEFINED
00045 
00046 int8    mode         # Mode gripper is curretly in:     
00047                      #  PINCH, CYLINDRICAL, SPHERIOD, SCISSORS 
00048 
00049 int8    grip         # Grip
00050                      #  CLOSED, OPEN, STOPPED, INTIALIZING_OR_CHANGING
00051 
00052 int8    object       # Object detection
00053                      #  NOT_DETECTED, DETECTED_1_FINGER, DETECTED_2_FINGERS, DETECTED_ALL_FINGERS
00054 
00055 RIQActuatorState thumb
00056 RIQActuatorState right_finger
00057 RIQActuatorState left_finger
00058 RIQActuatorState scissors      # Scissors is joint motor between right and left finger
00059 ================================================================================
00060 MSG: riq_msgs/RIQActuatorState
00061 # ROS state information for RobotIQ actuator.
00062 
00063 # Measured motor current (in Amps)
00064 float64 current
00065 
00066 # Motor position range from (0.0 to 1.0)
00067 float64 position
00068 
00069 # True when finger / actuator detected an object
00070 bool object_detected
00071 """
00072   # Pseudo-constants
00073   FAULTED = 0
00074   IN_PROGRESS = 1
00075   ILLEGAL_OR_UNDEFINED = 2
00076   SUCCESSFUL = 3
00077   CYLINDRICAL = 0
00078   PINCH = 1
00079   SPHERIOD = 2
00080   SCISSORS = 3
00081   STOPPED = 0
00082   OPENED = 1
00083   CLOSED = 2
00084   INITIALIZING_OR_CHANGING = 3
00085   NOT_DETECTED = 0
00086   DETECTED_1_FINGER = 1
00087   DETECTED_2_FINGERS = 2
00088   DETECTED_ALL_FINGERS = 3
00089 
00090   __slots__ = ['operational','status','mode','grip','object','thumb','right_finger','left_finger','scissors']
00091   _slot_types = ['bool','int8','int8','int8','int8','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState','riq_msgs/RIQActuatorState']
00092 
00093   def __init__(self, *args, **kwds):
00094     """
00095     Constructor. Any message fields that are implicitly/explicitly
00096     set to None will be assigned a default value. The recommend
00097     use is keyword arguments as this is more robust to future message
00098     changes.  You cannot mix in-order arguments and keyword arguments.
00099 
00100     The available fields are:
00101        operational,status,mode,grip,object,thumb,right_finger,left_finger,scissors
00102 
00103     :param args: complete set of field values, in .msg order
00104     :param kwds: use keyword arguments corresponding to message field names
00105     to set specific fields.
00106     """
00107     if args or kwds:
00108       super(RIQHandState, self).__init__(*args, **kwds)
00109       #message fields cannot be None, assign default values for those that are
00110       if self.operational is None:
00111         self.operational = False
00112       if self.status is None:
00113         self.status = 0
00114       if self.mode is None:
00115         self.mode = 0
00116       if self.grip is None:
00117         self.grip = 0
00118       if self.object is None:
00119         self.object = 0
00120       if self.thumb is None:
00121         self.thumb = riq_msgs.msg.RIQActuatorState()
00122       if self.right_finger is None:
00123         self.right_finger = riq_msgs.msg.RIQActuatorState()
00124       if self.left_finger is None:
00125         self.left_finger = riq_msgs.msg.RIQActuatorState()
00126       if self.scissors is None:
00127         self.scissors = riq_msgs.msg.RIQActuatorState()
00128     else:
00129       self.operational = False
00130       self.status = 0
00131       self.mode = 0
00132       self.grip = 0
00133       self.object = 0
00134       self.thumb = riq_msgs.msg.RIQActuatorState()
00135       self.right_finger = riq_msgs.msg.RIQActuatorState()
00136       self.left_finger = riq_msgs.msg.RIQActuatorState()
00137       self.scissors = riq_msgs.msg.RIQActuatorState()
00138 
00139   def _get_types(self):
00140     """
00141     internal API method
00142     """
00143     return self._slot_types
00144 
00145   def serialize(self, buff):
00146     """
00147     serialize message into buffer
00148     :param buff: buffer, ``StringIO``
00149     """
00150     try:
00151       _x = self
00152       buff.write(_struct_B4b2dB2dB2dB2dB.pack(_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected))
00153     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00154     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00155 
00156   def deserialize(self, str):
00157     """
00158     unpack serialized message in str into this message instance
00159     :param str: byte array of serialized message, ``str``
00160     """
00161     try:
00162       if self.thumb is None:
00163         self.thumb = riq_msgs.msg.RIQActuatorState()
00164       if self.right_finger is None:
00165         self.right_finger = riq_msgs.msg.RIQActuatorState()
00166       if self.left_finger is None:
00167         self.left_finger = riq_msgs.msg.RIQActuatorState()
00168       if self.scissors is None:
00169         self.scissors = riq_msgs.msg.RIQActuatorState()
00170       end = 0
00171       _x = self
00172       start = end
00173       end += 73
00174       (_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected,) = _struct_B4b2dB2dB2dB2dB.unpack(str[start:end])
00175       self.operational = bool(self.operational)
00176       self.thumb.object_detected = bool(self.thumb.object_detected)
00177       self.right_finger.object_detected = bool(self.right_finger.object_detected)
00178       self.left_finger.object_detected = bool(self.left_finger.object_detected)
00179       self.scissors.object_detected = bool(self.scissors.object_detected)
00180       return self
00181     except struct.error as e:
00182       raise genpy.DeserializationError(e) #most likely buffer underfill
00183 
00184 
00185   def serialize_numpy(self, buff, numpy):
00186     """
00187     serialize message with numpy array types into buffer
00188     :param buff: buffer, ``StringIO``
00189     :param numpy: numpy python module
00190     """
00191     try:
00192       _x = self
00193       buff.write(_struct_B4b2dB2dB2dB2dB.pack(_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected))
00194     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00195     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00196 
00197   def deserialize_numpy(self, str, numpy):
00198     """
00199     unpack serialized message in str into this message instance using numpy for array types
00200     :param str: byte array of serialized message, ``str``
00201     :param numpy: numpy python module
00202     """
00203     try:
00204       if self.thumb is None:
00205         self.thumb = riq_msgs.msg.RIQActuatorState()
00206       if self.right_finger is None:
00207         self.right_finger = riq_msgs.msg.RIQActuatorState()
00208       if self.left_finger is None:
00209         self.left_finger = riq_msgs.msg.RIQActuatorState()
00210       if self.scissors is None:
00211         self.scissors = riq_msgs.msg.RIQActuatorState()
00212       end = 0
00213       _x = self
00214       start = end
00215       end += 73
00216       (_x.operational, _x.status, _x.mode, _x.grip, _x.object, _x.thumb.current, _x.thumb.position, _x.thumb.object_detected, _x.right_finger.current, _x.right_finger.position, _x.right_finger.object_detected, _x.left_finger.current, _x.left_finger.position, _x.left_finger.object_detected, _x.scissors.current, _x.scissors.position, _x.scissors.object_detected,) = _struct_B4b2dB2dB2dB2dB.unpack(str[start:end])
00217       self.operational = bool(self.operational)
00218       self.thumb.object_detected = bool(self.thumb.object_detected)
00219       self.right_finger.object_detected = bool(self.right_finger.object_detected)
00220       self.left_finger.object_detected = bool(self.left_finger.object_detected)
00221       self.scissors.object_detected = bool(self.scissors.object_detected)
00222       return self
00223     except struct.error as e:
00224       raise genpy.DeserializationError(e) #most likely buffer underfill
00225 
00226 _struct_I = genpy.struct_I
00227 _struct_B4b2dB2dB2dB2dB = struct.Struct("<B4b2dB2dB2dB2dB")


riq_msgs
Author(s): Derek King
autogenerated on Tue Apr 22 2014 19:42:39