OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
328 stars 124 forks source link

`select timeout` issue in osvr_server - appears to be linked to videoBasedHMDTracker #491

Closed toastedcrumpets closed 7 years ago

toastedcrumpets commented 7 years ago

Build is from current master (0cae009) with patches to fix compilation on Ubuntu 16.04 (see my osvr-core fork for exact details, but they are minor changes).

Starting up the osvr_server using the osvr_server_config.HDK13ExtendedLandscape.sample.json configuration, running as root, the server outputs select timeout every 10 seconds. Using the tracker viewer demonstrates that IMU tracking is working; however the positional tracking seems not to work as it does on windows (missing comments on bringing the HMD into view, holding it still etc.).

Starting the server with `showDebug": true in the tracker plugin options, the debug window for the video tracker apppears, but only after minutes of delay and the window is unresponsive (appears to redraw when select timeouts occur).

Any ideas on this one? I would really like to play with positional tracking on Linux if at all possible.

Oct 17 01:23:32.162 info [OSVR]: 0x7f479a2aafcb/usr/local/bin/osvr_server
Oct 17 01:23:32.163 info [OSVR Server]: Using config file 'sample-configs/osvr_server_config.HDK13ExtendedLandscape.sample.json'.
Oct 17 01:23:32.163 info [OSVR Server]: Constructing server as configured...
Oct 17 01:23:32.163 info [OSVR Server]: Loading auto-loadable plugins...
Oct 17 01:23:32.199 info [OSVR Server]: Loading plugins...
Oct 17 01:23:32.199 info [OSVR Server]: Instantiating configured drivers...
Oct 17 01:23:32.199 info [OSVR Server]: Added device: org_osvr_filter_videoimufusion/HeadFusion
Oct 17 01:23:32.199 info [OSVR: org.osvr.analysisplugin]: OSVR client context initialized for org.osvr.analysisplugin
Oct 17 01:23:32.199 info [OSVR]: /home/mjki2mb2/OSVR-Core/src/osvr/Common/ClientInterface.cpp:38: Interface initialized for /com_osvr_Multiserver/OSVRHackerDevKitPrediction0/semantic/hmd
Oct 17 01:23:32.199 info [OSVR]: /home/mjki2mb2/OSVR-Core/src/osvr/Common/ClientInterface.cpp:38: Interface initialized for /com_osvr_VideoBasedHMDTracker/TrackedCamera0_0/semantic/hmd/front
Oct 17 01:23:32.199 info [OSVR Server]: Successes:
Oct 17 01:23:32.199 info [OSVR Server]:  - com_osvr_VideoBasedHMDTracker/VideoBasedHMDTracker
Oct 17 01:23:32.199 info [OSVR Server]:  - org_osvr_filter_videoimufusion/VideoIMUFusion
Oct 17 01:23:32.199 info [OSVR Server]: Aliases found and parsed from config file.
Oct 17 01:23:32.199 info [OSVR Server]: Display descriptor found and parsed from config file.
Oct 17 01:23:32.199 info [OSVR Server]: RenderManager config found and parsed from the config file.
Oct 17 01:23:32.199 info [OSVR Server]: Triggering automatic hardware detection...
Oct 17 01:23:32.199 info [OSVR Server]: Registering shutdown handler...
Oct 17 01:23:32.199 info [OSVR Server]: Starting server mainloop: OSVR Server is ready to go!
Oct 17 01:23:32.199 info [OSVR Server]: Performing hardware auto-detection.
Oct 17 01:23:32.319 info [OSVR Server]: Added device: com_osvr_Multiserver/OSVRHackerDevKit0
Oct 17 01:23:32.320 info [OSVR Server]: Added device: com_osvr_Multiserver/OSVRHackerDevKitPrediction0
Video-based tracker: Camera turned on!
Opening camera 0
Oct 17 01:23:32.463 info [OSVR Server]: Added device: com_osvr_VideoBasedHMDTracker/TrackedCamera0_0
Video-based tracker: NOTE: Beacon calibration filename videotrackerCombinedCalibrationFile13.json was specified, but not found or could not be loaded. This is not an error: This may just mean you have not yet run the optional beacon pre-calibration step.
Oct 17 01:23:32.464 info [OSVR]: /home/mjki2mb2/OSVR-Core/src/osvr/Client/AnalysisClientContext.cpp:76: Got updated path tree, processing
Oct 17 01:23:33.466 info [OSVR]: /home/mjki2mb2/OSVR-Core/src/osvr/Client/TrackerRemoteFactory.cpp:93: Constructed a TrackerHandler for com_osvr_Multiserver/OSVRHackerDevKitPrediction0@localhost:3883 sensor 0
Oct 17 01:23:33.466 info [OSVR: org.osvr.analysisplugin]: Successfully produced handler for /com_osvr_Multiserver/OSVRHackerDevKitPrediction0/semantic/hmd
Oct 17 01:23:33.466 info [OSVR]: /home/mjki2mb2/OSVR-Core/src/osvr/Client/TrackerRemoteFactory.cpp:93: Constructed a TrackerHandler for com_osvr_VideoBasedHMDTracker/TrackedCamera0_0@localhost:3883 sensor 0
Oct 17 01:23:33.466 info [OSVR: org.osvr.analysisplugin]: Successfully produced handler for /com_osvr_VideoBasedHMDTracker/TrackedCamera0_0/semantic/hmd/front
Oct 17 01:23:33.466 info [OSVR: org.osvr.analysisplugin]: Connected 2 of 2 unconnected paths successfully
Oct 17 01:23:33.466 info [OSVR Server]: Sent path tree to clients.
vrpn: Connection request received from 127.0.0.1: 127.0.0.1 53637
Oct 17 01:23:33.469 info [OSVR Server]: Performing hardware auto-detection.
Oct 17 01:23:33.530 info [OSVR Server]: Sent path tree to clients.
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout
select timeout

Video-based tracking debug windows help:
  - press 's' to show the detected blobs and the status of recognized beacons (default)
  - press 'b' to show the labeled blobs and the reprojected beacons
  - press 'i' to show the raw input image
  - press 't' to show the blob-detecting threshold image
  - press 'p' to dump the current auto-calibrated beacon positions to a CSV file
  - press 'q' to quit the debug windows (tracker will continue operation)

select timeout
godbyk commented 7 years ago

Possibly related and/or useful: https://github.com/OSVR/OSVR-Core/issues/339 and the uvc-camera branch.

toastedcrumpets commented 7 years ago

I checked out the uvc-camera branch, rebased against the current master (0cae00952a4badf1f22642473370d5e7962467b6) (without conflicts, the god of gits is smiling today), and this resolves my issues. I haven't actually tested tracking as I'm working remotely from my rig today, but I could see the debug window and an IR image of my office, without "select timeout" messages or any delay.

I'll close this issue and continue responding in issue #339 if tracking does not work.

diff --git a/plugins/videobasedtracker/CMakeLists.txt b/plugins/videobasedtracker/CMakeLists.txt
index 41293bd..3f1df21 100644
--- a/plugins/videobasedtracker/CMakeLists.txt
+++ b/plugins/videobasedtracker/CMakeLists.txt
@@ -67,6 +67,8 @@ endif()

 if(NOT WIN32)
     find_package(libuvc REQUIRED)
+    find_package(PkgConfig)
+    pkg_check_modules(LIBUSB libusb-1.0)
 endif()

 ###
@@ -120,8 +122,8 @@ if(WIN32)
     set_target_properties(ViewTrackingCamera PROPERTIES
         FOLDER "OSVR Plugins/Video-Based Tracker")
 else()
-    target_link_libraries(com_osvr_VideoBasedHMDTracker ${libuvc_LIBRARIES})
-    target_include_directories(com_osvr_VideoBasedHMDTracker PRIVATE ${libuvc_INCLUDE_DIRS})
+    target_link_libraries(com_osvr_VideoBasedHMDTracker ${libuvc_LIBRARIES} ${LIBUSB_LIBRARIES})
+    target_include_directories(com_osvr_VideoBasedHMDTracker PRIVATE ${libuvc_INCLUDE_DIRS} ${LIBUSB_INCLUDE_DIRS})
 endif()

 set_target_properties(com_osvr_VideoBasedHMDTracker PROPERTIES
toastedcrumpets commented 7 years ago

For future reference, this was resolved by updating the camera firmware from v5 to v7. On my windows 8.1 system, the camera firmware update tool erroneously stated I already had the firmware upgrade, but running lsusb -v -d 0bda:57e8 | grep bcdDevice on Linux gave the version as '0.05'. I switched to a windows 7 pc and found I could complete the firmware update, and the select timeout error was resolved.