20 | 21 | ||
---|---|---|---|
82 | #self.data is the result of integration (here, axis + angle) | 82 | #self.data is the result of integration (here, axis + angle) |
83 | 83 | ||
84 | if self.last_input_data: | 84 | if self.last_input_data: |
85 | 85 | interval_duration = data.time_this_report - self.last_input_data.time_this_report | |
86 | interval_duration = self.last_input_data.time_this_report - data.time_this_report | ||
87 | 86 | ||
88 | dt = float(interval_duration.microseconds)/1000000.0 | 87 | dt = float(interval_duration.microseconds)/1000000.0 |
88 | print data.time_this_report, dt , data.gyros | ||
89 | 89 | ||
90 | |||
90 | rotation_values = [0]*3 | 91 | rotation_values = [0]*3 |
91 | for c in range(3): | 92 | for c in range(3): |
92 | val = data.gyros[c] | 93 | val = data.gyros[c] |
... | ... | ||
185 | 186 | ||
186 | def finish_calibration(self): | 187 | def finish_calibration(self): |
187 | self.do_process = self.interpret | 188 | self.do_process = self.interpret |
188 | nb = self.nb_samples | 189 | nb = self.nb_samples + 1 |
189 | self.wmp_offsets = [ float(c)/nb for c in self.wmp_offsets ] | 190 | self.wmp_offsets = [ float(c)/nb for c in self.wmp_offsets ] |
190 | print "Calibration of Wmp finished :", self.wmp_offsets | 191 | print "Calibration of Wmp finished :", self.wmp_offsets |
191 | 192 | ||
... | ... | ||
221 | values[c] = (raw[c] - offsets[c]) / coeff | 222 | values[c] = (raw[c] - offsets[c]) / coeff |
222 | if fast[c]: | 223 | if fast[c]: |
223 | values[c] = values[c] * self.wmp_amplification_coef | 224 | values[c] = values[c] * self.wmp_amplification_coef |
225 | self.data.time_this_report = data.time_this_report | ||
224 | self.raise_processed() | 226 | self.raise_processed() |
225 | 227 | ||
226 | 228 |