{"action":"created","comment":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/105420002","pull_request_review_id":26287286,"id":105420002,"diff_hunk":"@@ -177,6 +178,120 @@ TEST(HybridGridTest, TestIteration) {\n   }\n }\n \n+TEST(HybridGridTest, ToProto) {\n+  HybridGrid hybrid_grid(2.f, Eigen::Vector3f(-7.f, -12.f, 0.f));\n+\n+  auto proto = ToProto(hybrid_grid);\n+  EXPECT_EQ(hybrid_grid.resolution(), proto.resolution());\n+  EXPECT_EQ(hybrid_grid.origin().x(), proto.origin().x());\n+  EXPECT_EQ(hybrid_grid.origin().y(), proto.origin().y());\n+  EXPECT_EQ(hybrid_grid.origin().z(), proto.origin().z());\n+\n+  // Make sure the grid's empty.\n+  EXPECT_EQ(0, proto.indices_size());\n+  EXPECT_EQ(0, proto.values_size());\n+\n+  double p = 0.;\n+  for (int i = -1; i <= 1; ++i) {\n+    for (int j = -2; j <= 2; ++j) {\n+      for (int k = -3; k <= 3; ++k) {\n+        hybrid_grid.SetProbability({i, j, k}, p);\n+        p += 0.001;\n+      }\n+    }\n+  }\n+\n+  int grid_size = 0;\n+  for (auto it = hybrid_grid.begin(); it != hybrid_grid.end(); ++it) {\n+    grid_size++;\n+  }\n+  // 105 is the hand-verified number of times we added something.\n+  ASSERT_EQ(105, grid_size);\n+\n+  proto = ToProto(hybrid_grid);\n+  ASSERT_EQ(grid_size, proto.indices_size());\n+  ASSERT_EQ(grid_size, proto.values_size());\n+\n+  int proto_index = 0;\n+  for (const auto& entry : hybrid_grid) {\n+    Eigen::Vector3i index = entry.first;\n+    // ASSERT rather than EXPECT to avoid hundreds of stack traces.\n+    ASSERT_EQ(index.x(), proto.indices(proto_index).x());\n+    ASSERT_EQ(index.y(), proto.indices(proto_index).y());\n+    ASSERT_EQ(index.z(), proto.indices(proto_index).z());\n+    ASSERT_EQ(entry.second, proto.values(proto_index));\n+    proto_index++;\n+  }\n+}\n+\n+namespace {\n+\n+struct EigenComparator {\n+  bool operator()(const Eigen::Vector3i lhs, const Eigen::Vector3i& rhs) {\n+    return (lhs.x() < rhs.x()) || (lhs.x() == rhs.x() && lhs.y() < rhs.y()) ||","path":"cartographer/mapping_3d/hybrid_grid_test.cc","position":62,"original_position":62,"commit_id":"237a2602f1779e5892185db8d2998782295046ed","original_commit_id":"237a2602f1779e5892185db8d2998782295046ed","user":{"login":"wohe","id":12056038,"avatar_url":"https://avatars2.githubusercontent.com/u/12056038?v=3","gravatar_id":"","url":"https://api.github.com/users/wohe","html_url":"https://github.com/wohe","followers_url":"https://api.github.com/users/wohe/followers","following_url":"https://api.github.com/users/wohe/following{/other_user}","gists_url":"https://api.github.com/users/wohe/gists{/gist_id}","starred_url":"https://api.github.com/users/wohe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wohe/subscriptions","organizations_url":"https://api.github.com/users/wohe/orgs","repos_url":"https://api.github.com/users/wohe/repos","events_url":"https://api.github.com/users/wohe/events{/privacy}","received_events_url":"https://api.github.com/users/wohe/received_events","type":"User","site_admin":false},"body":"Use `<tuple>` and do\r\n```\r\nreturn std::forward_as_tuple(lhs.x(), lhs.y(), lhs.z()) <\r\n    std::forward_as_tuple(rhs.x(), rhs.y(), rhs.z());\r\n```\r\nor so?","created_at":"2017-03-10T15:32:58Z","updated_at":"2017-03-10T15:36:10Z","html_url":"https://github.com/googlecartographer/cartographer/pull/220#discussion_r105420002","pull_request_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220","_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/105420002"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/220#discussion_r105420002"},"pull_request":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220"}}},"pull_request":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220","id":110030534,"html_url":"https://github.com/googlecartographer/cartographer/pull/220","diff_url":"https://github.com/googlecartographer/cartographer/pull/220.diff","patch_url":"https://github.com/googlecartographer/cartographer/pull/220.patch","issue_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/220","number":220,"state":"open","locked":false,"title":"HybridGrid proto.","user":{"login":"macmason","id":1613522,"avatar_url":"https://avatars3.githubusercontent.com/u/1613522?v=3","gravatar_id":"","url":"https://api.github.com/users/macmason","html_url":"https://github.com/macmason","followers_url":"https://api.github.com/users/macmason/followers","following_url":"https://api.github.com/users/macmason/following{/other_user}","gists_url":"https://api.github.com/users/macmason/gists{/gist_id}","starred_url":"https://api.github.com/users/macmason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macmason/subscriptions","organizations_url":"https://api.github.com/users/macmason/orgs","repos_url":"https://api.github.com/users/macmason/repos","events_url":"https://api.github.com/users/macmason/events{/privacy}","received_events_url":"https://api.github.com/users/macmason/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-09T23:37:51Z","updated_at":"2017-03-10T15:36:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e15871fe9bf654d92e36ab9d21020b2ba678fb5a","assignee":{"login":"wohe","id":12056038,"avatar_url":"https://avatars2.githubusercontent.com/u/12056038?v=3","gravatar_id":"","url":"https://api.github.com/users/wohe","html_url":"https://github.com/wohe","followers_url":"https://api.github.com/users/wohe/followers","following_url":"https://api.github.com/users/wohe/following{/other_user}","gists_url":"https://api.github.com/users/wohe/gists{/gist_id}","starred_url":"https://api.github.com/users/wohe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wohe/subscriptions","organizations_url":"https://api.github.com/users/wohe/orgs","repos_url":"https://api.github.com/users/wohe/repos","events_url":"https://api.github.com/users/wohe/events{/privacy}","received_events_url":"https://api.github.com/users/wohe/received_events","type":"User","site_admin":false},"assignees":[{"login":"wohe","id":12056038,"avatar_url":"https://avatars2.githubusercontent.com/u/12056038?v=3","gravatar_id":"","url":"https://api.github.com/users/wohe","html_url":"https://github.com/wohe","followers_url":"https://api.github.com/users/wohe/followers","following_url":"https://api.github.com/users/wohe/following{/other_user}","gists_url":"https://api.github.com/users/wohe/gists{/gist_id}","starred_url":"https://api.github.com/users/wohe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wohe/subscriptions","organizations_url":"https://api.github.com/users/wohe/orgs","repos_url":"https://api.github.com/users/wohe/repos","events_url":"https://api.github.com/users/wohe/events{/privacy}","received_events_url":"https://api.github.com/users/wohe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220/commits","review_comments_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220/comments","review_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/220/comments","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/237a2602f1779e5892185db8d2998782295046ed","head":{"label":"macmason:hybrid_grid_proto","ref":"hybrid_grid_proto","sha":"237a2602f1779e5892185db8d2998782295046ed","user":{"login":"macmason","id":1613522,"avatar_url":"https://avatars3.githubusercontent.com/u/1613522?v=3","gravatar_id":"","url":"https://api.github.com/users/macmason","html_url":"https://github.com/macmason","followers_url":"https://api.github.com/users/macmason/followers","following_url":"https://api.github.com/users/macmason/following{/other_user}","gists_url":"https://api.github.com/users/macmason/gists{/gist_id}","starred_url":"https://api.github.com/users/macmason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macmason/subscriptions","organizations_url":"https://api.github.com/users/macmason/orgs","repos_url":"https://api.github.com/users/macmason/repos","events_url":"https://api.github.com/users/macmason/events{/privacy}","received_events_url":"https://api.github.com/users/macmason/received_events","type":"User","site_admin":false},"repo":{"id":83492320,"name":"cartographer","full_name":"macmason/cartographer","owner":{"login":"macmason","id":1613522,"avatar_url":"https://avatars3.githubusercontent.com/u/1613522?v=3","gravatar_id":"","url":"https://api.github.com/users/macmason","html_url":"https://github.com/macmason","followers_url":"https://api.github.com/users/macmason/followers","following_url":"https://api.github.com/users/macmason/following{/other_user}","gists_url":"https://api.github.com/users/macmason/gists{/gist_id}","starred_url":"https://api.github.com/users/macmason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macmason/subscriptions","organizations_url":"https://api.github.com/users/macmason/orgs","repos_url":"https://api.github.com/users/macmason/repos","events_url":"https://api.github.com/users/macmason/events{/privacy}","received_events_url":"https://api.github.com/users/macmason/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/macmason/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":true,"url":"https://api.github.com/repos/macmason/cartographer","forks_url":"https://api.github.com/repos/macmason/cartographer/forks","keys_url":"https://api.github.com/repos/macmason/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macmason/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macmason/cartographer/teams","hooks_url":"https://api.github.com/repos/macmason/cartographer/hooks","issue_events_url":"https://api.github.com/repos/macmason/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/macmason/cartographer/events","assignees_url":"https://api.github.com/repos/macmason/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/macmason/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/macmason/cartographer/tags","blobs_url":"https://api.github.com/repos/macmason/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macmason/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macmason/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/macmason/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macmason/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/macmason/cartographer/languages","stargazers_url":"https://api.github.com/repos/macmason/cartographer/stargazers","contributors_url":"https://api.github.com/repos/macmason/cartographer/contributors","subscribers_url":"https://api.github.com/repos/macmason/cartographer/subscribers","subscription_url":"https://api.github.com/repos/macmason/cartographer/subscription","commits_url":"https://api.github.com/repos/macmason/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/macmason/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/macmason/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/macmason/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/macmason/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/macmason/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macmason/cartographer/merges","archive_url":"https://api.github.com/repos/macmason/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macmason/cartographer/downloads","issues_url":"https://api.github.com/repos/macmason/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/macmason/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/macmason/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/macmason/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macmason/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/macmason/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/macmason/cartographer/deployments","created_at":"2017-03-01T00:13:14Z","updated_at":"2017-03-01T00:13:16Z","pushed_at":"2017-03-09T23:35:57Z","git_url":"git://github.com/macmason/cartographer.git","ssh_url":"git@github.com:macmason/cartographer.git","clone_url":"https://github.com/macmason/cartographer.git","svn_url":"https://github.com/macmason/cartographer","homepage":"","size":714,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlecartographer:master","ref":"master","sha":"8bf6f101c59e17f257188005a84e48bca08b28b9","user":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars0.githubusercontent.com/u/20636162?v=3","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"repo":{"id":64732358,"name":"cartographer","full_name":"googlecartographer/cartographer","owner":{"login":"googlecartographer","id":20636162,"avatar_url":"https://avatars0.githubusercontent.com/u/20636162?v=3","gravatar_id":"","url":"https://api.github.com/users/googlecartographer","html_url":"https://github.com/googlecartographer","followers_url":"https://api.github.com/users/googlecartographer/followers","following_url":"https://api.github.com/users/googlecartographer/following{/other_user}","gists_url":"https://api.github.com/users/googlecartographer/gists{/gist_id}","starred_url":"https://api.github.com/users/googlecartographer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlecartographer/subscriptions","organizations_url":"https://api.github.com/users/googlecartographer/orgs","repos_url":"https://api.github.com/users/googlecartographer/repos","events_url":"https://api.github.com/users/googlecartographer/events{/privacy}","received_events_url":"https://api.github.com/users/googlecartographer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlecartographer/cartographer","description":"Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.","fork":false,"url":"https://api.github.com/repos/googlecartographer/cartographer","forks_url":"https://api.github.com/repos/googlecartographer/cartographer/forks","keys_url":"https://api.github.com/repos/googlecartographer/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlecartographer/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlecartographer/cartographer/teams","hooks_url":"https://api.github.com/repos/googlecartographer/cartographer/hooks","issue_events_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/googlecartographer/cartographer/events","assignees_url":"https://api.github.com/repos/googlecartographer/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/googlecartographer/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/googlecartographer/cartographer/tags","blobs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlecartographer/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlecartographer/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlecartographer/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/googlecartographer/cartographer/languages","stargazers_url":"https://api.github.com/repos/googlecartographer/cartographer/stargazers","contributors_url":"https://api.github.com/repos/googlecartographer/cartographer/contributors","subscribers_url":"https://api.github.com/repos/googlecartographer/cartographer/subscribers","subscription_url":"https://api.github.com/repos/googlecartographer/cartographer/subscription","commits_url":"https://api.github.com/repos/googlecartographer/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlecartographer/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlecartographer/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/googlecartographer/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlecartographer/cartographer/merges","archive_url":"https://api.github.com/repos/googlecartographer/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlecartographer/cartographer/downloads","issues_url":"https://api.github.com/repos/googlecartographer/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/googlecartographer/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/googlecartographer/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlecartographer/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/googlecartographer/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/googlecartographer/cartographer/deployments","created_at":"2016-08-02T06:55:43Z","updated_at":"2017-03-09T16:53:30Z","pushed_at":"2017-03-09T23:37:52Z","git_url":"git://github.com/googlecartographer/cartographer.git","ssh_url":"git@github.com:googlecartographer/cartographer.git","clone_url":"https://github.com/googlecartographer/cartographer.git","svn_url":"https://github.com/googlecartographer/cartographer","homepage":"","size":709,"stargazers_count":2396,"watchers_count":2396,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":649,"mirror_url":null,"open_issues_count":14,"forks":649,"open_issues":14,"watchers":2396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/220"},"issue":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/220"},"comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/220/comments"},"review_comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220/comments"},"review_comment":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/220/commits"},"statuses":{"href":"https://api.github.com/repos/googlecartographer/cartographer/statuses/237a2602f1779e5892185db8d2998782295046ed"}}}}
{"actor":{"display_login":"wohe"}}