QVariantMap MobExample2Action::metaData() const
{
    QVariantMap variantMap;
    QVariant localization("Test action 2");
    variantMap.insert(KCntUiActionMetaTitleText, localization);
    const QString& string(QContactPhoneNumber::FieldNumber);
    QVariant detailField(string);
    variantMap.insert(KCntUiActionMetaValueTextDetail, detailField);
    QString menuString("Do example action2");
    QVariant longPressMenu(menuString);
    variantMap.insert(KCntUiActionMetaValueTextLongPress, longPressMenu);
    return variantMap;
}
QVariantMap MobExampleAction::metaData() const
{
    QVariantMap variantMap;
    const QString& string("Test action 1");
    QVariant localization(string);
    variantMap.insert(KCntUiActionMetaTitleText, localization);
    const QString& string2(QContactOnlineAccount::FieldAccountUri);
    const QVariant detailField(string2);
    variantMap.insert(KCntUiActionMetaValueTextDetail, detailField);
    QString menuString("Do example action");
    QVariant longPressMenu(menuString);
    variantMap.insert(KCntUiActionMetaValueTextLongPress, longPressMenu);
    HbIcon hIcon("qtg_large_voip.svg");
    // Must be QIcon
    QIcon icon(hIcon.qicon());
    QVariant iconVariant(icon);
    variantMap.insert("icon", iconVariant);
    return variantMap;
}
Exemplo n.º 3
0
    void detectKeypoints(cv::gpu::GpuMat& keypoints, int scales)
    {

        ensureSizeIsEnough(SIFT_GPU::ROWS_COUNT, MAXEXTREMAS, CV_32FC1, keypoints);

        keypoints.setTo(cv::Scalar::all(0));
        for (int octave = 0; octave < 1; ++octave)
        {
            const int scaleCols = cols >> octave;
            const int scaleRows = rows >> octave;

            createDoGSpace(inImage.data, &deviceDoGData, scales, scaleRows, scaleCols);
            findExtremas(deviceDoGData, &sift_.extremaBuffer, &maxCounter, octave, scales, scaleRows, scaleCols);
            localization(deviceDoGData, scaleRows, scaleCols, scales, octave, sift_.nOctaves, sift_.extremaBuffer, maxCounter,
                         keypoints.ptr<float>(SIFT_GPU::X_ROW), keypoints.ptr<float>(SIFT_GPU::Y_ROW),
                         keypoints.ptr<float>(SIFT_GPU::OCTAVE_ROW),	keypoints.ptr<float>(SIFT_GPU::SIZE_ROW),
                         keypoints.ptr<float>(SIFT_GPU::ANGLE_ROW), keypoints.ptr<float>(SIFT_GPU::RESPONSE_ROW));
        }

        std::cout << "Number of keypoints: " << maxCounter[0] << std::endl;
    }
Exemplo n.º 4
0
// This is only for the qualifying
int qualify_test(int* command, unsigned int* blobs, float* location, int* orientation_flag, int* west_flag, int* east_flag, float* calibration)
{
	if(*command == PLAY)
	{
		int temp;
		temp = localization(blobs, calibration, location);
		float goal[3];
		if(temp)
		{
			if(*orientation_flag == 0)
			{
				*orientation_flag = 1;
				if(location[0] >= 0) *east_flag = 1;
				else *west_flag = 1;
			}
		}
		
		if(*west_flag)
		{
			goal[0] = 115;
			goal[1] = 0;
		}
		else if(*east_flag)
		{
			goal[0] = -115;
			goal[1] = 0;
		}
		
		if(*orientation_flag)
		{
			int temp;
			temp = move(location, goal);
			if(!temp)
			{
				*command = PAUSE;
				*orientation_flag = 0;
				*west_flag = 0;
				*east_flag = 0;
			}
			
		}
	}
	else if(*command == GOALA)
	{
		*west_flag = 0;
		*east_flag = 1;
		*orientation_flag = 1;
		*command = PLAY;
	}
	else if(*command == GOALB)
	{
		*west_flag = 1;
		*east_flag = 0;
		*orientation_flag = 1;
		*command = PLAY;
	}
	else if(*command == HALFTIME)
	{
		OCR1B = 0;
		OCR1C = 0;
	}
	else if(*command == GAMEOVER)
	{
		OCR1B = 0;
		OCR1C = 0;
	}
	else if(*command == PAUSE)
	{
		OCR1B = 0;
		OCR1C = 0;
	}	
}
Exemplo n.º 5
0
int main(void)
{
	robockey_init();
    while(1)
    {
	    comm(command);
		mode = check_mode();
		if(wii_flag && command == PLAY) 
		{
			location_flag = localization(blobs, calibration, location);
			wii_flag = 0;
		}			
		switch(mode)
		{
			case 0:	// normal mode(GOAL A), need command PLAY TO START			
			if(switch_flag)
			{
				goal[0] = -125;
				goal[1] = 0;
				goal[2] = 0;
				if(command == HALFTIME)
				{
					goal[0] = 125;
					switch_flag = 0;
				}
			}
			if(command == PLAY)
			{
				//if(!found) 
				//{
					//found = find(adc1, adc2, &count);
					//set(TIMSK0,OCIE0A);	// Enable timer0 interrupt
				//}				
				if(find(adc1, adc2, &count))
				{
					m_green(TOGGLE);
					m_red(OFF);
					move(location, goal);
				}
			}
			break;
			
			case 1:	// normal mode(GOAL B), need command PLAY TO START
			if(switch_flag)
			{
				goal[0] = 125;
				goal[1] = 0;
				goal[2] = 0;
				if(command == HALFTIME)
				{
					goal[0] = -125;
					switch_flag = 0;
				}
			}
			if(command == PLAY)
			{
				if(find(adc1, adc2, &count))
				{
					m_green(TOGGLE);
					m_red(OFF);
					move(location, goal);
				}
			}
			break;
			
			case 2:	// calibrate the center of the rink
			m_green(ON);
			m_red(ON);
			if(wii_flag)
			{
				float calibrationDefault[2] = {0, 0};
				float calibrationResult[3] = {0, 0, 0};
				if(localization(blobs, calibrationDefault, calibrationResult))
				{
					//m_green(ON);
					//m_red(ON);
					calibration[0] = calibrationResult[0];
					calibration[1] = calibrationResult[1];
				}
			}
			break;
			
			case 3:	// test mode(GOAL A), always play while the power is on.
			m_green(TOGGLE);
			m_red(OFF);
			if(find(adc1, adc2, &count))
			{
				if(wii_flag)
				{
					//if(!found)
					//{
						//found = find(adc1, adc2, &count);
						//set(TIMSK0,OCIE0A);	// Enable interrupt
					//}
					if(localization(blobs, calibration, location))
					{
					float goal[3] = {-115, 0, 0};
					move(location, goal);
					}
				}
			}
			break;
			
			case 4:	// test mode(GOAL B), always play while the power is on.
			m_red(TOGGLE);
			m_green(OFF);
			if(find(adc1, adc2, &count))
			{
				if(wii_flag)
				{
					if(localization(blobs, calibration, location))
					{
					float goal[3] = {115, 0, 0};
					move(location, goal);
					}
				}
			}
			break;
			
			case 5:
			m_green(ON);
			m_red(ON);
			OCR1B = OCR1A;
			OCR1C = 0.98*OCR1A;
			break;
			
			case 6:
			qualify_test(&command, blobs, location, &orientation_flag, &west_flag, &east_flag, calibration);
			break;
			
			case 7:
			OCR1B = OCR1A;
			OCR1C = 0;
			m_wait(3200);
			OCR1B = OCR1A/2;
			OCR1C = OCR1A/2;
			m_wait(32000);
			break;
			
			default:
			OCR1B = 0.5*OCR1A;
			OCR1C = 0.5*OCR1A;
			m_green(OFF);
			m_red(OFF);
		}
		m_usb_tx_int((int)(location[0]));
		m_usb_tx_char('\t');
		m_usb_tx_int((int)(location[1]));
		m_usb_tx_char('\t');
		m_usb_tx_int((int)(adc1[0]));
		m_usb_tx_char('\t');
		m_usb_tx_int((int)(adc2[0]));
		m_usb_tx_char('\t');
		m_usb_tx_int((int)(check(PIND, 7)));
		m_usb_tx_char('\t');
		m_usb_tx_char('\r');
		if(!check(ADCSRA, ADIF)) set(ADCSRA,ADSC);
    }
}