$search
00001 """autogenerated by genmsg_py from SystemStatus.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class SystemStatus(roslib.message.Message): 00008 _md5sum = "b24850c808eb727058fff35ba598006f" 00009 _type = "clearpath_base/SystemStatus" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 uint32 uptime 00013 float64[] voltages 00014 float64[] currents 00015 float64[] temperatures 00016 00017 ================================================================================ 00018 MSG: std_msgs/Header 00019 # Standard metadata for higher-level stamped data types. 00020 # This is generally used to communicate timestamped data 00021 # in a particular coordinate frame. 00022 # 00023 # sequence ID: consecutively increasing ID 00024 uint32 seq 00025 #Two-integer timestamp that is expressed as: 00026 # * stamp.secs: seconds (stamp_secs) since epoch 00027 # * stamp.nsecs: nanoseconds since stamp_secs 00028 # time-handling sugar is provided by the client library 00029 time stamp 00030 #Frame this data is associated with 00031 # 0: no frame 00032 # 1: global frame 00033 string frame_id 00034 00035 """ 00036 __slots__ = ['header','uptime','voltages','currents','temperatures'] 00037 _slot_types = ['Header','uint32','float64[]','float64[]','float64[]'] 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 header,uptime,voltages,currents,temperatures 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(SystemStatus, self).__init__(*args, **kwds) 00055 #message fields cannot be None, assign default values for those that are 00056 if self.header is None: 00057 self.header = std_msgs.msg._Header.Header() 00058 if self.uptime is None: 00059 self.uptime = 0 00060 if self.voltages is None: 00061 self.voltages = [] 00062 if self.currents is None: 00063 self.currents = [] 00064 if self.temperatures is None: 00065 self.temperatures = [] 00066 else: 00067 self.header = std_msgs.msg._Header.Header() 00068 self.uptime = 0 00069 self.voltages = [] 00070 self.currents = [] 00071 self.temperatures = [] 00072 00073 def _get_types(self): 00074 """ 00075 internal API method 00076 """ 00077 return self._slot_types 00078 00079 def serialize(self, buff): 00080 """ 00081 serialize message into buffer 00082 @param buff: buffer 00083 @type buff: StringIO 00084 """ 00085 try: 00086 _x = self 00087 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00088 _x = self.header.frame_id 00089 length = len(_x) 00090 buff.write(struct.pack('<I%ss'%length, length, _x)) 00091 buff.write(_struct_I.pack(self.uptime)) 00092 length = len(self.voltages) 00093 buff.write(_struct_I.pack(length)) 00094 pattern = '<%sd'%length 00095 buff.write(struct.pack(pattern, *self.voltages)) 00096 length = len(self.currents) 00097 buff.write(_struct_I.pack(length)) 00098 pattern = '<%sd'%length 00099 buff.write(struct.pack(pattern, *self.currents)) 00100 length = len(self.temperatures) 00101 buff.write(_struct_I.pack(length)) 00102 pattern = '<%sd'%length 00103 buff.write(struct.pack(pattern, *self.temperatures)) 00104 except struct.error as se: self._check_types(se) 00105 except TypeError as te: self._check_types(te) 00106 00107 def deserialize(self, str): 00108 """ 00109 unpack serialized message in str into this message instance 00110 @param str: byte array of serialized message 00111 @type str: str 00112 """ 00113 try: 00114 if self.header is None: 00115 self.header = std_msgs.msg._Header.Header() 00116 end = 0 00117 _x = self 00118 start = end 00119 end += 12 00120 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00121 start = end 00122 end += 4 00123 (length,) = _struct_I.unpack(str[start:end]) 00124 start = end 00125 end += length 00126 self.header.frame_id = str[start:end] 00127 start = end 00128 end += 4 00129 (self.uptime,) = _struct_I.unpack(str[start:end]) 00130 start = end 00131 end += 4 00132 (length,) = _struct_I.unpack(str[start:end]) 00133 pattern = '<%sd'%length 00134 start = end 00135 end += struct.calcsize(pattern) 00136 self.voltages = struct.unpack(pattern, str[start:end]) 00137 start = end 00138 end += 4 00139 (length,) = _struct_I.unpack(str[start:end]) 00140 pattern = '<%sd'%length 00141 start = end 00142 end += struct.calcsize(pattern) 00143 self.currents = struct.unpack(pattern, str[start:end]) 00144 start = end 00145 end += 4 00146 (length,) = _struct_I.unpack(str[start:end]) 00147 pattern = '<%sd'%length 00148 start = end 00149 end += struct.calcsize(pattern) 00150 self.temperatures = struct.unpack(pattern, str[start:end]) 00151 return self 00152 except struct.error as e: 00153 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00154 00155 00156 def serialize_numpy(self, buff, numpy): 00157 """ 00158 serialize message with numpy array types into buffer 00159 @param buff: buffer 00160 @type buff: StringIO 00161 @param numpy: numpy python module 00162 @type numpy module 00163 """ 00164 try: 00165 _x = self 00166 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00167 _x = self.header.frame_id 00168 length = len(_x) 00169 buff.write(struct.pack('<I%ss'%length, length, _x)) 00170 buff.write(_struct_I.pack(self.uptime)) 00171 length = len(self.voltages) 00172 buff.write(_struct_I.pack(length)) 00173 pattern = '<%sd'%length 00174 buff.write(self.voltages.tostring()) 00175 length = len(self.currents) 00176 buff.write(_struct_I.pack(length)) 00177 pattern = '<%sd'%length 00178 buff.write(self.currents.tostring()) 00179 length = len(self.temperatures) 00180 buff.write(_struct_I.pack(length)) 00181 pattern = '<%sd'%length 00182 buff.write(self.temperatures.tostring()) 00183 except struct.error as se: self._check_types(se) 00184 except TypeError as te: self._check_types(te) 00185 00186 def deserialize_numpy(self, str, numpy): 00187 """ 00188 unpack serialized message in str into this message instance using numpy for array types 00189 @param str: byte array of serialized message 00190 @type str: str 00191 @param numpy: numpy python module 00192 @type numpy: module 00193 """ 00194 try: 00195 if self.header is None: 00196 self.header = std_msgs.msg._Header.Header() 00197 end = 0 00198 _x = self 00199 start = end 00200 end += 12 00201 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00202 start = end 00203 end += 4 00204 (length,) = _struct_I.unpack(str[start:end]) 00205 start = end 00206 end += length 00207 self.header.frame_id = str[start:end] 00208 start = end 00209 end += 4 00210 (self.uptime,) = _struct_I.unpack(str[start:end]) 00211 start = end 00212 end += 4 00213 (length,) = _struct_I.unpack(str[start:end]) 00214 pattern = '<%sd'%length 00215 start = end 00216 end += struct.calcsize(pattern) 00217 self.voltages = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00218 start = end 00219 end += 4 00220 (length,) = _struct_I.unpack(str[start:end]) 00221 pattern = '<%sd'%length 00222 start = end 00223 end += struct.calcsize(pattern) 00224 self.currents = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00225 start = end 00226 end += 4 00227 (length,) = _struct_I.unpack(str[start:end]) 00228 pattern = '<%sd'%length 00229 start = end 00230 end += struct.calcsize(pattern) 00231 self.temperatures = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00232 return self 00233 except struct.error as e: 00234 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00235 00236 _struct_I = roslib.message.struct_I 00237 _struct_3I = struct.Struct("<3I")