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