00001 """autogenerated by genpy from pr2_msgs/GPUStatus.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class GPUStatus(genpy.Message):
00010 _md5sum = "4c74e5474b8aade04e56108262099c6e"
00011 _type = "pr2_msgs/GPUStatus"
00012 _has_header = True
00013 _full_text = """Header header
00014 string product_name
00015 string pci_device_id
00016 string pci_location
00017 string display
00018 string driver_version
00019 float32 temperature # Temperature in Celcius
00020 float32 fan_speed # Fan speed in rad/s
00021 float32 gpu_usage # Usage in percent
00022 float32 memory_usage # Usage in percent
00023 ================================================================================
00024 MSG: std_msgs/Header
00025 # Standard metadata for higher-level stamped data types.
00026 # This is generally used to communicate timestamped data
00027 # in a particular coordinate frame.
00028 #
00029 # sequence ID: consecutively increasing ID
00030 uint32 seq
00031 #Two-integer timestamp that is expressed as:
00032 # * stamp.secs: seconds (stamp_secs) since epoch
00033 # * stamp.nsecs: nanoseconds since stamp_secs
00034 # time-handling sugar is provided by the client library
00035 time stamp
00036 #Frame this data is associated with
00037 # 0: no frame
00038 # 1: global frame
00039 string frame_id
00040
00041 """
00042 __slots__ = ['header','product_name','pci_device_id','pci_location','display','driver_version','temperature','fan_speed','gpu_usage','memory_usage']
00043 _slot_types = ['std_msgs/Header','string','string','string','string','string','float32','float32','float32','float32']
00044
00045 def __init__(self, *args, **kwds):
00046 """
00047 Constructor. Any message fields that are implicitly/explicitly
00048 set to None will be assigned a default value. The recommend
00049 use is keyword arguments as this is more robust to future message
00050 changes. You cannot mix in-order arguments and keyword arguments.
00051
00052 The available fields are:
00053 header,product_name,pci_device_id,pci_location,display,driver_version,temperature,fan_speed,gpu_usage,memory_usage
00054
00055 :param args: complete set of field values, in .msg order
00056 :param kwds: use keyword arguments corresponding to message field names
00057 to set specific fields.
00058 """
00059 if args or kwds:
00060 super(GPUStatus, self).__init__(*args, **kwds)
00061
00062 if self.header is None:
00063 self.header = std_msgs.msg.Header()
00064 if self.product_name is None:
00065 self.product_name = ''
00066 if self.pci_device_id is None:
00067 self.pci_device_id = ''
00068 if self.pci_location is None:
00069 self.pci_location = ''
00070 if self.display is None:
00071 self.display = ''
00072 if self.driver_version is None:
00073 self.driver_version = ''
00074 if self.temperature is None:
00075 self.temperature = 0.
00076 if self.fan_speed is None:
00077 self.fan_speed = 0.
00078 if self.gpu_usage is None:
00079 self.gpu_usage = 0.
00080 if self.memory_usage is None:
00081 self.memory_usage = 0.
00082 else:
00083 self.header = std_msgs.msg.Header()
00084 self.product_name = ''
00085 self.pci_device_id = ''
00086 self.pci_location = ''
00087 self.display = ''
00088 self.driver_version = ''
00089 self.temperature = 0.
00090 self.fan_speed = 0.
00091 self.gpu_usage = 0.
00092 self.memory_usage = 0.
00093
00094 def _get_types(self):
00095 """
00096 internal API method
00097 """
00098 return self._slot_types
00099
00100 def serialize(self, buff):
00101 """
00102 serialize message into buffer
00103 :param buff: buffer, ``StringIO``
00104 """
00105 try:
00106 _x = self
00107 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00108 _x = self.header.frame_id
00109 length = len(_x)
00110 if python3 or type(_x) == unicode:
00111 _x = _x.encode('utf-8')
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 _x = self.product_name
00115 length = len(_x)
00116 if python3 or type(_x) == unicode:
00117 _x = _x.encode('utf-8')
00118 length = len(_x)
00119 buff.write(struct.pack('<I%ss'%length, length, _x))
00120 _x = self.pci_device_id
00121 length = len(_x)
00122 if python3 or type(_x) == unicode:
00123 _x = _x.encode('utf-8')
00124 length = len(_x)
00125 buff.write(struct.pack('<I%ss'%length, length, _x))
00126 _x = self.pci_location
00127 length = len(_x)
00128 if python3 or type(_x) == unicode:
00129 _x = _x.encode('utf-8')
00130 length = len(_x)
00131 buff.write(struct.pack('<I%ss'%length, length, _x))
00132 _x = self.display
00133 length = len(_x)
00134 if python3 or type(_x) == unicode:
00135 _x = _x.encode('utf-8')
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 _x = self.driver_version
00139 length = len(_x)
00140 if python3 or type(_x) == unicode:
00141 _x = _x.encode('utf-8')
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 _x = self
00145 buff.write(_struct_4f.pack(_x.temperature, _x.fan_speed, _x.gpu_usage, _x.memory_usage))
00146 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148
00149 def deserialize(self, str):
00150 """
00151 unpack serialized message in str into this message instance
00152 :param str: byte array of serialized message, ``str``
00153 """
00154 try:
00155 if self.header is None:
00156 self.header = std_msgs.msg.Header()
00157 end = 0
00158 _x = self
00159 start = end
00160 end += 12
00161 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 start = end
00166 end += length
00167 if python3:
00168 self.header.frame_id = str[start:end].decode('utf-8')
00169 else:
00170 self.header.frame_id = str[start:end]
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 if python3:
00177 self.product_name = str[start:end].decode('utf-8')
00178 else:
00179 self.product_name = str[start:end]
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 if python3:
00186 self.pci_device_id = str[start:end].decode('utf-8')
00187 else:
00188 self.pci_device_id = str[start:end]
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 start = end
00193 end += length
00194 if python3:
00195 self.pci_location = str[start:end].decode('utf-8')
00196 else:
00197 self.pci_location = str[start:end]
00198 start = end
00199 end += 4
00200 (length,) = _struct_I.unpack(str[start:end])
00201 start = end
00202 end += length
00203 if python3:
00204 self.display = str[start:end].decode('utf-8')
00205 else:
00206 self.display = str[start:end]
00207 start = end
00208 end += 4
00209 (length,) = _struct_I.unpack(str[start:end])
00210 start = end
00211 end += length
00212 if python3:
00213 self.driver_version = str[start:end].decode('utf-8')
00214 else:
00215 self.driver_version = str[start:end]
00216 _x = self
00217 start = end
00218 end += 16
00219 (_x.temperature, _x.fan_speed, _x.gpu_usage, _x.memory_usage,) = _struct_4f.unpack(str[start:end])
00220 return self
00221 except struct.error as e:
00222 raise genpy.DeserializationError(e)
00223
00224
00225 def serialize_numpy(self, buff, numpy):
00226 """
00227 serialize message with numpy array types into buffer
00228 :param buff: buffer, ``StringIO``
00229 :param numpy: numpy python module
00230 """
00231 try:
00232 _x = self
00233 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00234 _x = self.header.frame_id
00235 length = len(_x)
00236 if python3 or type(_x) == unicode:
00237 _x = _x.encode('utf-8')
00238 length = len(_x)
00239 buff.write(struct.pack('<I%ss'%length, length, _x))
00240 _x = self.product_name
00241 length = len(_x)
00242 if python3 or type(_x) == unicode:
00243 _x = _x.encode('utf-8')
00244 length = len(_x)
00245 buff.write(struct.pack('<I%ss'%length, length, _x))
00246 _x = self.pci_device_id
00247 length = len(_x)
00248 if python3 or type(_x) == unicode:
00249 _x = _x.encode('utf-8')
00250 length = len(_x)
00251 buff.write(struct.pack('<I%ss'%length, length, _x))
00252 _x = self.pci_location
00253 length = len(_x)
00254 if python3 or type(_x) == unicode:
00255 _x = _x.encode('utf-8')
00256 length = len(_x)
00257 buff.write(struct.pack('<I%ss'%length, length, _x))
00258 _x = self.display
00259 length = len(_x)
00260 if python3 or type(_x) == unicode:
00261 _x = _x.encode('utf-8')
00262 length = len(_x)
00263 buff.write(struct.pack('<I%ss'%length, length, _x))
00264 _x = self.driver_version
00265 length = len(_x)
00266 if python3 or type(_x) == unicode:
00267 _x = _x.encode('utf-8')
00268 length = len(_x)
00269 buff.write(struct.pack('<I%ss'%length, length, _x))
00270 _x = self
00271 buff.write(_struct_4f.pack(_x.temperature, _x.fan_speed, _x.gpu_usage, _x.memory_usage))
00272 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00273 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00274
00275 def deserialize_numpy(self, str, numpy):
00276 """
00277 unpack serialized message in str into this message instance using numpy for array types
00278 :param str: byte array of serialized message, ``str``
00279 :param numpy: numpy python module
00280 """
00281 try:
00282 if self.header is None:
00283 self.header = std_msgs.msg.Header()
00284 end = 0
00285 _x = self
00286 start = end
00287 end += 12
00288 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00289 start = end
00290 end += 4
00291 (length,) = _struct_I.unpack(str[start:end])
00292 start = end
00293 end += length
00294 if python3:
00295 self.header.frame_id = str[start:end].decode('utf-8')
00296 else:
00297 self.header.frame_id = str[start:end]
00298 start = end
00299 end += 4
00300 (length,) = _struct_I.unpack(str[start:end])
00301 start = end
00302 end += length
00303 if python3:
00304 self.product_name = str[start:end].decode('utf-8')
00305 else:
00306 self.product_name = str[start:end]
00307 start = end
00308 end += 4
00309 (length,) = _struct_I.unpack(str[start:end])
00310 start = end
00311 end += length
00312 if python3:
00313 self.pci_device_id = str[start:end].decode('utf-8')
00314 else:
00315 self.pci_device_id = str[start:end]
00316 start = end
00317 end += 4
00318 (length,) = _struct_I.unpack(str[start:end])
00319 start = end
00320 end += length
00321 if python3:
00322 self.pci_location = str[start:end].decode('utf-8')
00323 else:
00324 self.pci_location = str[start:end]
00325 start = end
00326 end += 4
00327 (length,) = _struct_I.unpack(str[start:end])
00328 start = end
00329 end += length
00330 if python3:
00331 self.display = str[start:end].decode('utf-8')
00332 else:
00333 self.display = str[start:end]
00334 start = end
00335 end += 4
00336 (length,) = _struct_I.unpack(str[start:end])
00337 start = end
00338 end += length
00339 if python3:
00340 self.driver_version = str[start:end].decode('utf-8')
00341 else:
00342 self.driver_version = str[start:end]
00343 _x = self
00344 start = end
00345 end += 16
00346 (_x.temperature, _x.fan_speed, _x.gpu_usage, _x.memory_usage,) = _struct_4f.unpack(str[start:end])
00347 return self
00348 except struct.error as e:
00349 raise genpy.DeserializationError(e)
00350
00351 _struct_I = genpy.struct_I
00352 _struct_4f = struct.Struct("<4f")
00353 _struct_3I = struct.Struct("<3I")