{"action":"created","comment":{"url":"https://api.github.com/repos/wavelab/mcptam/pulls/comments/67758558","id":67758558,"diff_hunk":"@@ -1895,3 +1968,157 @@ void Tracker::CollectNearestPoints(KeyFrame& kf, std::set<MapPoint*>& spNearestP\n     }\n   }\n }\n+\n+void Tracker::UpdateCamsFromWorld(MultiKeyFrame* mpTempMKF)\n+{\n+    for(KeyFramePtrMap::iterator kf_it = mpTempMKF->mmpKeyFrames.begin(); kf_it != mpTempMKF->mmpKeyFrames.end(); ++kf_it)\n+    {\n+        kf_it->second->mse3CamFromWorld = kf_it->second->mse3CamFromBase * mpTempMKF->mse3BaseFromWorld; // CHECK!! GOOD\n+    }\n+}\n+\n+void Tracker::RecordMeasurementsAndBufferKeyFrame()\n+{\n+\n+    //save all the tracker measurements\n+\n+    //create a temporary MKF, copy over current MKF\n+    MultiKeyFrame* mpTempMKF =  mpCurrentMKF->CopyMultiKeyFramePartial();\n+    UpdateCamsFromWorld(mpTempMKF);\n+    mpTempMKF->isBufferMKF = true;\n+\n+    //create vector for holding all the tracker meas data\n+    //std::vector<TrackerMeasData> pvTrackerMeasData;\n+\n+    double totalEntropyReduction = 0;\n+    int totalEntropyPoints = 0;\n+    double totalPreviousEntropy = 0;\n+\n+    for(unsigned i=0; i < mvCurrCamNames.size(); ++i)\n+    {\n+        std::string camName = mvCurrCamNames[i];\n+        KeyFrame& kf = *mpTempMKF->mmpKeyFrames[camName];\n+\n+        for(TrackerDataPtrVector::iterator td_it = mvIterationSets[i].begin(); td_it!= mvIterationSets[i].end(); ++td_it)\n+        {\n+            TrackerData td = *(*td_it);\n+\n+            if(!td.mbFound || td.mPoint.mbBad)\n+                continue;\n+\n+            Measurement* pMeas = new Measurement;\n+            pMeas->eSource = Measurement::SRC_TRACKER;\n+            pMeas->v2RootPos = td.mv2Found;\n+            pMeas->nLevel = td.mnSearchLevel;\n+            pMeas->bSubPix = td.mbDidSubPix;\n+\n+            MapPoint& point = td.mPoint;\n+            kf.AddMeasurement(&point, pMeas); //add this measurement to the kf\n+\n+            double priorPointCovariance = point.depthCovariance;\n+            double prevPointEntropy = 0;\n+\n+            if( !std::isfinite(priorPointCovariance) || priorPointCovariance < 1e-7) //todo (adas): don't hardcode these\n+                priorPointCovariance = 1e-8;\n+\n+            double entropyReduction = EvaluatePoint(this, point, kf, priorPointCovariance, pMeas->nLevel, prevPointEntropy);\n+\n+            if(!isnan(entropyReduction) ) //if non NAN, todo (adas) need to figure out why nan, probably ill conditioned covariance\n+            {\n+                totalPreviousEntropy+=prevPointEntropy;\n+                totalEntropyReduction +=entropyReduction;\n+                totalEntropyPoints++;\n+\n+            }\n+        }\n+    }\n+\n+    mvKeyFrameBuffer.push_back(mpTempMKF); //store the MKF\n+    //ROS_INFO(\"Tracker: Buffering keyframe: %ld\", mvKeyFrameBuffer.size());\n+    //ROS_INFO(\"Tracker: Total MKF Entropy Reduction is: %f\", totalEntropyReduction);\n+\n+    score_pair mp; mp.first = totalEntropyReduction; mp.second = mvKeyFrameBuffer.size() - 1;\n+    vKeyframeScores.push_back(mp);\n+\n+    if(totalEntropyReduction > bestBufferKeyframeScore) //if we have a new winner\n+    {\n+        bestBufferKeyframeScore = totalEntropyReduction;\n+        bestBufferKeyframeIndex = mvKeyFrameBuffer.size() - 1;\n+    }\n+\n+\n+}\n+\n+void Tracker::AddNewKeyFrameFromBuffer(int bufferPosition)\n+{\n+    if( (int)mvKeyFrameBuffer.size() < bufferPosition) //exceeding index\n+        return;\n+\n+    static GVars3::gvar3<int> gvnCrossCamera(\"CrossCamera\", 1, GVars3::HIDDEN|GVars3::SILENT);\n+    //note: should check to make sure index doesnt exceed buffer size\n+\n+    //pull out the keyframe from the buffer\n+    MultiKeyFrame* mpTempMKF =  mvKeyFrameBuffer[bufferPosition];\n+\n+    //set it's status to NOT a bufferkeyframe (it's getting inserted into the map!\n+    mpTempMKF->isBufferMKF = false;\n+\n+    //iterate through all the measurements in the chosen MKF and all all the measurements to the map points\n+    //boost::mutex::scoped_lock lock(mMap.mMutex);\n+    for(KeyFramePtrMap::iterator it = mpTempMKF->mmpKeyFrames.begin(); it != mpTempMKF->mmpKeyFrames.end(); ++it)\n+    {\n+        std::string cName = (it->first);\n+        KeyFrame* kf = (it->second);\n+\n+        //std::cout<<\"At Keyframe %x \" << &kf <<std::endl;\n+\n+        //iterate through each measurement map in the keyframe\n+        std::vector<MapPoint*> ptsToDelete;\n+        for(MeasPtrMap::iterator it_mp = kf->mmpMeasurements.begin(); it_mp != kf->mmpMeasurements.end(); ++it_mp)\n+        {\n+            MapPoint& kf_point = *(it_mp->first);\n+\n+            //IMPORTANT: check to see if the pointer is still in the map! It may have been trashed by the map maker\n+            if(std::count(mMap.mlpPoints.begin(), mMap.mlpPoints.end(), &kf_point)) //is the point still in the map??\n+            {\n+                //if(kf_point.mMMData.spMeasurementKFs.count(kf)) //if its not in there already, or is bad (bad points taken car of when handed to map maker)\n+                //continue;\n+\n+                //std::cout<<\"inserting keyframe \" << kf.mCamName << \" at point %x \" <<  &kf_point <<std::endl;","path":"src/Tracker.cpp","position":null,"original_position":253,"commit_id":"f02feeb44be6f7ecc1c7021acbeed022742ab840","original_commit_id":"eff720e27aee5b7f9fc6412a450c74d9984ad1a4","user":{"login":"arunxdas","id":4700735,"avatar_url":"https://avatars.githubusercontent.com/u/4700735?v=3","gravatar_id":"","url":"https://api.github.com/users/arunxdas","html_url":"https://github.com/arunxdas","followers_url":"https://api.github.com/users/arunxdas/followers","following_url":"https://api.github.com/users/arunxdas/following{/other_user}","gists_url":"https://api.github.com/users/arunxdas/gists{/gist_id}","starred_url":"https://api.github.com/users/arunxdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunxdas/subscriptions","organizations_url":"https://api.github.com/users/arunxdas/orgs","repos_url":"https://api.github.com/users/arunxdas/repos","events_url":"https://api.github.com/users/arunxdas/events{/privacy}","received_events_url":"https://api.github.com/users/arunxdas/received_events","type":"User","site_admin":false},"body":"@SabaAflaki yes, the comment can be removed","created_at":"2016-06-20T20:17:45Z","updated_at":"2016-06-20T20:17:45Z","html_url":"https://github.com/wavelab/mcptam/pull/44#discussion_r67758558","pull_request_url":"https://api.github.com/repos/wavelab/mcptam/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/comments/67758558"},"html":{"href":"https://github.com/wavelab/mcptam/pull/44#discussion_r67758558"},"pull_request":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/wavelab/mcptam/pulls/44","id":69412238,"html_url":"https://github.com/wavelab/mcptam/pull/44","diff_url":"https://github.com/wavelab/mcptam/pull/44.diff","patch_url":"https://github.com/wavelab/mcptam/pull/44.patch","issue_url":"https://api.github.com/repos/wavelab/mcptam/issues/44","number":44,"state":"open","locked":false,"title":"Cper manual merge","user":{"login":"SabaAflaki","id":5836045,"avatar_url":"https://avatars.githubusercontent.com/u/5836045?v=3","gravatar_id":"","url":"https://api.github.com/users/SabaAflaki","html_url":"https://github.com/SabaAflaki","followers_url":"https://api.github.com/users/SabaAflaki/followers","following_url":"https://api.github.com/users/SabaAflaki/following{/other_user}","gists_url":"https://api.github.com/users/SabaAflaki/gists{/gist_id}","starred_url":"https://api.github.com/users/SabaAflaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SabaAflaki/subscriptions","organizations_url":"https://api.github.com/users/SabaAflaki/orgs","repos_url":"https://api.github.com/users/SabaAflaki/repos","events_url":"https://api.github.com/users/SabaAflaki/events{/privacy}","received_events_url":"https://api.github.com/users/SabaAflaki/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-09T21:15:07Z","updated_at":"2016-06-20T20:17:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02073abc13a606440caee38b0eb42db70b4580c8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wavelab/mcptam/pulls/44/commits","review_comments_url":"https://api.github.com/repos/wavelab/mcptam/pulls/44/comments","review_comment_url":"https://api.github.com/repos/wavelab/mcptam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wavelab/mcptam/issues/44/comments","statuses_url":"https://api.github.com/repos/wavelab/mcptam/statuses/f02feeb44be6f7ecc1c7021acbeed022742ab840","head":{"label":"wavelab:cper_manual_merge","ref":"cper_manual_merge","sha":"f02feeb44be6f7ecc1c7021acbeed022742ab840","user":{"login":"wavelab","id":13383159,"avatar_url":"https://avatars.githubusercontent.com/u/13383159?v=3","gravatar_id":"","url":"https://api.github.com/users/wavelab","html_url":"https://github.com/wavelab","followers_url":"https://api.github.com/users/wavelab/followers","following_url":"https://api.github.com/users/wavelab/following{/other_user}","gists_url":"https://api.github.com/users/wavelab/gists{/gist_id}","starred_url":"https://api.github.com/users/wavelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wavelab/subscriptions","organizations_url":"https://api.github.com/users/wavelab/orgs","repos_url":"https://api.github.com/users/wavelab/repos","events_url":"https://api.github.com/users/wavelab/events{/privacy}","received_events_url":"https://api.github.com/users/wavelab/received_events","type":"Organization","site_admin":false},"repo":{"id":39262776,"name":"mcptam","full_name":"wavelab/mcptam","owner":{"login":"wavelab","id":13383159,"avatar_url":"https://avatars.githubusercontent.com/u/13383159?v=3","gravatar_id":"","url":"https://api.github.com/users/wavelab","html_url":"https://github.com/wavelab","followers_url":"https://api.github.com/users/wavelab/followers","following_url":"https://api.github.com/users/wavelab/following{/other_user}","gists_url":"https://api.github.com/users/wavelab/gists{/gist_id}","starred_url":"https://api.github.com/users/wavelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wavelab/subscriptions","organizations_url":"https://api.github.com/users/wavelab/orgs","repos_url":"https://api.github.com/users/wavelab/repos","events_url":"https://api.github.com/users/wavelab/events{/privacy}","received_events_url":"https://api.github.com/users/wavelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wavelab/mcptam","description":"MCPTAM is a set of ROS nodes for running Real-time 3D Visual Simultaneous Localization and Mapping (SLAM) using Multi-Camera Clusters. It includes tools for calibrating both the intrinsic and extrinsic parameters of the individual cameras within the rigid camera rig.","fork":true,"url":"https://api.github.com/repos/wavelab/mcptam","forks_url":"https://api.github.com/repos/wavelab/mcptam/forks","keys_url":"https://api.github.com/repos/wavelab/mcptam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wavelab/mcptam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wavelab/mcptam/teams","hooks_url":"https://api.github.com/repos/wavelab/mcptam/hooks","issue_events_url":"https://api.github.com/repos/wavelab/mcptam/issues/events{/number}","events_url":"https://api.github.com/repos/wavelab/mcptam/events","assignees_url":"https://api.github.com/repos/wavelab/mcptam/assignees{/user}","branches_url":"https://api.github.com/repos/wavelab/mcptam/branches{/branch}","tags_url":"https://api.github.com/repos/wavelab/mcptam/tags","blobs_url":"https://api.github.com/repos/wavelab/mcptam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wavelab/mcptam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wavelab/mcptam/git/refs{/sha}","trees_url":"https://api.github.com/repos/wavelab/mcptam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wavelab/mcptam/statuses/{sha}","languages_url":"https://api.github.com/repos/wavelab/mcptam/languages","stargazers_url":"https://api.github.com/repos/wavelab/mcptam/stargazers","contributors_url":"https://api.github.com/repos/wavelab/mcptam/contributors","subscribers_url":"https://api.github.com/repos/wavelab/mcptam/subscribers","subscription_url":"https://api.github.com/repos/wavelab/mcptam/subscription","commits_url":"https://api.github.com/repos/wavelab/mcptam/commits{/sha}","git_commits_url":"https://api.github.com/repos/wavelab/mcptam/git/commits{/sha}","comments_url":"https://api.github.com/repos/wavelab/mcptam/comments{/number}","issue_comment_url":"https://api.github.com/repos/wavelab/mcptam/issues/comments{/number}","contents_url":"https://api.github.com/repos/wavelab/mcptam/contents/{+path}","compare_url":"https://api.github.com/repos/wavelab/mcptam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wavelab/mcptam/merges","archive_url":"https://api.github.com/repos/wavelab/mcptam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wavelab/mcptam/downloads","issues_url":"https://api.github.com/repos/wavelab/mcptam/issues{/number}","pulls_url":"https://api.github.com/repos/wavelab/mcptam/pulls{/number}","milestones_url":"https://api.github.com/repos/wavelab/mcptam/milestones{/number}","notifications_url":"https://api.github.com/repos/wavelab/mcptam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wavelab/mcptam/labels{/name}","releases_url":"https://api.github.com/repos/wavelab/mcptam/releases{/id}","deployments_url":"https://api.github.com/repos/wavelab/mcptam/deployments","created_at":"2015-07-17T16:03:06Z","updated_at":"2016-06-02T01:45:28Z","pushed_at":"2016-06-20T09:23:44Z","git_url":"git://github.com/wavelab/mcptam.git","ssh_url":"git@github.com:wavelab/mcptam.git","clone_url":"https://github.com/wavelab/mcptam.git","svn_url":"https://github.com/wavelab/mcptam","homepage":"","size":2354,"stargazers_count":6,"watchers_count":6,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":34,"forks":2,"open_issues":34,"watchers":6,"default_branch":"master"}},"base":{"label":"wavelab:master","ref":"master","sha":"8776c958b4559c56449a029c0f27cb251ce7c9ae","user":{"login":"wavelab","id":13383159,"avatar_url":"https://avatars.githubusercontent.com/u/13383159?v=3","gravatar_id":"","url":"https://api.github.com/users/wavelab","html_url":"https://github.com/wavelab","followers_url":"https://api.github.com/users/wavelab/followers","following_url":"https://api.github.com/users/wavelab/following{/other_user}","gists_url":"https://api.github.com/users/wavelab/gists{/gist_id}","starred_url":"https://api.github.com/users/wavelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wavelab/subscriptions","organizations_url":"https://api.github.com/users/wavelab/orgs","repos_url":"https://api.github.com/users/wavelab/repos","events_url":"https://api.github.com/users/wavelab/events{/privacy}","received_events_url":"https://api.github.com/users/wavelab/received_events","type":"Organization","site_admin":false},"repo":{"id":39262776,"name":"mcptam","full_name":"wavelab/mcptam","owner":{"login":"wavelab","id":13383159,"avatar_url":"https://avatars.githubusercontent.com/u/13383159?v=3","gravatar_id":"","url":"https://api.github.com/users/wavelab","html_url":"https://github.com/wavelab","followers_url":"https://api.github.com/users/wavelab/followers","following_url":"https://api.github.com/users/wavelab/following{/other_user}","gists_url":"https://api.github.com/users/wavelab/gists{/gist_id}","starred_url":"https://api.github.com/users/wavelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wavelab/subscriptions","organizations_url":"https://api.github.com/users/wavelab/orgs","repos_url":"https://api.github.com/users/wavelab/repos","events_url":"https://api.github.com/users/wavelab/events{/privacy}","received_events_url":"https://api.github.com/users/wavelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wavelab/mcptam","description":"MCPTAM is a set of ROS nodes for running Real-time 3D Visual Simultaneous Localization and Mapping (SLAM) using Multi-Camera Clusters. It includes tools for calibrating both the intrinsic and extrinsic parameters of the individual cameras within the rigid camera rig.","fork":true,"url":"https://api.github.com/repos/wavelab/mcptam","forks_url":"https://api.github.com/repos/wavelab/mcptam/forks","keys_url":"https://api.github.com/repos/wavelab/mcptam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wavelab/mcptam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wavelab/mcptam/teams","hooks_url":"https://api.github.com/repos/wavelab/mcptam/hooks","issue_events_url":"https://api.github.com/repos/wavelab/mcptam/issues/events{/number}","events_url":"https://api.github.com/repos/wavelab/mcptam/events","assignees_url":"https://api.github.com/repos/wavelab/mcptam/assignees{/user}","branches_url":"https://api.github.com/repos/wavelab/mcptam/branches{/branch}","tags_url":"https://api.github.com/repos/wavelab/mcptam/tags","blobs_url":"https://api.github.com/repos/wavelab/mcptam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wavelab/mcptam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wavelab/mcptam/git/refs{/sha}","trees_url":"https://api.github.com/repos/wavelab/mcptam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wavelab/mcptam/statuses/{sha}","languages_url":"https://api.github.com/repos/wavelab/mcptam/languages","stargazers_url":"https://api.github.com/repos/wavelab/mcptam/stargazers","contributors_url":"https://api.github.com/repos/wavelab/mcptam/contributors","subscribers_url":"https://api.github.com/repos/wavelab/mcptam/subscribers","subscription_url":"https://api.github.com/repos/wavelab/mcptam/subscription","commits_url":"https://api.github.com/repos/wavelab/mcptam/commits{/sha}","git_commits_url":"https://api.github.com/repos/wavelab/mcptam/git/commits{/sha}","comments_url":"https://api.github.com/repos/wavelab/mcptam/comments{/number}","issue_comment_url":"https://api.github.com/repos/wavelab/mcptam/issues/comments{/number}","contents_url":"https://api.github.com/repos/wavelab/mcptam/contents/{+path}","compare_url":"https://api.github.com/repos/wavelab/mcptam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wavelab/mcptam/merges","archive_url":"https://api.github.com/repos/wavelab/mcptam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wavelab/mcptam/downloads","issues_url":"https://api.github.com/repos/wavelab/mcptam/issues{/number}","pulls_url":"https://api.github.com/repos/wavelab/mcptam/pulls{/number}","milestones_url":"https://api.github.com/repos/wavelab/mcptam/milestones{/number}","notifications_url":"https://api.github.com/repos/wavelab/mcptam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wavelab/mcptam/labels{/name}","releases_url":"https://api.github.com/repos/wavelab/mcptam/releases{/id}","deployments_url":"https://api.github.com/repos/wavelab/mcptam/deployments","created_at":"2015-07-17T16:03:06Z","updated_at":"2016-06-02T01:45:28Z","pushed_at":"2016-06-20T09:23:44Z","git_url":"git://github.com/wavelab/mcptam.git","ssh_url":"git@github.com:wavelab/mcptam.git","clone_url":"https://github.com/wavelab/mcptam.git","svn_url":"https://github.com/wavelab/mcptam","homepage":"","size":2354,"stargazers_count":6,"watchers_count":6,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":34,"forks":2,"open_issues":34,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/44"},"html":{"href":"https://github.com/wavelab/mcptam/pull/44"},"issue":{"href":"https://api.github.com/repos/wavelab/mcptam/issues/44"},"comments":{"href":"https://api.github.com/repos/wavelab/mcptam/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wavelab/mcptam/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/wavelab/mcptam/statuses/f02feeb44be6f7ecc1c7021acbeed022742ab840"}}}}
{"actor":{"display_login":"arunxdas"}}