diff --git a/Base/Devices/imstkVRPNDeviceServer.cpp b/Base/Devices/imstkVRPNDeviceServer.cpp index 30a4f01ccaaf1983bb2b8913dbc6daa12ed52a33..1b55357f321527815764ee4a19d3514c399b66c8 100644 --- a/Base/Devices/imstkVRPNDeviceServer.cpp +++ b/Base/Devices/imstkVRPNDeviceServer.cpp @@ -25,6 +25,7 @@ #define VRPN_USE_LIBNIFALCON #define VERBOSE #include "vrpn_Tracker_NovintFalcon.h" +#include "vrpn_Tracker_OSVRHackerDevKit.h" #include "g3log/g3log.hpp" @@ -61,9 +62,12 @@ VRPNDeviceServer::initModule() } break; case DeviceType::NOVINT_FALCON: { - auto vrpn_device = new vrpn_Tracker_NovintFalcon(name.c_str(), m_serverConnection, - id, "4-button", "stamper"); - m_deviceConnections->add(vrpn_device); + m_deviceConnections->add(new vrpn_Tracker_NovintFalcon(name.c_str(), m_serverConnection, + id, "4-button", "stamper")); + } break; + case DeviceType::OSVR_HDK: + { + m_deviceConnections->add(new vrpn_Tracker_OSVRHackerDevKit(name.c_str(), m_serverConnection)); } break; default: { diff --git a/Base/Devices/imstkVRPNDeviceServer.h b/Base/Devices/imstkVRPNDeviceServer.h index 346ebf153f84f5bef290d7d9f57cfe8565070696..4b0670bcd55542ebf62c0856935c9be43c8a9494 100644 --- a/Base/Devices/imstkVRPNDeviceServer.h +++ b/Base/Devices/imstkVRPNDeviceServer.h @@ -38,7 +38,8 @@ enum class DeviceType { SPACE_EXPLORER_3DCONNEXION, NAVIGATOR_3DCONNEXION, - NOVINT_FALCON + NOVINT_FALCON, + OSVR_HDK }; /// diff --git a/Examples/Sandbox/main.cpp b/Examples/Sandbox/main.cpp index 77d053c57196684e1b6fac23d8ddec9c7522ae2f..1ef9525191e31d9eeeff07d10497915f8913e68d 100644 --- a/Examples/Sandbox/main.cpp +++ b/Examples/Sandbox/main.cpp @@ -79,6 +79,7 @@ void testTwoFalcons() auto server = std::make_shared<imstk::VRPNDeviceServer>(); server->addDevice("falcon0", imstk::DeviceType::NOVINT_FALCON, 0); server->addDevice("falcon1", imstk::DeviceType::NOVINT_FALCON, 1); + server->addDevice("hdk", imstk::DeviceType::OSVR_HDK); sdk->addDeviceServer(server); // Falcon clients @@ -87,6 +88,10 @@ void testTwoFalcons() auto falcon1 = std::make_shared<imstk::VRPNDeviceClient>("falcon1", "localhost"); sdk->addDeviceClient(falcon1); + // Cam Client + auto hdk = std::make_shared<imstk::VRPNDeviceClient>("hdk", "localhost"); + sdk->addDeviceClient(hdk); + // Plane auto planeGeom = std::make_shared<imstk::Plane>(); planeGeom->scale(50); @@ -97,26 +102,27 @@ void testTwoFalcons() // Sphere0 auto sphere0Geom = std::make_shared<imstk::Sphere>(); - sphere0Geom->setPosition(imstk::Vec3d(3,1.5,0)); - sphere0Geom->scale(0.5); - auto sphere0Obj = std::make_shared<imstk::VirtualCouplingObject>("Sphere0", falcon0, 25); + sphere0Geom->setPosition(imstk::Vec3d(16,4.5,0)); + sphere0Geom->scale(1); + auto sphere0Obj = std::make_shared<imstk::VirtualCouplingObject>("Sphere0", falcon0, 30); sphere0Obj->setVisualGeometry(sphere0Geom); sphere0Obj->setCollidingGeometry(sphere0Geom); scene->addSceneObject(sphere0Obj); // Sphere1 auto sphere1Geom = std::make_shared<imstk::Sphere>(); - sphere1Geom->setPosition(imstk::Vec3d(-3,1.5,0)); - sphere1Geom->scale(0.5); - auto sphere1Obj = std::make_shared<imstk::VirtualCouplingObject>("Sphere1", falcon1, 25); + sphere1Geom->setPosition(imstk::Vec3d(-16,4.5,0)); + sphere1Geom->scale(1); + auto sphere1Obj = std::make_shared<imstk::VirtualCouplingObject>("Sphere1", falcon1, 30); sphere1Obj->setVisualGeometry(sphere1Geom); sphere1Obj->setCollidingGeometry(sphere1Geom); scene->addSceneObject(sphere1Obj); - // Update Camera position + // Camera auto cam = scene->getCamera(); - cam->setPosition(imstk::Vec3d(0,3,15)); - cam->setFocalPoint(imstk::UP_VECTOR); + cam->setPosition(imstk::Vec3d(0,18,20)); + cam->setFocalPoint(imstk::UP_VECTOR*18); + cam->setupController(hdk); // Run sdk->setCurrentScene("FalconsTestScene"); @@ -172,11 +178,12 @@ void testCameraController() // Device server auto server = std::make_shared<imstk::VRPNDeviceServer>("127.0.0.1"); - server->addDevice("device0", imstk::DeviceType::SPACE_EXPLORER_3DCONNEXION); + server->addDevice("device0", imstk::DeviceType::OSVR_HDK); sdk->addDeviceServer(server); // Device Client auto client = std::make_shared<imstk::VRPNDeviceClient>("device0", "localhost"); // localhost = 127.0.0.1 + //client->setLoopDelay(1000); sdk->addDeviceClient(client); // Mesh @@ -187,7 +194,7 @@ void testCameraController() // Update Camera position auto cam = scene->getCamera(); - cam->setPosition(imstk::Vec3d(8,-8,8)); + cam->setPosition(imstk::Vec3d(0,0,10)); // Set camera controller cam->setupController(client, 100);