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