$search
00001 """autogenerated by genmsg_py from NodeState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslib.rostime 00006 00007 class NodeState(roslib.message.Message): 00008 _md5sum = "e804800bd2445ee0aec90cce0edc3d66" 00009 _type = "nodemon_msgs/NodeState" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """uint8 STARTING = 0 # node is currently started and not yet functional 00012 uint8 RUNNING = 1 # node is fully operational 00013 uint8 RECOVERING = 2 # node is recovering and currently not functional 00014 uint8 ERROR = 3 # node had an error and will try to recover 00015 uint8 FATAL = 4 # node had a fatal error and is disfunctional, restart req 00016 uint8 STOPPING = 5 # node is no longer functional and will soon exit 00017 uint8 WARNING = 6 # node encountered a problematic situation but continued 00018 00019 string nodename 00020 string package 00021 string nodetype 00022 time time 00023 uint8 state 00024 # A machine parseable error string 00025 string machine_message 00026 # A human readable error explanation 00027 string human_message 00028 00029 """ 00030 # Pseudo-constants 00031 STARTING = 0 00032 RUNNING = 1 00033 RECOVERING = 2 00034 ERROR = 3 00035 FATAL = 4 00036 STOPPING = 5 00037 WARNING = 6 00038 00039 __slots__ = ['nodename','package','nodetype','time','state','machine_message','human_message'] 00040 _slot_types = ['string','string','string','time','uint8','string','string'] 00041 00042 def __init__(self, *args, **kwds): 00043 """ 00044 Constructor. Any message fields that are implicitly/explicitly 00045 set to None will be assigned a default value. The recommend 00046 use is keyword arguments as this is more robust to future message 00047 changes. You cannot mix in-order arguments and keyword arguments. 00048 00049 The available fields are: 00050 nodename,package,nodetype,time,state,machine_message,human_message 00051 00052 @param args: complete set of field values, in .msg order 00053 @param kwds: use keyword arguments corresponding to message field names 00054 to set specific fields. 00055 """ 00056 if args or kwds: 00057 super(NodeState, self).__init__(*args, **kwds) 00058 #message fields cannot be None, assign default values for those that are 00059 if self.nodename is None: 00060 self.nodename = '' 00061 if self.package is None: 00062 self.package = '' 00063 if self.nodetype is None: 00064 self.nodetype = '' 00065 if self.time is None: 00066 self.time = roslib.rostime.Time() 00067 if self.state is None: 00068 self.state = 0 00069 if self.machine_message is None: 00070 self.machine_message = '' 00071 if self.human_message is None: 00072 self.human_message = '' 00073 else: 00074 self.nodename = '' 00075 self.package = '' 00076 self.nodetype = '' 00077 self.time = roslib.rostime.Time() 00078 self.state = 0 00079 self.machine_message = '' 00080 self.human_message = '' 00081 00082 def _get_types(self): 00083 """ 00084 internal API method 00085 """ 00086 return self._slot_types 00087 00088 def serialize(self, buff): 00089 """ 00090 serialize message into buffer 00091 @param buff: buffer 00092 @type buff: StringIO 00093 """ 00094 try: 00095 _x = self.nodename 00096 length = len(_x) 00097 buff.write(struct.pack('<I%ss'%length, length, _x)) 00098 _x = self.package 00099 length = len(_x) 00100 buff.write(struct.pack('<I%ss'%length, length, _x)) 00101 _x = self.nodetype 00102 length = len(_x) 00103 buff.write(struct.pack('<I%ss'%length, length, _x)) 00104 _x = self 00105 buff.write(_struct_2IB.pack(_x.time.secs, _x.time.nsecs, _x.state)) 00106 _x = self.machine_message 00107 length = len(_x) 00108 buff.write(struct.pack('<I%ss'%length, length, _x)) 00109 _x = self.human_message 00110 length = len(_x) 00111 buff.write(struct.pack('<I%ss'%length, length, _x)) 00112 except struct.error as se: self._check_types(se) 00113 except TypeError as te: self._check_types(te) 00114 00115 def deserialize(self, str): 00116 """ 00117 unpack serialized message in str into this message instance 00118 @param str: byte array of serialized message 00119 @type str: str 00120 """ 00121 try: 00122 if self.time is None: 00123 self.time = roslib.rostime.Time() 00124 end = 0 00125 start = end 00126 end += 4 00127 (length,) = _struct_I.unpack(str[start:end]) 00128 start = end 00129 end += length 00130 self.nodename = str[start:end] 00131 start = end 00132 end += 4 00133 (length,) = _struct_I.unpack(str[start:end]) 00134 start = end 00135 end += length 00136 self.package = str[start:end] 00137 start = end 00138 end += 4 00139 (length,) = _struct_I.unpack(str[start:end]) 00140 start = end 00141 end += length 00142 self.nodetype = str[start:end] 00143 _x = self 00144 start = end 00145 end += 9 00146 (_x.time.secs, _x.time.nsecs, _x.state,) = _struct_2IB.unpack(str[start:end]) 00147 start = end 00148 end += 4 00149 (length,) = _struct_I.unpack(str[start:end]) 00150 start = end 00151 end += length 00152 self.machine_message = str[start:end] 00153 start = end 00154 end += 4 00155 (length,) = _struct_I.unpack(str[start:end]) 00156 start = end 00157 end += length 00158 self.human_message = str[start:end] 00159 self.time.canon() 00160 return self 00161 except struct.error as e: 00162 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00163 00164 00165 def serialize_numpy(self, buff, numpy): 00166 """ 00167 serialize message with numpy array types into buffer 00168 @param buff: buffer 00169 @type buff: StringIO 00170 @param numpy: numpy python module 00171 @type numpy module 00172 """ 00173 try: 00174 _x = self.nodename 00175 length = len(_x) 00176 buff.write(struct.pack('<I%ss'%length, length, _x)) 00177 _x = self.package 00178 length = len(_x) 00179 buff.write(struct.pack('<I%ss'%length, length, _x)) 00180 _x = self.nodetype 00181 length = len(_x) 00182 buff.write(struct.pack('<I%ss'%length, length, _x)) 00183 _x = self 00184 buff.write(_struct_2IB.pack(_x.time.secs, _x.time.nsecs, _x.state)) 00185 _x = self.machine_message 00186 length = len(_x) 00187 buff.write(struct.pack('<I%ss'%length, length, _x)) 00188 _x = self.human_message 00189 length = len(_x) 00190 buff.write(struct.pack('<I%ss'%length, length, _x)) 00191 except struct.error as se: self._check_types(se) 00192 except TypeError as te: self._check_types(te) 00193 00194 def deserialize_numpy(self, str, numpy): 00195 """ 00196 unpack serialized message in str into this message instance using numpy for array types 00197 @param str: byte array of serialized message 00198 @type str: str 00199 @param numpy: numpy python module 00200 @type numpy: module 00201 """ 00202 try: 00203 if self.time is None: 00204 self.time = roslib.rostime.Time() 00205 end = 0 00206 start = end 00207 end += 4 00208 (length,) = _struct_I.unpack(str[start:end]) 00209 start = end 00210 end += length 00211 self.nodename = str[start:end] 00212 start = end 00213 end += 4 00214 (length,) = _struct_I.unpack(str[start:end]) 00215 start = end 00216 end += length 00217 self.package = str[start:end] 00218 start = end 00219 end += 4 00220 (length,) = _struct_I.unpack(str[start:end]) 00221 start = end 00222 end += length 00223 self.nodetype = str[start:end] 00224 _x = self 00225 start = end 00226 end += 9 00227 (_x.time.secs, _x.time.nsecs, _x.state,) = _struct_2IB.unpack(str[start:end]) 00228 start = end 00229 end += 4 00230 (length,) = _struct_I.unpack(str[start:end]) 00231 start = end 00232 end += length 00233 self.machine_message = str[start:end] 00234 start = end 00235 end += 4 00236 (length,) = _struct_I.unpack(str[start:end]) 00237 start = end 00238 end += length 00239 self.human_message = str[start:end] 00240 self.time.canon() 00241 return self 00242 except struct.error as e: 00243 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00244 00245 _struct_I = roslib.message.struct_I 00246 _struct_2IB = struct.Struct("<2IB")