diff --git a/src/psmoveservice/Device/Manager/TrackerManager.cpp b/src/psmoveservice/Device/Manager/TrackerManager.cpp index 4b671490..bc189720 100644 --- a/src/psmoveservice/Device/Manager/TrackerManager.cpp +++ b/src/psmoveservice/Device/Manager/TrackerManager.cpp @@ -17,6 +17,7 @@ TrackerManagerConfig::TrackerManagerConfig(const std::string &fnamebase) optical_tracking_timeout= 100; tracker_sleep_ms = 1; use_bgr_to_hsv_lookup_table = true; + exclude_opposed_cameras = false; default_tracker_profile.exposure = 32; default_tracker_profile.gain = 32; default_tracker_profile.color_preset_table.table_name= "default_tracker_profile"; @@ -36,6 +37,8 @@ TrackerManagerConfig::config2ptree() pt.put("optical_tracking_timeout", optical_tracking_timeout); pt.put("use_bgr_to_hsv_lookup_table", use_bgr_to_hsv_lookup_table); pt.put("tracker_sleep_ms", tracker_sleep_ms); + + pt.put("excluded_opposed_cameras", exclude_opposed_cameras); pt.put("default_tracker_profile.exposure", default_tracker_profile.exposure); pt.put("default_tracker_profile.gain", default_tracker_profile.gain); @@ -55,6 +58,7 @@ TrackerManagerConfig::ptree2config(const boost::property_tree::ptree &pt) optical_tracking_timeout= pt.get("optical_tracking_timeout", optical_tracking_timeout); use_bgr_to_hsv_lookup_table = pt.get("use_bgr_to_hsv_lookup_table", use_bgr_to_hsv_lookup_table); tracker_sleep_ms = pt.get("tracker_sleep_ms", tracker_sleep_ms); + exclude_opposed_cameras = pt.get("excluded_opposed_cameras", exclude_opposed_cameras); default_tracker_profile.exposure = pt.get("default_tracker_profile.exposure", 32); default_tracker_profile.gain = pt.get("default_tracker_profile.gain", 32); diff --git a/src/psmoveservice/Device/Manager/TrackerManager.h b/src/psmoveservice/Device/Manager/TrackerManager.h index ecf018fc..6d3d7e07 100644 --- a/src/psmoveservice/Device/Manager/TrackerManager.h +++ b/src/psmoveservice/Device/Manager/TrackerManager.h @@ -46,6 +46,7 @@ class TrackerManagerConfig : public PSMoveConfig int optical_tracking_timeout; int tracker_sleep_ms; bool use_bgr_to_hsv_lookup_table; + bool exclude_opposed_cameras; TrackerProfile default_tracker_profile; }; diff --git a/src/psmoveservice/Device/View/ServerControllerView.cpp b/src/psmoveservice/Device/View/ServerControllerView.cpp index deb85f54..2727d1a4 100644 --- a/src/psmoveservice/Device/View/ServerControllerView.cpp +++ b/src/psmoveservice/Device/View/ServerControllerView.cpp @@ -389,6 +389,8 @@ void ServerControllerView::updateOpticalPoseEstimation(TrackerManager* tracker_m position2d_list[list_index] = tracker->projectTrackerRelativePosition(&positionEstimate.position); } + const TrackerManagerConfig &cfg = DeviceManager::getInstance()->m_tracker_manager->getConfig(); + int pair_count = 0; CommonDevicePosition average_world_position = { 0.f, 0.f, 0.f }; for (int list_index = 0; list_index < positions_found; ++list_index) @@ -403,6 +405,14 @@ void ServerControllerView::updateOpticalPoseEstimation(TrackerManager* tracker_m const CommonDeviceScreenLocation &other_screen_location = position2d_list[other_list_index]; const ServerTrackerViewPtr other_tracker = tracker_manager->getTrackerViewPtr(other_tracker_id); + // if trackers are on poposite sides + if (cfg.exclude_opposed_cameras) { + if ((tracker->getTrackerPose().Position.x > 0) == (other_tracker->getTrackerPose().Position.x < 0) && + (tracker->getTrackerPose().Position.z > 0) == (other_tracker->getTrackerPose().Position.z < 0)) { + continue; + } + } + // Using the screen locations on two different trackers we can triangulate a world position CommonDevicePosition world_position = ServerTrackerView::triangulateWorldPosition(