00001 """autogenerated by genpy from pr2_mechanism_msgs/ControllerStatistics.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 genpy
00008
00009 class ControllerStatistics(genpy.Message):
00010 _md5sum = "6d15d137eea402018e3c7c8dbecd4b95"
00011 _type = "pr2_mechanism_msgs/ControllerStatistics"
00012 _has_header = False
00013 _full_text = """# This message contains the state of one realtime controller
00014 # that was spawned in pr2_mechanism_control
00015
00016 # the name of the controller
00017 string name
00018
00019 # the time at which these controller statistics were measured
00020 time timestamp
00021
00022 # bool that indicates if the controller is currently
00023 # in a running or a stopped state
00024 bool running
00025
00026 # the maximum time the update loop of the controller ever needed to complete
00027 duration max_time
00028
00029 # the average time the update loop of the controller needs to complete.
00030 # the average is computed in a sliding time window.
00031 duration mean_time
00032
00033 # the variance on the time the update loop of the controller needs to complete.
00034 # the variance applies to a sliding time window.
00035 duration variance_time
00036
00037 # the number of times this controller broke the realtime loop
00038 int32 num_control_loop_overruns
00039
00040 # the timestamp of the last time this controller broke the realtime loop
00041 time time_last_control_loop_overrun
00042 """
00043 __slots__ = ['name','timestamp','running','max_time','mean_time','variance_time','num_control_loop_overruns','time_last_control_loop_overrun']
00044 _slot_types = ['string','time','bool','duration','duration','duration','int32','time']
00045
00046 def __init__(self, *args, **kwds):
00047 """
00048 Constructor. Any message fields that are implicitly/explicitly
00049 set to None will be assigned a default value. The recommend
00050 use is keyword arguments as this is more robust to future message
00051 changes. You cannot mix in-order arguments and keyword arguments.
00052
00053 The available fields are:
00054 name,timestamp,running,max_time,mean_time,variance_time,num_control_loop_overruns,time_last_control_loop_overrun
00055
00056 :param args: complete set of field values, in .msg order
00057 :param kwds: use keyword arguments corresponding to message field names
00058 to set specific fields.
00059 """
00060 if args or kwds:
00061 super(ControllerStatistics, self).__init__(*args, **kwds)
00062
00063 if self.name is None:
00064 self.name = ''
00065 if self.timestamp is None:
00066 self.timestamp = genpy.Time()
00067 if self.running is None:
00068 self.running = False
00069 if self.max_time is None:
00070 self.max_time = genpy.Duration()
00071 if self.mean_time is None:
00072 self.mean_time = genpy.Duration()
00073 if self.variance_time is None:
00074 self.variance_time = genpy.Duration()
00075 if self.num_control_loop_overruns is None:
00076 self.num_control_loop_overruns = 0
00077 if self.time_last_control_loop_overrun is None:
00078 self.time_last_control_loop_overrun = genpy.Time()
00079 else:
00080 self.name = ''
00081 self.timestamp = genpy.Time()
00082 self.running = False
00083 self.max_time = genpy.Duration()
00084 self.mean_time = genpy.Duration()
00085 self.variance_time = genpy.Duration()
00086 self.num_control_loop_overruns = 0
00087 self.time_last_control_loop_overrun = genpy.Time()
00088
00089 def _get_types(self):
00090 """
00091 internal API method
00092 """
00093 return self._slot_types
00094
00095 def serialize(self, buff):
00096 """
00097 serialize message into buffer
00098 :param buff: buffer, ``StringIO``
00099 """
00100 try:
00101 _x = self.name
00102 length = len(_x)
00103 if python3 or type(_x) == unicode:
00104 _x = _x.encode('utf-8')
00105 length = len(_x)
00106 buff.write(struct.pack('<I%ss'%length, length, _x))
00107 _x = self
00108 buff.write(_struct_2IB7i2I.pack(_x.timestamp.secs, _x.timestamp.nsecs, _x.running, _x.max_time.secs, _x.max_time.nsecs, _x.mean_time.secs, _x.mean_time.nsecs, _x.variance_time.secs, _x.variance_time.nsecs, _x.num_control_loop_overruns, _x.time_last_control_loop_overrun.secs, _x.time_last_control_loop_overrun.nsecs))
00109 except struct.error as se: self._check_types(se)
00110 except TypeError as te: self._check_types(te)
00111
00112 def deserialize(self, str):
00113 """
00114 unpack serialized message in str into this message instance
00115 :param str: byte array of serialized message, ``str``
00116 """
00117 try:
00118 if self.timestamp is None:
00119 self.timestamp = genpy.Time()
00120 if self.max_time is None:
00121 self.max_time = genpy.Duration()
00122 if self.mean_time is None:
00123 self.mean_time = genpy.Duration()
00124 if self.variance_time is None:
00125 self.variance_time = genpy.Duration()
00126 if self.time_last_control_loop_overrun is None:
00127 self.time_last_control_loop_overrun = genpy.Time()
00128 end = 0
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 if python3:
00135 self.name = str[start:end].decode('utf-8')
00136 else:
00137 self.name = str[start:end]
00138 _x = self
00139 start = end
00140 end += 45
00141 (_x.timestamp.secs, _x.timestamp.nsecs, _x.running, _x.max_time.secs, _x.max_time.nsecs, _x.mean_time.secs, _x.mean_time.nsecs, _x.variance_time.secs, _x.variance_time.nsecs, _x.num_control_loop_overruns, _x.time_last_control_loop_overrun.secs, _x.time_last_control_loop_overrun.nsecs,) = _struct_2IB7i2I.unpack(str[start:end])
00142 self.running = bool(self.running)
00143 self.timestamp.canon()
00144 self.max_time.canon()
00145 self.mean_time.canon()
00146 self.variance_time.canon()
00147 self.time_last_control_loop_overrun.canon()
00148 return self
00149 except struct.error as e:
00150 raise genpy.DeserializationError(e)
00151
00152
00153 def serialize_numpy(self, buff, numpy):
00154 """
00155 serialize message with numpy array types into buffer
00156 :param buff: buffer, ``StringIO``
00157 :param numpy: numpy python module
00158 """
00159 try:
00160 _x = self.name
00161 length = len(_x)
00162 if python3 or type(_x) == unicode:
00163 _x = _x.encode('utf-8')
00164 length = len(_x)
00165 buff.write(struct.pack('<I%ss'%length, length, _x))
00166 _x = self
00167 buff.write(_struct_2IB7i2I.pack(_x.timestamp.secs, _x.timestamp.nsecs, _x.running, _x.max_time.secs, _x.max_time.nsecs, _x.mean_time.secs, _x.mean_time.nsecs, _x.variance_time.secs, _x.variance_time.nsecs, _x.num_control_loop_overruns, _x.time_last_control_loop_overrun.secs, _x.time_last_control_loop_overrun.nsecs))
00168 except struct.error as se: self._check_types(se)
00169 except TypeError as te: self._check_types(te)
00170
00171 def deserialize_numpy(self, str, numpy):
00172 """
00173 unpack serialized message in str into this message instance using numpy for array types
00174 :param str: byte array of serialized message, ``str``
00175 :param numpy: numpy python module
00176 """
00177 try:
00178 if self.timestamp is None:
00179 self.timestamp = genpy.Time()
00180 if self.max_time is None:
00181 self.max_time = genpy.Duration()
00182 if self.mean_time is None:
00183 self.mean_time = genpy.Duration()
00184 if self.variance_time is None:
00185 self.variance_time = genpy.Duration()
00186 if self.time_last_control_loop_overrun is None:
00187 self.time_last_control_loop_overrun = genpy.Time()
00188 end = 0
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.name = str[start:end].decode('utf-8')
00196 else:
00197 self.name = str[start:end]
00198 _x = self
00199 start = end
00200 end += 45
00201 (_x.timestamp.secs, _x.timestamp.nsecs, _x.running, _x.max_time.secs, _x.max_time.nsecs, _x.mean_time.secs, _x.mean_time.nsecs, _x.variance_time.secs, _x.variance_time.nsecs, _x.num_control_loop_overruns, _x.time_last_control_loop_overrun.secs, _x.time_last_control_loop_overrun.nsecs,) = _struct_2IB7i2I.unpack(str[start:end])
00202 self.running = bool(self.running)
00203 self.timestamp.canon()
00204 self.max_time.canon()
00205 self.mean_time.canon()
00206 self.variance_time.canon()
00207 self.time_last_control_loop_overrun.canon()
00208 return self
00209 except struct.error as e:
00210 raise genpy.DeserializationError(e)
00211
00212 _struct_I = genpy.struct_I
00213 _struct_2IB7i2I = struct.Struct("<2IB7i2I")