当前位置: 首页>>代码示例>>C++>>正文


C++ SensorFusion::AttachToSensor方法代码示例

本文整理汇总了C++中SensorFusion::AttachToSensor方法的典型用法代码示例。如果您正苦于以下问题:C++ SensorFusion::AttachToSensor方法的具体用法?C++ SensorFusion::AttachToSensor怎么用?C++ SensorFusion::AttachToSensor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SensorFusion的用法示例。


在下文中一共展示了SensorFusion::AttachToSensor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onInit

void OculusRiftService::onInit(){
	// initialization(prepare varibles for data acquisition of OculusRift's sensors)
	OVR::System::Init();
     std::string Service_name ="";
     IPv4 ip;
     std::string str ="";
      str = getMyIP(&ip);
      if( str == "" )
        {
          std::cout <<"Theres been an error !" << std::endl;
      
        }

   Service_name = "SIGORS ";
   Service_name += str;
  // sendMsg("multiuserctr_0",Service_name);


	pFusionResult = new SensorFusion();
	pManager = *DeviceManager::Create();

	pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();

	if (pHMD){
		InfoLoaded = pHMD->GetDeviceInfo(&Info);
		pSensor = *pHMD->GetSensor();
	}
	else{
	   pSensor = *pManager->EnumerateDevices<SensorDevice>().CreateDevice();
	}

	if (pSensor){
	   pFusionResult->AttachToSensor(pSensor);
	}
}
开发者ID:Aharobot,项目名称:samples,代码行数:35,代码来源:OculusRiftSensor.cpp

示例2: InitRiftApi

extern "C" RIFTAPI_API int InitRiftApi()
{
	OVR::System::Init();
	pManager = *DeviceManager::Create();

	pHMD     = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();
	if (!pHMD)
	{
		return 0 ;
	}

	pSensor  = *pHMD->GetSensor();

	// Get DisplayDeviceName, ScreenWidth/Height, etc..

	pHMD->GetDeviceInfo(&hmdInfo);

	if (pSensor)
	{
		SFusion.AttachToSensor(pSensor);
		SFusion.SetPrediction(0.03f);
	}

	if(pSensor)
	{
		return 1;
	}

	return 0;
}
开发者ID:WorldWideTelescope,项目名称:wwt-windows-client,代码行数:30,代码来源:RiftApi.cpp

示例3: initialize

 __declspec(dllexport) void initialize(void) {
     System::Init(Log::ConfigureDefaultLog(LogMask_None));    
     pManager = *DeviceManager::Create();
     pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice(); 
     pSensor = *pHMD->GetSensor();
     SFusion.AttachToSensor(pSensor);
     MagCal.BeginAutoCalibration(SFusion);
 }
开发者ID:MrFauxPas,项目名称:pyrift,代码行数:8,代码来源:pyrift.cpp

示例4: printf

JNIEXPORT jboolean JNICALL Java_de_fruitfly_ovr_OculusRift_initSubsystem(JNIEnv *env, jobject jobj) 
{
	Initialized = false;

	System::Init();

	pManager = *DeviceManager::Create();

	_ipd = 0.0635f; // Default
	Info.InterpupillaryDistance = _ipd;

	pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();
	if (pHMD) {
		printf("Oculus Rift Device Interface created.\n");
		InfoLoaded = pHMD->GetDeviceInfo(&Info);
		pSensor = *pHMD->GetSensor();
		FusionResult.AttachToSensor(pSensor);
		Initialized = InfoLoaded && pSensor;
		printf("Oculus Rift Device Interface initialized.\n");
	}
	else {
		printf("Unable to create Oculus Rift device interface.\n");
	}

	if (InfoLoaded) {

		_ipd = Info.InterpupillaryDistance;

		printf(" DisplayDeviceName: %s\n", Info.DisplayDeviceName);
		printf(" ProductName: %s\n", Info.ProductName);
		printf(" Manufacturer: %s\n", Info.Manufacturer);
		printf(" Version: %s\n", Info.Version);
		printf(" HResolution: %i\n", Info.HResolution);
		printf(" VResolution: %i\n", Info.VResolution);
		printf(" HScreenSize: %f\n", Info.HScreenSize);
		printf(" VScreenSize: %f\n", Info.VScreenSize);
		printf(" VScreenCenter: %f\n", Info.VScreenCenter);
		printf(" EyeToScreenDistance: %f\n", Info.EyeToScreenDistance);
		printf(" LensSeparationDistance: %f\n", Info.LensSeparationDistance);
        printf(" InterpupillaryDistance: %f\n", Info.InterpupillaryDistance);
        printf(" DistortionK[0]: %f\n", Info.DistortionK[0]);
        printf(" DistortionK[1]: %f\n", Info.DistortionK[1]);
		printf(" DistortionK[2]: %f\n", Info.DistortionK[2]);
		printf(" DistortionK[3]: %f\n", Info.DistortionK[3]);
		printf(" ChromaticAb[0]: %f\n", Info.ChromaAbCorrection[0]);
        printf(" ChromaticAb[1]: %f\n", Info.ChromaAbCorrection[1]);
		printf(" ChromaticAb[2]: %f\n", Info.ChromaAbCorrection[2]);
		printf(" ChromaticAb[3]: %f\n", Info.ChromaAbCorrection[3]);
	}

	return Initialized;
}
开发者ID:StellaArtois,项目名称:JRift,代码行数:52,代码来源:JRiftLibrary.cpp

示例5: Init

/** Oculus init **/
void Init()
{
	System::Init();

	pManager = *DeviceManager::Create();

	pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();

	if (pHMD)
        {
           InfoLoaded = pHMD->GetDeviceInfo(&Info);

	   pSensor = *pHMD->GetSensor();
	}
	else
	{
	   pSensor = *pManager->EnumerateDevices<SensorDevice>().CreateDevice();
	}

	if (pSensor)
	{
	   FusionResult.AttachToSensor(pSensor);
	}
}
开发者ID:Tezar,项目名称:tunnel,代码行数:25,代码来源:main.cpp

示例6: IN_MotionSensor_Init

void IN_MotionSensor_Init(void)
{
	//Carl: Don't initialize has* here to false, because they can also be set by command line parameters

	// *** Oculus Sensor Initialization
	OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All));

    // Create DeviceManager and first available HMDDevice from it.
    // Sensor object is created from the HMD, to ensure that it is on the
    // correct device.

    pManager = *DeviceManager::Create();

	// We'll handle it's messages in this case.
	//pManager->SetMessageHandler(this);

    // Release Sensor/HMD in case this is a retry.
    pSensor.Clear();
    pHMD.Clear();
    pHMD  = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();
    if (pHMD)
    {
        pSensor = *pHMD->GetSensor();
    }
    else
    {            
        // If we didn't detect an HMD, try to create the sensor directly.
        // This is useful for debugging sensor interaction; it is not needed in
        // a shipping app.
        pSensor = *pManager->EnumerateDevices<SensorDevice>().CreateDevice();
    }
    if (!pHMD && !pSensor)
        common->Warning("Oculus Rift not detected.\n");
    else if (!pHMD)
        common->Warning("Oculus Sensor detected; HMD Display not detected.\n");
    else if (!pSensor)
        common->Warning("Oculus HMD Display detected; Sensor not detected.\n");
    //else if (HMDInfo.DisplayDeviceName[0] == '\0')
    //    common->Printf("Oculus Sensor detected; HMD display EDID not detected.\n");

	if (pSensor)
    {
		SFusion.AttachToSensor(pSensor);
        SFusion.SetPredictionEnabled(true);
		hasOculusRift = true;
		hasHMD = true;
    }
	
	if (!pSensor)
		LoadVR920();
	hasHMD = hasHMD || hasVR920Tracker;

	//Hillcrest libfreespace stuff
	LPDWORD dwThreadId=0;
	struct freespace_message message;
	int numIds;
	int rc;
	int i;

	// Initialize the freespace library
	rc = freespace_init();
	if (rc != FREESPACE_SUCCESS) {
		common->Warning("Hillcrest Initialization error. rc=%d\n", rc);
		return;
	}

	/** --- START EXAMPLE INITIALIZATION OF DEVICE -- **/
	rc = freespace_getDeviceList(&device, 1, &numIds);
	if (numIds == 0) {
		common->Warning("MotionSensor: Didn't find any devices.\n");
		return;
	}

	rc = freespace_openDevice(device);
	if (rc != FREESPACE_SUCCESS) {
		common->Warning("MotionSensor: Error opening device: %d\n", rc);
		return;
	}

	rc = freespace_flush(device);
	if (rc != FREESPACE_SUCCESS) {
		common->Warning("MotionSensor: Error flushing device: %d\n", rc);
		return;
	}

	memset(&message, 0, sizeof(message));
	message.messageType = FREESPACE_MESSAGE_DATAMODECONTROLV2REQUEST;
	message.dataModeControlV2Request.packetSelect = 2;
	message.dataModeControlV2Request.modeAndStatus |= 0 << 1;

	rc = freespace_sendMessage(device, &message);
	if (rc != FREESPACE_SUCCESS) {
		common->Warning("freespaceInputThread: Could not send message: %d.\n", rc);
	}
	CreateThread(NULL, //Choose default security
		0, //Default stack size
		(LPTHREAD_START_ROUTINE)&IN_MotionSensor_Thread,
		//Routine to execute
		(LPVOID) &i, //Thread parameter
		0, //Immediately run the thread
//.........这里部分代码省略.........
开发者ID:JunDeWinter,项目名称:DOOM-3-BFG-VR,代码行数:101,代码来源:in_motion_sensor.cpp

示例7: OnStartup

int InputTestApp::OnStartup(int argc, const char** argv)
{
    if (!pPlatform->SetupWindow(1200,800))
        return 1;
    

    pManager = *DeviceManager::Create();
    
    // This initialization logic supports running two sensors at the same time.
   
    DeviceEnumerator<SensorDevice> isensor = pManager->EnumerateDevices<SensorDevice>();
    DeviceEnumerator<SensorDevice> oculusSensor;
    DeviceEnumerator<SensorDevice> oculusSensor2;
    
    while(isensor)
    {
        DeviceInfo di;
        if (isensor.GetDeviceInfo(&di))
        {
            if (strstr(di.ProductName, "Tracker"))
            {
                if (!oculusSensor)
                    oculusSensor = isensor;
                else if (!oculusSensor2)
                    oculusSensor2 = isensor;
            }
        }

        isensor.Next();
    }

    if (oculusSensor)
    {
        pSensor = *oculusSensor.CreateDevice();

        if (pSensor)
            pSensor->SetRange(SensorRange(4 * 9.81f, 8 * Math<float>::Pi, 1.0f), true);

        if (oculusSensor2)
        {
            // Second Oculus sensor, useful for comparing firmware behavior & settings.
            pSensor2 = *oculusSensor2.CreateDevice();

            if (pSensor2)
                pSensor2->SetRange(SensorRange(4 * 9.81f, 8 * Math<float>::Pi, 1.0f), true);
        }
    }

    oculusSensor.Clear();
    oculusSensor2.Clear();
       
    
    /*
    DeviceHandle hHMD = pManager->EnumerateDevices<HMDDevice>();
    HMDInfo      hmdInfo;
    if (hHMD)
    {        
        hHMD.GetDeviceInfo(&hmdInfo);
    }
    */

    if (pSensor)
        SFusion.AttachToSensor(pSensor);
    if (pSensor2)
        SFusion2.AttachToSensor(pSensor2);

    /*
    // Test rotation: This give rotations clockwise (CW) while looking from
    // origin in the direction of the axis.

    Vector3f xV(1,0,0);
    Vector3f zV(0,0,1);

    Vector3f rxV = Matrix4f::RotationZ(DegreeToRad(10.0f)).Transform(xV);
    Vector3f ryV = Matrix4f::RotationY(DegreeToRad(10.0f)).Transform(xV);
    Vector3f rzV = Matrix4f::RotationX(DegreeToRad(10.0f)).Transform(zV);
    */

    // Report relative mouse motion (not absolute position)
   // pPlatform->SetMouseMode(Mouse_Relative);

    const char* graphics = "d3d10";
    for (int i = 1; i < argc; i++)
        if (!strcmp(argv[i], "-r") && i < argc-1)
            graphics = argv[i+1];

    pRender = pPlatform->SetupGraphics(OVR_DEFAULT_RENDER_DEVICE_SET, graphics,
                                       RendererParams());
  
    //WireframeFill = pRender->CreateSimpleFill(Fill::F_Wireframe);


    
    // *** Rotating Box
    
    pBox = *new Container;
    pBox->Add(Ptr<Model>(        
       *Model::CreateAxisFaceColorBox(-2.0f, 2.0f, Color(0,   0xAA, 0),        // x = green
                                      -1.0f, 1.0f, Color(0xAA,0,    0),        // y = red
                                      -1.0f, 1.0f, Color(0,   0,    0xAA)) )); // z = blue 
//.........这里部分代码省略.........
开发者ID:digitize-the-world,项目名称:scaling-octo-nemesis,代码行数:101,代码来源:SensorBoxTest.cpp


注:本文中的SensorFusion::AttachToSensor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。