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