Exemple #1
0
void Client::setPermission(bool permission)
{
  m_trackingPermitted = permission;
  if ((permission) && (!isTracking()))
    startTrack();
  else
  if ((!permission) && (isTracking()))
    stopTrack();
}
Exemple #2
0
void Tracker::onAdvertisement(ble_gap_evt_adv_report_t* p_adv_report) {
//	if (isTracking()) {
		if (isTracking() && _trackedDeviceList != NULL) {
			_trackedDeviceList->update(p_adv_report->peer_addr.addr, p_adv_report->rssi);
		}
//	}
}
void
ValControlSegment::MouseMoved(BPoint point, uint32 transit,
	const BMessage* dragMessage)
{
	if (!parent()->IsEnabled())
		return;

	if (!isTracking() || fPrevPoint == point)
		return;

	// float fXDelta = fTrackFlags & TRACK_HORIZONTAL ?
	// point.x - fPrevPoint.x : 0.0;
	float fYDelta = fTrackFlags & TRACK_VERTICAL ?
		point.y - fPrevPoint.y : 0.0;

	// printf("MouseMoved(): %2f,%2f\n",
	// fXDelta, fYDelta);

	
	// hand off
	// +++++ config'able x/y response would be nice...
	float fRemaining = handleDragUpdate(fYDelta);
	
	fPrevPoint = point;
	fPrevPoint.y -= fRemaining;
}
Exemple #4
0
bool VisuoThread::checkTracker(Vector *vec)
{
    bool track=false;

    trackBuffer.push_back(*vec);
    
    if(isTracking() && trackBuffer.size()>minTrackBufSize)
    {
        double speed_avg[2];
        double speed_std[2];
        speed_avg[LEFT]=speed_avg[RIGHT]=0.0;
        speed_std[LEFT]=speed_std[RIGHT]=0.0;

        for(unsigned int i=1; i<trackBuffer.size(); i++)
        {
            double speed[2];
            speed[LEFT]=(trackBuffer[i-1][0]-trackBuffer[i][0])*(trackBuffer[i-1][0]-trackBuffer[i][0])+
                        (trackBuffer[i-1][1]-trackBuffer[i][1])*(trackBuffer[i-1][1]-trackBuffer[i][1]);
            speed_avg[LEFT]+=sqrt(speed[LEFT]);
            speed_std[LEFT]+=speed[LEFT];

            speed[RIGHT]=(trackBuffer[i-1][0]-trackBuffer[i][0])*(trackBuffer[i-1][0]-trackBuffer[i][0])+
                        (trackBuffer[i-1][1]-trackBuffer[i][1])*(trackBuffer[i-1][1]-trackBuffer[i][1]);
            speed_avg[RIGHT]+=sqrt(speed[RIGHT]);
            speed_std[RIGHT]+=speed[RIGHT];
        }

        double n=1.0/(trackBuffer.size()-1);
        speed_avg[LEFT]*=n;
        speed_std[LEFT]=n*speed_std[LEFT]-speed_avg[LEFT]*speed_avg[LEFT];
        speed_avg[RIGHT]*=n;
        speed_std[RIGHT]=n*speed_std[RIGHT]-speed_avg[RIGHT]*speed_avg[RIGHT];

        track=true;

        // check that the speeds are not varying too much
        if(speed_avg[LEFT]>speedStdThresh || speed_avg[RIGHT]>speedStdThresh)
        {
            track=false;
        }

        double dist=(trackBuffer.back()[0]-trackBuffer.back()[6])*(trackBuffer.back()[0]-trackBuffer.back()[6])+
                    (trackBuffer.back()[1]-trackBuffer.back()[7])*(trackBuffer.back()[1]-trackBuffer.back()[7]);

        // avoid strabicity
        if(sqrt(dist)>stereoDistThresh)
        {
            track=false;
        }
        // check that both images are tracking similar things


    }
        
    
    while(trackBuffer.size()>maxTrackBufSize)
        trackBuffer.pop_front();

    return track;
}
void
ValControlSegment::MouseUp(BPoint point)
{
	if (isTracking()) {
		setTracking(false);
		mouseReleased();
	}
}	
Exemple #6
0
void TimeTrackingView::mousePressEvent( QMouseEvent* event )
{
    if ( ! isTracking() ) {
        const int position = getSummaryAt( event->pos() );
        if ( position >= 0 && position < m_summaries.size() ) {
            m_taskSelector->taskSelected( m_summaries.at( position ) );
        }
    }
}
int QwtAbstractSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractScale::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 5)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< double*>(_v) = value(); break;
        case 1: *reinterpret_cast< uint*>(_v) = totalSteps(); break;
        case 2: *reinterpret_cast< uint*>(_v) = singleSteps(); break;
        case 3: *reinterpret_cast< uint*>(_v) = pageSteps(); break;
        case 4: *reinterpret_cast< bool*>(_v) = stepAlignment(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isTracking(); break;
        case 7: *reinterpret_cast< bool*>(_v) = wrapping(); break;
        case 8: *reinterpret_cast< bool*>(_v) = invertedControls(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setValue(*reinterpret_cast< double*>(_v)); break;
        case 1: setTotalSteps(*reinterpret_cast< uint*>(_v)); break;
        case 2: setSingleSteps(*reinterpret_cast< uint*>(_v)); break;
        case 3: setPageSteps(*reinterpret_cast< uint*>(_v)); break;
        case 4: setStepAlignment(*reinterpret_cast< bool*>(_v)); break;
        case 5: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 6: setTracking(*reinterpret_cast< bool*>(_v)); break;
        case 7: setWrapping(*reinterpret_cast< bool*>(_v)); break;
        case 8: setInvertedControls(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #8
0
/*!
   Mouse press event handler
   \param event Mouse event
*/
void QwtSlider::mousePressEvent( QMouseEvent *event )
{
    if ( isReadOnly() )
    {
        event->ignore();
        return;
    }

    const QPoint pos = event->pos();

    if ( isValid() && d_data->sliderRect.contains( pos ) )
    {
        if ( !handleRect().contains( pos ) )
        {
            const int markerPos = transform( value() );

            d_data->stepsIncrement = pageSteps();

            if ( d_data->orientation == Qt::Horizontal )
            {
                if ( pos.x() < markerPos )
                    d_data->stepsIncrement = -d_data->stepsIncrement;
            }
            else
            {
                if ( pos.y() < markerPos )
                    d_data->stepsIncrement = -d_data->stepsIncrement;
            }

            if ( isInverted() )
                d_data->stepsIncrement = -d_data->stepsIncrement;

            const double v = value();
            incrementValue( d_data->stepsIncrement );

            if ( v != value() )
            {
                if ( isTracking() )
                    Q_EMIT valueChanged( value() );
                else
                    d_data->pendingValueChange = true;

                Q_EMIT sliderMoved( value() );
            }

            d_data->timerTick = false;
            d_data->repeatTimerId = startTimer( qMax( 250, 2 * updateInterval() ) );

            return;
        }
    }

    QwtAbstractSlider::mousePressEvent( event );
}
Exemple #9
0
bool VisuoThread::startLearningMIL(const std::string &obj_name)
{
    if(!isTracking())
        return false;

    Bottle command,reply;
    command.fromString(("learn " + obj_name + " template").c_str());

    cmdMILPort.write(command,reply);

    return (reply.get(0).toString()=="ack");
}
Exemple #10
0
void Client::logout()
{
  if (isTracking())
    stopTrack();
  else
  if (m_additionalTimer->isActive())
    m_additionalTimer->stop();
  Settings::getInstance().setLogin("unknown");
  Settings::getInstance().setPassword("unknown");
  int size = m_contactModel->getContacts().size();
  for (int i=0;i<size;i++)
    m_contactModel->removeContact(m_contactModel->getContacts().at(0)->getChannelName());

}
Exemple #11
0
//--------------------------------------------------------------
string ofxOpenNIUser::getDebugInfo(){
    ostringstream info;
    info << "XnUserID: " << ofToString(XnID) << " ";
    info << "autoCalibrate: " << boolToString(bUseAutoCalibration) << " ";
    info << "isFound: " << boolToString(isFound()) << " ";
    info << "isTracking: " << boolToString(isTracking()) << " ";
    info << "isSkeleton: " << boolToString(isSkeleton()) << " ";
    info << "isCalibrating: " << boolToString(isCalibrating()) << endl;
    info << "useMaskPixels: " << boolToString(getUseMaskPixels()) << " ";
    info << "useMaskTexture: " << boolToString(getUseMaskTexture()) << " ";
    info << "usePointCloud: " << boolToString(getUsePointCloud()) << " ";
    if (bUsePointCloud) {
        info << "pointCloudDrawSize: " << ofToString(pointCloudDrawSize) << " ";
        info << "pointCloudResolution: " << ofToString(pointCloudResolution) << " ";
    }
    return info.str();
}
Exemple #12
0
void Marker3DTracker::updateFeatureTracking()
{
    if(isTracking()) {
        ImageLabeler::ConnectedComponent blob(_labeler->getBlobAt(_trackedFeaturePosition + _trackedFeatureSpeed, _trackedFeatureClass, _lookupRadius)); // predict new position linearly
        if(blob.classCount[_trackedFeatureClass] > 0 && blob.centerOfMass.distance(_trackedFeaturePosition) <= _lookupRadius) {
            // successful tracking
            _trackedFeatureSpeed = blob.centerOfMass - _trackedFeaturePosition;
            _trackedFeatureSpeed.x = std::floor(_trackedFeatureSpeed.x);
            _trackedFeatureSpeed.y = std::floor(_trackedFeatureSpeed.y);
            _trackedFeaturePosition = blob.centerOfMass;
            _trackedFeaturePosition.x = std::floor(_trackedFeaturePosition.x);
            _trackedFeaturePosition.y = std::floor(_trackedFeaturePosition.y);
            _trackedFeatureArea = blob.pixels.size();
        }
        else
            endFeatureTracking();
    }
}
void
ValControlSegment::MouseDown(BPoint point)
{
	if (!parent()->IsEnabled())
		return;

	parent()->MakeFocus();

	// not left button?
	uint32 nButton;
	GetMouse(&point, &nButton);
	if (!(nButton & B_PRIMARY_MOUSE_BUTTON))
		return;

	// double click?
	bigtime_t doubleClickInterval;
	if (get_click_speed(&doubleClickInterval) < B_OK) {
		PRINT(("* ValControlSegment::MouseDown():\n"
			"  get_click_speed() failed."));
		return;
	}

	bigtime_t now = system_time();
	if (now - fLastClickTime < doubleClickInterval) {
		if(isTracking()) {
			setTracking(false);
			mouseReleased();
		}

		// hand off to parent control
		parent()->showEditField();
		fLastClickTime = 0LL;
		return;
	}
	else
		fLastClickTime = now;

		
	// engage tracking
	trackMouse(point, TRACK_VERTICAL);
}
Exemple #14
0
void FaceTracker::update(float deltaTime) {
    // Based on exponential distributions: http://en.wikipedia.org/wiki/Exponential_distribution
    static const float EPSILON = 0.02f; // MUST BE < 1.0f
    static const float INVERSE_AT_EPSILON = -std::log(EPSILON); // So that f(1.0f) = EPSILON ~ 0.0f
    static const float RELAXATION_TIME = 0.8f; // sec
    
    if (isTracking()) {
        if (_relaxationStatus == 1.0f) {
            _fadeCoefficient = 1.0f;
            return;
        }
        _relaxationStatus = glm::clamp(_relaxationStatus + deltaTime / RELAXATION_TIME, 0.0f, 1.0f);
        _fadeCoefficient = 1.0f - std::exp(-_relaxationStatus * INVERSE_AT_EPSILON);
    } else {
        if (_relaxationStatus == 0.0f) {
            _fadeCoefficient = 0.0f;
            return;
        }
        _relaxationStatus = glm::clamp(_relaxationStatus - deltaTime / RELAXATION_TIME, 0.0f, 1.0f);
        _fadeCoefficient = std::exp(-(1.0f - _relaxationStatus) * INVERSE_AT_EPSILON);
    }
}
Exemple #15
0
void Marker3DTracker::beginFeatureTracking(ofVec2f featurePosition, std::string featureClass)
{
    // reset
    if(isTracking())
        endFeatureTracking();
    featureClass = _namefix(featureClass);

    // let's track the damn thing
    if(featureClass.find("marker") != std::string::npos) { // I want markers only !!!
        ImageLabeler::ConnectedComponent blob(_labeler->getBlobAt(featurePosition, featureClass, _lookupRadius));
        if(blob.classCount[featureClass] > 0 || featureClass == "") {
            _trackedFeatureSpeed = ofVec2f(0.0f, 0.0f);
            _trackedFeaturePosition = ofVec2f(blob.centerOfMass);
            _trackedFeaturePosition.x = std::floor(_trackedFeaturePosition.x);
            _trackedFeaturePosition.y = std::floor(_trackedFeaturePosition.y);
            _trackedFeatureClass = _namefix(featureClass);
            _trackedFeatureArea = blob.pixels.size();

            // done
            _isTracking = true;
        }
    }
}
Exemple #16
0
/*!
   Timer event handler

   Handles the timer, when the mouse stays pressed
   inside the sliderRect().

   \param event Mouse event
*/  
void QwtSlider::timerEvent( QTimerEvent *event )
{
    if ( event->timerId() != d_data->repeatTimerId )
    {
        QwtAbstractSlider::timerEvent( event );
        return;
    }

    if ( !isValid() )
    {
        killTimer( d_data->repeatTimerId );
        d_data->repeatTimerId = 0;
        return;
    }

    const double v = value();
    incrementValue( d_data->stepsIncrement );

    if ( v != value() )
    {
        if ( isTracking() )
            Q_EMIT valueChanged( value() );
        else
            d_data->pendingValueChange = true;

        Q_EMIT sliderMoved( value() );
    }

    if ( !d_data->timerTick )
    {
        // restart the timer with a shorter interval
        killTimer( d_data->repeatTimerId );
        d_data->repeatTimerId = startTimer( updateInterval() );
        
        d_data->timerTick = true;
    }   
}
Exemple #17
0
void Tracker::startTracking(const Input &) {
	if (!isTracking()) {
		_savedHandler = InputHandler::setInputHandler(this);
		_currentTracker = this;
	}
}
 void TrackedErrors::startTracking( int errCode ) {
     dassert( !isTracking( errCode ) );
     _errorMap.insert( make_pair( errCode, vector<ShardError*>() ) );
 }
 const vector<ShardError*>& TrackedErrors::getErrors( int errCode ) const {
     dassert( isTracking( errCode ) );
     return _errorMap.find( errCode )->second;
 }
Exemple #20
0
bool Tracker::isClickInput(const Input &input, const Hotspot *hotspot) {
	return !isTracking() && InputHandler::isClickInput(input, hotspot);
}
Exemple #21
0
void Tracker::stopTracking(const Input &) {
	if (isTracking()) {
		_currentTracker = NULL;
		InputHandler::setInputHandler(_savedHandler);
	}
}
Exemple #22
0
void Tracker::handleInput(const Input &input, const Hotspot *) {
	if (stopTrackingInput(input))
		stopTracking(input);
	else if (isTracking())
		continueTracking(input);
}