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