{"action":"created","comment":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/196395143","pull_request_review_id":129904844,"id":196395143,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjM5NTE0Mw==","diff_hunk":"@@ -0,0 +1,78 @@\n+/*\n+ * Copyright 2018 The Cartographer Authors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#include \"cartographer/mapping/tsd_value_converter.h\"\n+\n+namespace cartographer {\n+namespace mapping {\n+\n+TSDValueConverter::TSDValueConverter(float max_tsdf, float max_weight)\n+    : kMaxTSD(max_tsdf),\n+      kMinTSD(-max_tsdf),\n+      kMaxWeight(max_weight),\n+      kValueToTSDF(PrecomputeValueToTSD()),\n+      kValueToWeight(PrecomputeValueToWeight()) {}\n+\n+// 0 is unknown, [1, 32767] maps to [kMinTSD kMaxTSD].\n+float TSDValueConverter::SlowValueToTSD(const uint16 value) const {\n+  CHECK_GE(value, 0);\n+  CHECK_LE(value, 32767);\n+  if (value == kUnknownTSDValue) {\n+    // Unknown cells have kMinProbability.\n+    return kMinTSD;\n+  }\n+  const float kScale = (kMaxTSD - kMinTSD) / 32766.f;\n+  return value * kScale + (kMinTSD - kScale);\n+}\n+\n+std::vector<float> TSDValueConverter::PrecomputeValueToTSD() {\n+  std::vector<float> result;\n+  // Repeat two times, so that both values with and without the update marker\n+  // can be converted to a tsd.\n+  for (int repeat = 0; repeat != 2; ++repeat) {\n+    for (int value = 0; value != 32768; ++value) {\n+      result.push_back(SlowValueToTSD(value));\n+    }\n+  }\n+  return result;\n+}\n+\n+// 0 is unknown, [1, 32767] maps to [kMinWeight kMaxWeight].\n+float TSDValueConverter::SlowValueToWeight(const uint16 value) const {\n+  CHECK_GE(value, 0);\n+  CHECK_LE(value, 32767);\n+  if (value == kUnknownWeightValue) {\n+    // Unknown cells have kMinWeight.\n+    return kMinWeight;\n+  }\n+  const float kScale = (kMaxWeight - kMinWeight) / 32766.f;\n+  return value * kScale + (kMinWeight - kScale);\n+}\n+\n+std::vector<float> TSDValueConverter::PrecomputeValueToWeight() {\n+  std::vector<float> result;\n+  // Repeat two times, so that both values with and without the update marker\n+  // can be converted to a weight.\n+  for (int repeat = 0; repeat != 2; ++repeat) {\n+    for (int value = 0; value != 32768; ++value) {\n+      result.push_back(SlowValueToWeight(value));\n+    }\n+  }\n+  return result;\n+}\n+\n+}  // namespace mapping\n+}  // namespace cartographer","path":"cartographer/mapping/tsd_value_converter.cc","position":78,"original_position":78,"commit_id":"fe152d970b73e241799e93bb585f2a056af93084","original_commit_id":"fe152d970b73e241799e93bb585f2a056af93084","user":{"login":"gaschler","id":339437,"node_id":"MDQ6VXNlcjMzOTQzNw==","avatar_url":"https://avatars3.githubusercontent.com/u/339437?v=4","gravatar_id":"","url":"https://api.github.com/users/gaschler","html_url":"https://github.com/gaschler","followers_url":"https://api.github.com/users/gaschler/followers","following_url":"https://api.github.com/users/gaschler/following{/other_user}","gists_url":"https://api.github.com/users/gaschler/gists{/gist_id}","starred_url":"https://api.github.com/users/gaschler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaschler/subscriptions","organizations_url":"https://api.github.com/users/gaschler/orgs","repos_url":"https://api.github.com/users/gaschler/repos","events_url":"https://api.github.com/users/gaschler/events{/privacy}","received_events_url":"https://api.github.com/users/gaschler/received_events","type":"User","site_admin":false},"body":"super nit: add new line at end of files","created_at":"2018-06-19T12:02:21Z","updated_at":"2018-06-19T12:02:45Z","html_url":"https://github.com/googlecartographer/cartographer/pull/1204#discussion_r196395143","pull_request_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments/196395143"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/1204#discussion_r196395143"},"pull_request":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204"}}},"pull_request":{"url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204","id":195776289,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1Nzc2Mjg5","html_url":"https://github.com/googlecartographer/cartographer/pull/1204","diff_url":"https://github.com/googlecartographer/cartographer/pull/1204.diff","patch_url":"https://github.com/googlecartographer/cartographer/pull/1204.patch","issue_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/1204","number":1204,"state":"open","locked":false,"title":"Truncated Signed Distance Value Converter","user":{"login":"kdaun","id":11328944,"node_id":"MDQ6VXNlcjExMzI4OTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/11328944?v=4","gravatar_id":"","url":"https://api.github.com/users/kdaun","html_url":"https://github.com/kdaun","followers_url":"https://api.github.com/users/kdaun/followers","following_url":"https://api.github.com/users/kdaun/following{/other_user}","gists_url":"https://api.github.com/users/kdaun/gists{/gist_id}","starred_url":"https://api.github.com/users/kdaun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdaun/subscriptions","organizations_url":"https://api.github.com/users/kdaun/orgs","repos_url":"https://api.github.com/users/kdaun/repos","events_url":"https://api.github.com/users/kdaun/events{/privacy}","received_events_url":"https://api.github.com/users/kdaun/received_events","type":"User","site_admin":false},"body":"Introduces conversions between float and uint16 representations for truncated signed distance values and weights.","created_at":"2018-06-19T10:12:06Z","updated_at":"2018-06-19T12:02:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a1793f837af93f92f04f3711ad5affbc1b6e7bd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":418020229,"node_id":"MDU6TGFiZWw0MTgwMjAyMjk=","url":"https://api.github.com/repos/googlecartographer/cartographer/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204/commits","review_comments_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204/comments","review_comment_url":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlecartographer/cartographer/issues/1204/comments","statuses_url":"https://api.github.com/repos/googlecartographer/cartographer/statuses/fe152d970b73e241799e93bb585f2a056af93084","head":{"label":"kdaun:tsd_value_converter","ref":"tsd_value_converter","sha":"fe152d970b73e241799e93bb585f2a056af93084","user":{"login":"kdaun","id":11328944,"node_id":"MDQ6VXNlcjExMzI4OTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/11328944?v=4","gravatar_id":"","url":"https://api.github.com/users/kdaun","html_url":"https://github.com/kdaun","followers_url":"https://api.github.com/users/kdaun/followers","following_url":"https://api.github.com/users/kdaun/following{/other_user}","gists_url":"https://api.github.com/users/kdaun/gists{/gist_id}","starred_url":"https://api.github.com/users/kdaun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdaun/subscriptions","organizations_url":"https://api.github.com/users/kdaun/orgs","repos_url":"https://api.github.com/users/kdaun/repos","events_url":"https://api.github.com/users/kdaun/events{/privacy}","received_events_url":"https://api.github.com/users/kdaun/received_events","type":"User","site_admin":false},"repo":{"id":85706428,"node_id":"MDEwOlJlcG9zaXRvcnk4NTcwNjQyOA==","name":"cartographer","full_name":"kdaun/cartographer","owner":{"login":"kdaun","id":11328944,"node_id":"MDQ6VXNlcjExMzI4OTQ0","avatar_url":"https://avatars2.githubusercontent.com/u/11328944?v=4","gravatar_id":"","url":"https://api.github.com/users/kdaun","html_url":"https://github.com/kdaun","followers_url":"https://api.github.com/users/kdaun/followers","following_url":"https://api.github.com/users/kdaun/following{/other_user}","gists_url":"https://api.github.com/users/kdaun/gists{/gist_id}","starred_url":"https://api.github.com/users/kdaun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdaun/subscriptions","organizations_url":"https://api.github.com/users/kdaun/orgs","repos_url":"https://api.github.com/users/kdaun/repos","events_url":"https://api.github.com/users/kdaun/events{/privacy}","received_events_url":"https://api.github.com/users/kdaun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kdaun/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/kdaun/cartographer","forks_url":"https://api.github.com/repos/kdaun/cartographer/forks","keys_url":"https://api.github.com/repos/kdaun/cartographer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kdaun/cartographer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kdaun/cartographer/teams","hooks_url":"https://api.github.com/repos/kdaun/cartographer/hooks","issue_events_url":"https://api.github.com/repos/kdaun/cartographer/issues/events{/number}","events_url":"https://api.github.com/repos/kdaun/cartographer/events","assignees_url":"https://api.github.com/repos/kdaun/cartographer/assignees{/user}","branches_url":"https://api.github.com/repos/kdaun/cartographer/branches{/branch}","tags_url":"https://api.github.com/repos/kdaun/cartographer/tags","blobs_url":"https://api.github.com/repos/kdaun/cartographer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kdaun/cartographer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kdaun/cartographer/git/refs{/sha}","trees_url":"https://api.github.com/repos/kdaun/cartographer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kdaun/cartographer/statuses/{sha}","languages_url":"https://api.github.com/repos/kdaun/cartographer/languages","stargazers_url":"https://api.github.com/repos/kdaun/cartographer/stargazers","contributors_url":"https://api.github.com/repos/kdaun/cartographer/contributors","subscribers_url":"https://api.github.com/repos/kdaun/cartographer/subscribers","subscription_url":"https://api.github.com/repos/kdaun/cartographer/subscription","commits_url":"https://api.github.com/repos/kdaun/cartographer/commits{/sha}","git_commits_url":"https://api.github.com/repos/kdaun/cartographer/git/commits{/sha}","comments_url":"https://api.github.com/repos/kdaun/cartographer/comments{/number}","issue_comment_url":"https://api.github.com/repos/kdaun/cartographer/issues/comments{/number}","contents_url":"https://api.github.com/repos/kdaun/cartographer/contents/{+path}","compare_url":"https://api.github.com/repos/kdaun/cartographer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kdaun/cartographer/merges","archive_url":"https://api.github.com/repos/kdaun/cartographer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kdaun/cartographer/downloads","issues_url":"https://api.github.com/repos/kdaun/cartographer/issues{/number}","pulls_url":"https://api.github.com/repos/kdaun/cartographer/pulls{/number}","milestones_url":"https://api.github.com/repos/kdaun/cartographer/milestones{/number}","notifications_url":"https://api.github.com/repos/kdaun/cartographer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kdaun/cartographer/labels{/name}","releases_url":"https://api.github.com/repos/kdaun/cartographer/releases{/id}","deployments_url":"https://api.github.com/repos/kdaun/cartographer/deployments","created_at":"2017-03-21T13:40:15Z","updated_at":"2018-06-19T10:00:15Z","pushed_at":"2018-06-19T10:08:31Z","git_url":"git://github.com/kdaun/cartographer.git","ssh_url":"git@github.com:kdaun/cartographer.git","clone_url":"https://github.com/kdaun/cartographer.git","svn_url":"https://github.com/kdaun/cartographer","homepage":"","size":4831,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlecartographer:master","ref":"master","sha":"a9045fa3755844db139c05d3b5797e5a28e10c7f","user":{"login":"googlecartographer","id":20636162,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjM2MTYy","avatar_url":"https://avatars3.githubusercontent.com/u/20636162?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk2NDczMjM1OA==","name":"cartographer","full_name":"googlecartographer/cartographer","owner":{"login":"googlecartographer","id":20636162,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjM2MTYy","avatar_url":"https://avatars3.githubusercontent.com/u/20636162?v=4","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":"2018-06-19T11:41:59Z","pushed_at":"2018-06-19T11:50:26Z","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":4586,"stargazers_count":3473,"watchers_count":3473,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1133,"mirror_url":null,"archived":false,"open_issues_count":48,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1133,"open_issues":48,"watchers":3473,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204"},"html":{"href":"https://github.com/googlecartographer/cartographer/pull/1204"},"issue":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/1204"},"comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/issues/1204/comments"},"review_comments":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204/comments"},"review_comment":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlecartographer/cartographer/pulls/1204/commits"},"statuses":{"href":"https://api.github.com/repos/googlecartographer/cartographer/statuses/fe152d970b73e241799e93bb585f2a056af93084"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gaschler"}}