コード例 #1
0
void NaoMarkServiceDetection::callback(const std::string &key, const AL::ALValue &value, const AL::ALValue &msg) 
{
	AL::ALValue marks = fMemoryProxy.getData("LandmarkDetected");

	if(marks.getSize() > 0 && !_isMarkFound)
	{
		int TimeStampField = marks[0][1];
		if((int)marks[1][0][1][0] == _markToFind)
		{
			if((float)marks[1][0][0][3] < 0.2f)
			{
				if(_isAllowedToMove)
					motionProxy->moveToward(0.5f,0,marks[1][0][0][1]);
				_naoMarkDetected = true;
			}
			else
			{
				motionProxy->moveToward(0,0,0);
				_isMarkFound = true;
			}
		}
		else
			motionProxy->moveToward(0,0,0);
	}
}
コード例 #2
0
void NaoMarkServiceDetection::backGroundService()
{ 
	_isThreadRuning = true;
	while(_isThreadRuning)
	{
		_naoMarkDetected = false;
		Sleep((DWORD)1000);
		if(!_naoMarkDetected && _markToFind != -1 && !_isMarkFound)
		{
			motionProxy->moveToward(0,0,0);
			FindMarkArround();
		}
	}
}