Commit 4821c848 authored by Alexis Girault's avatar Alexis Girault

Merge branch 'VRPN-fixes' into 'master'

VRPN fixes (runtime, compilation, and external linkage)

1. VRPN would not be found in `FindVRPN.cmake` on Linux if `iMSTK_USE_OMNI` was set to ON.
2. A name issue in `iMSTKConfig.cmake.in` would prevent external projects to link against iMSTK
3. An offset was applied on VRPN devices on the client side while there already was a way to set up offsets in the controller interface

See merge request !101
parents 659d8209 c644e1ce
......@@ -31,8 +31,6 @@ VRPNDeviceClient::initModule()
{
auto fullDeviceIp = this->getName().c_str();
m_offsetSet = false;
m_vrpnTracker = std::make_shared<vrpn_Tracker_Remote>(fullDeviceIp);
m_vrpnAnalog = std::make_shared<vrpn_Analog_Remote>(fullDeviceIp);
m_vrpnButton = std::make_shared<vrpn_Button_Remote>(fullDeviceIp);
......@@ -100,14 +98,7 @@ VRPNDeviceClient::trackerChangeHandler(void *userData, const _vrpn_TRACKERCB t)
quat.y() = t.quat[1];
quat.z() = t.quat[2];
quat.w() = t.quat[3];
if(!deviceClient->m_offsetSet)
{
deviceClient->m_rotOffset = quat.inverse();
deviceClient->m_offsetSet = true;
return;
}
deviceClient->m_orientation = deviceClient->m_rotOffset * quat;
deviceClient->m_orientation = quat;
//LOG(DEBUG) << "tracker: position = " << t.pos[0] << " " << t.pos[1] << " " << t.pos[2];
//LOG(DEBUG) << "tracker: orientation = " << deviceClient->m_orientation.matrix();
......
......@@ -125,9 +125,6 @@ private:
std::shared_ptr<vrpn_Analog_Remote> m_vrpnAnalog; //!< VRPN position/orientation interface
std::shared_ptr<vrpn_Button_Remote> m_vrpnButton; //!< VRPN button interface
std::shared_ptr<vrpn_ForceDevice_Remote> m_vrpnForceDevice; //!< VRPN force interface
bool m_offsetSet = false;
Quatd m_rotOffset = Quatd::Identity();
};
}
......
......@@ -25,6 +25,7 @@
#include <vector>
#include <map>
#include <typeinfo>
#include <string>
// vrpn
#include <vrpn_Connection.h>
......@@ -32,7 +33,6 @@
// imstk
#include "imstkModule.h"
#include "imstkVRPNDeviceClient.h"
namespace imstk
{
......
......@@ -37,7 +37,6 @@ imstk_add_external_project( VRPN
-DBUILD_TESTING:BOOL=OFF
-DVRPN_SUBPROJECT_BUILD:BOOL=ON
-DVRPN_BUILD_CLIENTS:BOOL=OFF
-DVRPN_BUILD_SERVERS:BOOL=OFF
-DVRPN_BUILD_CLIENT_LIBRARY:BOOL=ON
-DVRPN_BUILD_SERVER_LIBRARY:BOOL=ON
-DVRPN_INSTALL:BOOL=OFF
......
......@@ -49,17 +49,51 @@ if(WIN32)
list(APPEND VRPN_INCLUDE_DIRS ${LIBFTD2XX_INCLUDE_DIR})
endif()
#-----------------------------------------------------------------------------
# Phantom Omni support
#-----------------------------------------------------------------------------
if(${iMSTK_USE_OMNI})
find_library(VRPN_PHANTOM_LIBRARY
NAMES
vrpn_phantom
vrpn_phantomd
)
mark_as_advanced(VRPN_PHANTOM_LIBRARY)
list(APPEND VRPN_LIBRARIES ${VRPN_PHANTOM_LIBRARY})
list(APPEND CMAKE_MODULE_PATH ${VRPN_INCLUDE_DIR}/cmake)
find_package(OpenHaptics)
list(APPEND VRPN_LIBRARIES ${OPENHAPTICS_LIBRARIES})
list(APPEND VRPN_INCLUDE_DIRS ${OPENHAPTICS_INCLUDE_DIRS})
list(REMOVE_ITEM CMAKE_MODULE_PATH ${VRPN_INCLUDE_DIR}/cmake)
find_package(OpenGL)
list(APPEND VRPN_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND VRPN_LIBRARIES ${OPENGL_LIBRARY})
endif()
#-----------------------------------------------------------------------------
# Find library
#-----------------------------------------------------------------------------
find_library(VRPN_LIBRARY
NAMES
vrpnserver
vrpnserverd
vrpn
vrpnd
)
mark_as_advanced(VRPN_LIBRARY)
list(APPEND VRPN_LIBRARIES ${VRPN_LIBRARY})
find_library(VRPNSERVER_LIBRARY
NAMES
vrpnserver
vrpnserverd
)
mark_as_advanced(VRPNSERVER_LIBRARY)
list(APPEND VRPN_LIBRARIES ${VRPNSERVER_LIBRARY})
find_library(QUAT_LIBRARY
NAMES
quat
......@@ -109,26 +143,6 @@ endif()
list(APPEND VRPN_LIBRARIES ${HIDAPI_LIBRARY})
mark_as_advanced(HIDAPI_LIBRARY)
#-----------------------------------------------------------------------------
# Phantom Omni support
#-----------------------------------------------------------------------------
if(${${PROJECT_NAME}_USE_OMNI})
list(APPEND CMAKE_MODULE_PATH ${VRPN_INCLUDE_DIR}/cmake)
find_package(OpenHaptics)
list(REMOVE_ITEM CMAKE_MODULE_PATH ${VRPN_INCLUDE_DIR}/cmake)
find_library(VRPN_PHANTOM_LIBRARY
NAMES
vrpn_phantom
vrpn_phantomd
)
mark_as_advanced(VRPN_PHANTOM_LIBRARY)
list(APPEND VRPN_LIBRARIES ${VRPN_PHANTOM_LIBRARY} ${OPENHAPTICS_LIBRARIES})
list(APPEND VRPN_INCLUDE_DIRS ${OPENHAPTICS_INCLUDE_DIRS})
endif()
message(STATUS "OPENHAPTICS_LIBRARIES : ${OPENHAPTICS_LIBRARIES}")
message(STATUS "OPENHAPTICS_INCLUDE_DIRS : ${OPENHAPTICS_INCLUDE_DIRS}")
#-----------------------------------------------------------------------------
# Find package
#-----------------------------------------------------------------------------
......
......@@ -36,7 +36,7 @@ include( ${VTK_USE_FILE} )
find_package( VRPN REQUIRED )
include_directories( ${VRPN_INCLUDE_DIRS} )
add_definitions( -DVRPN_USE_LIBNIFALCON )
if(${PROJECT_NAME}_USE_OMNI)
if(iMSTK_USE_OMNI)
add_definitions( -DiMSTK_USE_OPENHAPTICS )
add_definitions( -DVRPN_USE_PHANTOM_SERVER )
else()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment