$search
00001 """autogenerated by genmsg_py from RIQHandCommand.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class RIQHandCommand(roslib.message.Message): 00007 _md5sum = "1ea172a0fa98ff8b257948fc31b156cd" 00008 _type = "riq_msgs/RIQHandCommand" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# ROS command message from RobotIQ hand 00011 00012 # mode constants 00013 int8 CYLINDRICAL = 0 00014 int8 PINCH = 1 00015 int8 SPHERIOD = 2 00016 int8 SCISSORS = 3 00017 00018 # action constants 00019 int8 STOP = 0 00020 int8 CLOSE = 1 00021 int8 OPEN = 2 00022 00023 00024 int8 mode # PINCH, CYLINDRICAL, SPHERIOD, SCISSORS 00025 int8 action # CLOSE, OPEN, STOP 00026 float64 velocity # Speed value goes from 0.0 to 1.0 00027 float64 force # Force value goes from 0.0 to 1.0 00028 """ 00029 # Pseudo-constants 00030 CYLINDRICAL = 0 00031 PINCH = 1 00032 SPHERIOD = 2 00033 SCISSORS = 3 00034 STOP = 0 00035 CLOSE = 1 00036 OPEN = 2 00037 00038 __slots__ = ['mode','action','velocity','force'] 00039 _slot_types = ['int8','int8','float64','float64'] 00040 00041 def __init__(self, *args, **kwds): 00042 """ 00043 Constructor. Any message fields that are implicitly/explicitly 00044 set to None will be assigned a default value. The recommend 00045 use is keyword arguments as this is more robust to future message 00046 changes. You cannot mix in-order arguments and keyword arguments. 00047 00048 The available fields are: 00049 mode,action,velocity,force 00050 00051 @param args: complete set of field values, in .msg order 00052 @param kwds: use keyword arguments corresponding to message field names 00053 to set specific fields. 00054 """ 00055 if args or kwds: 00056 super(RIQHandCommand, self).__init__(*args, **kwds) 00057 #message fields cannot be None, assign default values for those that are 00058 if self.mode is None: 00059 self.mode = 0 00060 if self.action is None: 00061 self.action = 0 00062 if self.velocity is None: 00063 self.velocity = 0. 00064 if self.force is None: 00065 self.force = 0. 00066 else: 00067 self.mode = 0 00068 self.action = 0 00069 self.velocity = 0. 00070 self.force = 0. 00071 00072 def _get_types(self): 00073 """ 00074 internal API method 00075 """ 00076 return self._slot_types 00077 00078 def serialize(self, buff): 00079 """ 00080 serialize message into buffer 00081 @param buff: buffer 00082 @type buff: StringIO 00083 """ 00084 try: 00085 _x = self 00086 buff.write(_struct_2b2d.pack(_x.mode, _x.action, _x.velocity, _x.force)) 00087 except struct.error as se: self._check_types(se) 00088 except TypeError as te: self._check_types(te) 00089 00090 def deserialize(self, str): 00091 """ 00092 unpack serialized message in str into this message instance 00093 @param str: byte array of serialized message 00094 @type str: str 00095 """ 00096 try: 00097 end = 0 00098 _x = self 00099 start = end 00100 end += 18 00101 (_x.mode, _x.action, _x.velocity, _x.force,) = _struct_2b2d.unpack(str[start:end]) 00102 return self 00103 except struct.error as e: 00104 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00105 00106 00107 def serialize_numpy(self, buff, numpy): 00108 """ 00109 serialize message with numpy array types into buffer 00110 @param buff: buffer 00111 @type buff: StringIO 00112 @param numpy: numpy python module 00113 @type numpy module 00114 """ 00115 try: 00116 _x = self 00117 buff.write(_struct_2b2d.pack(_x.mode, _x.action, _x.velocity, _x.force)) 00118 except struct.error as se: self._check_types(se) 00119 except TypeError as te: self._check_types(te) 00120 00121 def deserialize_numpy(self, str, numpy): 00122 """ 00123 unpack serialized message in str into this message instance using numpy for array types 00124 @param str: byte array of serialized message 00125 @type str: str 00126 @param numpy: numpy python module 00127 @type numpy: module 00128 """ 00129 try: 00130 end = 0 00131 _x = self 00132 start = end 00133 end += 18 00134 (_x.mode, _x.action, _x.velocity, _x.force,) = _struct_2b2d.unpack(str[start:end]) 00135 return self 00136 except struct.error as e: 00137 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00138 00139 _struct_I = roslib.message.struct_I 00140 _struct_2b2d = struct.Struct("<2b2d")