{"action":"created","comment":{"url":"https://api.github.com/repos/poppy-project/pypot/pulls/comments/64396473","id":64396473,"diff_hunk":"@@ -0,0 +1,134 @@\n+from __future__ import print_function, division\n+\n+import time\n+import numpy\n+\n+from collections import deque\n+\n+from ...robot.sensor import Sensor\n+from ...utils import StoppableLoopThread\n+from ...utils.i2c_controller import I2cController\n+\n+\n+class SonarSensor(Sensor):\n+    \"\"\" Give acces to ultrasonic I2C modules SRF-02 in a *pypot way*\n+\n+        It provides one register: distance (in meters).\n+\n+    \"\"\"\n+    registers = Sensor.registers + ['distance']\n+\n+    def __init__(self, name, i2c_pin, address, sync_freq=50.0):\n+        Sensor.__init__(self, name)\n+\n+        self._d = numpy.nan\n+\n+        self._sonar = Sonar(i2c_pin, address)\n+\n+        self._controller = StoppableLoopThread(sync_freq, target=self.update)\n+        self._controller.start()\n+\n+    def close(self):\n+        self._controller.stop()\n+\n+    def update(self):\n+        self._sonar.update()\n+        self.d = self._sonar.data[0]","path":"pypot/sensor/depth/sonar.py","position":36,"original_position":36,"commit_id":"d72b238659623011904d374d5ffeed7f012f0e6d","original_commit_id":"d72b238659623011904d374d5ffeed7f012f0e6d","user":{"login":"show0k","id":3891499,"avatar_url":"https://avatars.githubusercontent.com/u/3891499?v=3","gravatar_id":"","url":"https://api.github.com/users/show0k","html_url":"https://github.com/show0k","followers_url":"https://api.github.com/users/show0k/followers","following_url":"https://api.github.com/users/show0k/following{/other_user}","gists_url":"https://api.github.com/users/show0k/gists{/gist_id}","starred_url":"https://api.github.com/users/show0k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/show0k/subscriptions","organizations_url":"https://api.github.com/users/show0k/orgs","repos_url":"https://api.github.com/users/show0k/repos","events_url":"https://api.github.com/users/show0k/events{/privacy}","received_events_url":"https://api.github.com/users/show0k/received_events","type":"User","site_admin":false},"body":"Does it not miss something ? self.d is not defined nor used elsewhere","created_at":"2016-05-24T14:04:39Z","updated_at":"2016-05-24T14:04:39Z","html_url":"https://github.com/poppy-project/pypot/pull/191#discussion_r64396473","pull_request_url":"https://api.github.com/repos/poppy-project/pypot/pulls/191","_links":{"self":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/comments/64396473"},"html":{"href":"https://github.com/poppy-project/pypot/pull/191#discussion_r64396473"},"pull_request":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/poppy-project/pypot/pulls/191","id":71223243,"html_url":"https://github.com/poppy-project/pypot/pull/191","diff_url":"https://github.com/poppy-project/pypot/pull/191.diff","patch_url":"https://github.com/poppy-project/pypot/pull/191.patch","issue_url":"https://api.github.com/repos/poppy-project/pypot/issues/191","number":191,"state":"open","locked":false,"title":"WIP: Integration of the SRF-02 Ultra Sonic range finder","user":{"login":"pierre-rouanet","id":4290742,"avatar_url":"https://avatars.githubusercontent.com/u/4290742?v=3","gravatar_id":"","url":"https://api.github.com/users/pierre-rouanet","html_url":"https://github.com/pierre-rouanet","followers_url":"https://api.github.com/users/pierre-rouanet/followers","following_url":"https://api.github.com/users/pierre-rouanet/following{/other_user}","gists_url":"https://api.github.com/users/pierre-rouanet/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre-rouanet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre-rouanet/subscriptions","organizations_url":"https://api.github.com/users/pierre-rouanet/orgs","repos_url":"https://api.github.com/users/pierre-rouanet/repos","events_url":"https://api.github.com/users/pierre-rouanet/events{/privacy}","received_events_url":"https://api.github.com/users/pierre-rouanet/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-24T13:49:18Z","updated_at":"2016-05-24T14:04:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bd92a934a40dc18b61d2662449e3387bbaddb4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/poppy-project/pypot/pulls/191/commits","review_comments_url":"https://api.github.com/repos/poppy-project/pypot/pulls/191/comments","review_comment_url":"https://api.github.com/repos/poppy-project/pypot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/poppy-project/pypot/issues/191/comments","statuses_url":"https://api.github.com/repos/poppy-project/pypot/statuses/d72b238659623011904d374d5ffeed7f012f0e6d","head":{"label":"poppy-project:SRF02","ref":"SRF02","sha":"d72b238659623011904d374d5ffeed7f012f0e6d","user":{"login":"poppy-project","id":6410346,"avatar_url":"https://avatars.githubusercontent.com/u/6410346?v=3","gravatar_id":"","url":"https://api.github.com/users/poppy-project","html_url":"https://github.com/poppy-project","followers_url":"https://api.github.com/users/poppy-project/followers","following_url":"https://api.github.com/users/poppy-project/following{/other_user}","gists_url":"https://api.github.com/users/poppy-project/gists{/gist_id}","starred_url":"https://api.github.com/users/poppy-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poppy-project/subscriptions","organizations_url":"https://api.github.com/users/poppy-project/orgs","repos_url":"https://api.github.com/users/poppy-project/repos","events_url":"https://api.github.com/users/poppy-project/events{/privacy}","received_events_url":"https://api.github.com/users/poppy-project/received_events","type":"Organization","site_admin":false},"repo":{"id":16351844,"name":"pypot","full_name":"poppy-project/pypot","owner":{"login":"poppy-project","id":6410346,"avatar_url":"https://avatars.githubusercontent.com/u/6410346?v=3","gravatar_id":"","url":"https://api.github.com/users/poppy-project","html_url":"https://github.com/poppy-project","followers_url":"https://api.github.com/users/poppy-project/followers","following_url":"https://api.github.com/users/poppy-project/following{/other_user}","gists_url":"https://api.github.com/users/poppy-project/gists{/gist_id}","starred_url":"https://api.github.com/users/poppy-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poppy-project/subscriptions","organizations_url":"https://api.github.com/users/poppy-project/orgs","repos_url":"https://api.github.com/users/poppy-project/repos","events_url":"https://api.github.com/users/poppy-project/events{/privacy}","received_events_url":"https://api.github.com/users/poppy-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poppy-project/pypot","description":"  Python library for controlling dynamixel motors. Documentation available here:","fork":false,"url":"https://api.github.com/repos/poppy-project/pypot","forks_url":"https://api.github.com/repos/poppy-project/pypot/forks","keys_url":"https://api.github.com/repos/poppy-project/pypot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poppy-project/pypot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poppy-project/pypot/teams","hooks_url":"https://api.github.com/repos/poppy-project/pypot/hooks","issue_events_url":"https://api.github.com/repos/poppy-project/pypot/issues/events{/number}","events_url":"https://api.github.com/repos/poppy-project/pypot/events","assignees_url":"https://api.github.com/repos/poppy-project/pypot/assignees{/user}","branches_url":"https://api.github.com/repos/poppy-project/pypot/branches{/branch}","tags_url":"https://api.github.com/repos/poppy-project/pypot/tags","blobs_url":"https://api.github.com/repos/poppy-project/pypot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poppy-project/pypot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poppy-project/pypot/git/refs{/sha}","trees_url":"https://api.github.com/repos/poppy-project/pypot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poppy-project/pypot/statuses/{sha}","languages_url":"https://api.github.com/repos/poppy-project/pypot/languages","stargazers_url":"https://api.github.com/repos/poppy-project/pypot/stargazers","contributors_url":"https://api.github.com/repos/poppy-project/pypot/contributors","subscribers_url":"https://api.github.com/repos/poppy-project/pypot/subscribers","subscription_url":"https://api.github.com/repos/poppy-project/pypot/subscription","commits_url":"https://api.github.com/repos/poppy-project/pypot/commits{/sha}","git_commits_url":"https://api.github.com/repos/poppy-project/pypot/git/commits{/sha}","comments_url":"https://api.github.com/repos/poppy-project/pypot/comments{/number}","issue_comment_url":"https://api.github.com/repos/poppy-project/pypot/issues/comments{/number}","contents_url":"https://api.github.com/repos/poppy-project/pypot/contents/{+path}","compare_url":"https://api.github.com/repos/poppy-project/pypot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poppy-project/pypot/merges","archive_url":"https://api.github.com/repos/poppy-project/pypot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poppy-project/pypot/downloads","issues_url":"https://api.github.com/repos/poppy-project/pypot/issues{/number}","pulls_url":"https://api.github.com/repos/poppy-project/pypot/pulls{/number}","milestones_url":"https://api.github.com/repos/poppy-project/pypot/milestones{/number}","notifications_url":"https://api.github.com/repos/poppy-project/pypot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poppy-project/pypot/labels{/name}","releases_url":"https://api.github.com/repos/poppy-project/pypot/releases{/id}","deployments_url":"https://api.github.com/repos/poppy-project/pypot/deployments","created_at":"2014-01-29T17:08:49Z","updated_at":"2016-05-20T07:27:52Z","pushed_at":"2016-05-24T13:49:19Z","git_url":"git://github.com/poppy-project/pypot.git","ssh_url":"git@github.com:poppy-project/pypot.git","clone_url":"https://github.com/poppy-project/pypot.git","svn_url":"https://github.com/poppy-project/pypot","homepage":"http://poppy-project.github.io/pypot/","size":60522,"stargazers_count":120,"watchers_count":120,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":53,"mirror_url":null,"open_issues_count":37,"forks":53,"open_issues":37,"watchers":120,"default_branch":"master"}},"base":{"label":"poppy-project:master","ref":"master","sha":"f88acfe039d7931dc79a5c413b942c549fe4711a","user":{"login":"poppy-project","id":6410346,"avatar_url":"https://avatars.githubusercontent.com/u/6410346?v=3","gravatar_id":"","url":"https://api.github.com/users/poppy-project","html_url":"https://github.com/poppy-project","followers_url":"https://api.github.com/users/poppy-project/followers","following_url":"https://api.github.com/users/poppy-project/following{/other_user}","gists_url":"https://api.github.com/users/poppy-project/gists{/gist_id}","starred_url":"https://api.github.com/users/poppy-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poppy-project/subscriptions","organizations_url":"https://api.github.com/users/poppy-project/orgs","repos_url":"https://api.github.com/users/poppy-project/repos","events_url":"https://api.github.com/users/poppy-project/events{/privacy}","received_events_url":"https://api.github.com/users/poppy-project/received_events","type":"Organization","site_admin":false},"repo":{"id":16351844,"name":"pypot","full_name":"poppy-project/pypot","owner":{"login":"poppy-project","id":6410346,"avatar_url":"https://avatars.githubusercontent.com/u/6410346?v=3","gravatar_id":"","url":"https://api.github.com/users/poppy-project","html_url":"https://github.com/poppy-project","followers_url":"https://api.github.com/users/poppy-project/followers","following_url":"https://api.github.com/users/poppy-project/following{/other_user}","gists_url":"https://api.github.com/users/poppy-project/gists{/gist_id}","starred_url":"https://api.github.com/users/poppy-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poppy-project/subscriptions","organizations_url":"https://api.github.com/users/poppy-project/orgs","repos_url":"https://api.github.com/users/poppy-project/repos","events_url":"https://api.github.com/users/poppy-project/events{/privacy}","received_events_url":"https://api.github.com/users/poppy-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poppy-project/pypot","description":"  Python library for controlling dynamixel motors. Documentation available here:","fork":false,"url":"https://api.github.com/repos/poppy-project/pypot","forks_url":"https://api.github.com/repos/poppy-project/pypot/forks","keys_url":"https://api.github.com/repos/poppy-project/pypot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poppy-project/pypot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poppy-project/pypot/teams","hooks_url":"https://api.github.com/repos/poppy-project/pypot/hooks","issue_events_url":"https://api.github.com/repos/poppy-project/pypot/issues/events{/number}","events_url":"https://api.github.com/repos/poppy-project/pypot/events","assignees_url":"https://api.github.com/repos/poppy-project/pypot/assignees{/user}","branches_url":"https://api.github.com/repos/poppy-project/pypot/branches{/branch}","tags_url":"https://api.github.com/repos/poppy-project/pypot/tags","blobs_url":"https://api.github.com/repos/poppy-project/pypot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poppy-project/pypot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poppy-project/pypot/git/refs{/sha}","trees_url":"https://api.github.com/repos/poppy-project/pypot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poppy-project/pypot/statuses/{sha}","languages_url":"https://api.github.com/repos/poppy-project/pypot/languages","stargazers_url":"https://api.github.com/repos/poppy-project/pypot/stargazers","contributors_url":"https://api.github.com/repos/poppy-project/pypot/contributors","subscribers_url":"https://api.github.com/repos/poppy-project/pypot/subscribers","subscription_url":"https://api.github.com/repos/poppy-project/pypot/subscription","commits_url":"https://api.github.com/repos/poppy-project/pypot/commits{/sha}","git_commits_url":"https://api.github.com/repos/poppy-project/pypot/git/commits{/sha}","comments_url":"https://api.github.com/repos/poppy-project/pypot/comments{/number}","issue_comment_url":"https://api.github.com/repos/poppy-project/pypot/issues/comments{/number}","contents_url":"https://api.github.com/repos/poppy-project/pypot/contents/{+path}","compare_url":"https://api.github.com/repos/poppy-project/pypot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poppy-project/pypot/merges","archive_url":"https://api.github.com/repos/poppy-project/pypot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poppy-project/pypot/downloads","issues_url":"https://api.github.com/repos/poppy-project/pypot/issues{/number}","pulls_url":"https://api.github.com/repos/poppy-project/pypot/pulls{/number}","milestones_url":"https://api.github.com/repos/poppy-project/pypot/milestones{/number}","notifications_url":"https://api.github.com/repos/poppy-project/pypot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poppy-project/pypot/labels{/name}","releases_url":"https://api.github.com/repos/poppy-project/pypot/releases{/id}","deployments_url":"https://api.github.com/repos/poppy-project/pypot/deployments","created_at":"2014-01-29T17:08:49Z","updated_at":"2016-05-20T07:27:52Z","pushed_at":"2016-05-24T13:49:19Z","git_url":"git://github.com/poppy-project/pypot.git","ssh_url":"git@github.com:poppy-project/pypot.git","clone_url":"https://github.com/poppy-project/pypot.git","svn_url":"https://github.com/poppy-project/pypot","homepage":"http://poppy-project.github.io/pypot/","size":60522,"stargazers_count":120,"watchers_count":120,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":53,"mirror_url":null,"open_issues_count":37,"forks":53,"open_issues":37,"watchers":120,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/191"},"html":{"href":"https://github.com/poppy-project/pypot/pull/191"},"issue":{"href":"https://api.github.com/repos/poppy-project/pypot/issues/191"},"comments":{"href":"https://api.github.com/repos/poppy-project/pypot/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/191/comments"},"review_comment":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/poppy-project/pypot/pulls/191/commits"},"statuses":{"href":"https://api.github.com/repos/poppy-project/pypot/statuses/d72b238659623011904d374d5ffeed7f012f0e6d"}}}}
{"actor":{"display_login":"show0k"}}