Exemplo n.º 1
0
VrInput::VrInput()
{
	_vrClient = _vrio_getInProcessClient();	
	_vrClient->initialize();
	
	_headCalibration(0,0,0);
	_weaponCalibration(0,0,0);
	
	_prevYaw = 0;
	_prevWeaponYaw = 0;
	_accumulatedHeadYaw = 0;
	_accumulatedWeaponYaw = 0;

	g_vr = this;
	_initialized = true;	
}
Exemplo n.º 2
0
int main(int argc, char* argv[])
{
	SetConsoleCtrlHandler(OnCtrlC, TRUE);

	struct mg_callbacks callbacks;
	memset(&callbacks, 0, sizeof(callbacks));
	callbacks.begin_request = begin_request_handler;
	const char *options[] = { "listening_ports", "8081", "num_threads", "10", NULL };
	ctx = mg_start(&callbacks, NULL, options);

	client = _vrio_getInProcessClient();
	client->initialize();
   
	VRIO_Message message;
	message.init();

	while (!stopped)
	{
		client->think();
		
		system("cls");
		client->getOrientation(HEAD, message);
		
		printf("\n\n> HEAD Orientation pitch:%f yaw:%f roll:%f \n", message.pitch, message.yaw, message.roll);
		
		if ( client->getChannelCount() > 1 )
		{
			client->getOrientation(WEAPON, message);
			printf("\n\n> WEAPON Orientation pitch:%f yaw:%f roll:%f \n", message.pitch, message.yaw, message.roll);
			Sleep(5);
		}

		Sleep(30);
	}
   
	printf("\n");
	return 0; 
}
Exemplo n.º 3
0
VrController::VrController()
{
	Msg("Initializing VR Controller");
	
	for (int i=0; i<SENSOR_COUNT; i++)
	{
		_previousYaw[i] = 0;
		_totalAccumulatedYaw[i] = 0;
	}
	
	_headAngle.Init();
	_headCalibration.Init();
	
	_bodyAngle.Init();
	_bodyCalibration.Init();
	_bodyCalibration[YAW] = -1; // triggers first pass initialization

	_weaponAngle.Init();
	_weaponCalibration.Init();

	_vrIO = _vrio_getInProcessClient();
	_vrIO->initialize();

	_vrController = this;

	if ( _vrIO->getChannelCount() > 0 )
	{
	
	}
	else 
	{
		Msg("VR Controller initialized with no devices");
	}

	_initialized = true;
	
	Msg("VR Controller initialized");
}