/** * Copy Constructor. Useful when returning a ClassicTrainingVectors Class. * Parameter: op1 ClassicTrainingVectors */ ClassicTrainingVectors::ClassicTrainingVectors(const ClassicTrainingVectors &op1) { calibrated(op1.calibrated()); for (size_t i = 0; i < op1.size(); i++) if (calibrated()) add(op1.itemAt(i), op1.targetAt(i)); else add(op1.itemAt(i)); normalized = op1.normalized; varStats = op1.varStats; }
void ConnectDialog::performCalibration() { if(ui->kinect->getStatus() != SystemStateReady) return; if(kinect->isCalibrated()) { greenScreen->close(); delete greenScreen; greenScreen = nullptr; ui->calibration->setStatus(SystemStateReady); } else if(greenScreen == nullptr) { QPixmap pixmap(5000, 5000); pixmap.fill(QColor("#09741b")); greenScreen = new QSplashScreen(pixmap); greenScreen->showFullScreen(); greenScreen->setFont(QFont("Helvetica neue", 35)); greenScreen->showMessage(tr("Calibration in progess..."), Qt::AlignCenter); greenScreen->raise(); kinect->calibrate(); } connect(kinect, SIGNAL(calibrated()), this, SLOT(performCalibration())); checkAndClose(); }
WiimoteManager::WiimoteManager(QObject *parent) : QObject(parent), wiimote(new Wiimote(this)) { worker = new CWiidConnectionWorker(); thread = new QThread(this); worker->moveToThread(thread); thread->start(); connect(worker, SIGNAL(wiimoteMessage(WiimoteMessage)), wiimote, SLOT(motionPlusEvent(WiimoteMessage))); connect(worker, SIGNAL(connected()), this, SIGNAL(connected())); connect(worker, SIGNAL(disconnected()), this, SIGNAL(disconnected())); connect(worker, SIGNAL(deviceMessage(QString,int)), this, SIGNAL(deviceMessage(QString,int))); connect(wiimote, SIGNAL(angleChanged(Angles<BigDecimal>)), this, SIGNAL(angleChanged(Angles<BigDecimal>))); connect(wiimote, SIGNAL(deltaChanged(Angles<BigDecimal>)), this, SIGNAL(deltaChanged(Angles<BigDecimal>))); connect(wiimote, SIGNAL(calibrationStep(int)), this, SIGNAL(calibrationStep(int))); connect(wiimote, SIGNAL(calibrated()), this, SIGNAL(calibrated())); connect(wiimote, SIGNAL(needsCalibration()), this, SIGNAL(needsCalibration())); }
void IRScoreGate::calibrate() { if(_firstRun){ _firstRun = false; _millisSinceStart = millis(); } if((millis()-_millisSinceStart) <= 2000ul){ calibrating(); }else{ calibrated(); } }
/** * Returns a const target of a code vector given its position * Parameter: _pos The position of the code vector */ const Label& FuzzyMap::targetAtPos(const SomPos& _pos) const { if (!calibrated()) { std::ostringstream msg; msg << "The S.O.M. is not calibrated. No target at position (" << _pos.first << ", " << _pos.second << ")"; throw std::out_of_range(msg.str()); } if (_pos.first >= (signed)somWidth || _pos.second >= (signed)somHeight) { std::ostringstream msg; msg << "Out of range. No target at position (" << _pos.first << ", " << _pos.second << ")"; throw std::out_of_range(msg.str()); } return targetAt((somWidth * _pos.second) + _pos.first); }
void Gyroscope::calibrateStep() { // Don't continue to average if acceptable offsets have already been computed. if (calibrated()) { return; } GyroscopeReading reading = readGyro(); for (std::size_t i = 0; i < 3; i++) { offsets[i] = (offsets[i] * calibrationCount + reading.axes[i]) / (calibrationCount + 1); } calibrationCount++; if (std::abs(reading.axes[0] > 0.1) || std::abs(reading.axes[1] > 0.1) || std::abs(reading.axes[2] > 0.1)) { calibrationCount = 0; } }