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