Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/cboulay/PSMoveService
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterSloth committed Nov 13, 2016
2 parents 2ce0294 + ca440f9 commit 2134c89
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/psmoveservice/Device/Manager/TrackerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand All @@ -55,6 +58,7 @@ TrackerManagerConfig::ptree2config(const boost::property_tree::ptree &pt)
optical_tracking_timeout= pt.get<int>("optical_tracking_timeout", optical_tracking_timeout);
use_bgr_to_hsv_lookup_table = pt.get<bool>("use_bgr_to_hsv_lookup_table", use_bgr_to_hsv_lookup_table);
tracker_sleep_ms = pt.get<int>("tracker_sleep_ms", tracker_sleep_ms);
exclude_opposed_cameras = pt.get<bool>("excluded_opposed_cameras", exclude_opposed_cameras);

default_tracker_profile.exposure = pt.get<float>("default_tracker_profile.exposure", 32);
default_tracker_profile.gain = pt.get<float>("default_tracker_profile.gain", 32);
Expand Down
1 change: 1 addition & 0 deletions src/psmoveservice/Device/Manager/TrackerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
10 changes: 10 additions & 0 deletions src/psmoveservice/Device/View/ServerControllerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down

0 comments on commit 2134c89

Please sign in to comment.