{"action":"created","comment":{"url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/comments/228723587","pull_request_review_id":169066671,"id":228723587,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODcyMzU4Nw==","diff_hunk":"@@ -1924,6 +2037,181 @@ def get_speed_steering(self, steering, speed):\n         return (left_speed, right_speed)\n \n \n+class MoveDifferential(MoveTank):\n+    \"\"\"\n+    For all methods speed can be an integer or a SpeedInteger object\n+    \"\"\"\n+\n+    def __init__(self, left_motor_port, right_motor_port, wheel_class, wheel_distance_mm, desc=None, motor_class=LargeMotor):\n+        MoveTank.__init__(self, left_motor_port, right_motor_port, desc, motor_class)\n+        self.wheel = wheel_class()\n+\n+        # The distance between the mid point of the wheels.  You may need to\n+        # do some test drives to find the correct value for your robot.  It\n+        # is not as simple as measuring the distance between the midpoints of\n+        # the two wheels. The weight of the robot, center of gravity, etc come\n+        # into play.  You can use utils/move_differential.py to call on_arc_left()\n+        # to do some test drives in 1-foot circles.  Tweak wheel_distam_mm until\n+        # your robot can drive in a 1-foot circle and stop exactly where it started.\n+        self.wheel_distance_mm = wheel_distance_mm\n+\n+        # The circumference of the circle made if this robot were to rotate in place\n+        self.circumference_mm = self.wheel_distance_mm * pi\n+\n+        self.min_circle_radius_mm = self.wheel_distance_mm / 2\n+\n+    def on_for_distance(self, speed, distance_mm, brake=True, block=True):\n+        \"\"\"\n+        Drive forward distance_mm\n+        \"\"\"\n+        abort = False\n+\n+        if not speed:\n+            log.warning(\"{}: speed is invalid ({}), tank will not move\".format(self, speed))\n+            abort = True\n+\n+        if not distance_mm:\n+            log.warning(\"{}: distance_mm is invalid ({}), tank will not move\".format(self, distance_mm))\n+            abort = True\n+\n+        if abort:\n+            self._set_brake(brake)\n+            return\n+\n+        rotations = distance_mm / self.wheel.circumference_mm\n+        log.debug(\"%s: on_for_rotations distance_mm %s, rotations %s, speed %s\" % (self, distance_mm, rotations, speed))\n+\n+        MoveTank.on_for_rotations(self, speed, speed, rotations, brake, block)\n+\n+    def _on_arc(self, speed, radius_mm, distance_mm, brake, block, arc_right):\n+        \"\"\"\n+        Drive in a circle with 'radius' for 'distance'\n+        \"\"\"\n+        abort = False\n+\n+        if not speed:\n+            log.warning(\"{}: speed is invalid ({}), tank will not move\".format(self, speed))\n+            abort = True","path":"ev3dev2/motor.py","position":585,"original_position":585,"commit_id":"d544a0dec062f815ec86b154c590d0eea6e0c29a","original_commit_id":"d544a0dec062f815ec86b154c590d0eea6e0c29a","user":{"login":"WasabiFan","id":3310349,"node_id":"MDQ6VXNlcjMzMTAzNDk=","avatar_url":"https://avatars0.githubusercontent.com/u/3310349?v=4","gravatar_id":"","url":"https://api.github.com/users/WasabiFan","html_url":"https://github.com/WasabiFan","followers_url":"https://api.github.com/users/WasabiFan/followers","following_url":"https://api.github.com/users/WasabiFan/following{/other_user}","gists_url":"https://api.github.com/users/WasabiFan/gists{/gist_id}","starred_url":"https://api.github.com/users/WasabiFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WasabiFan/subscriptions","organizations_url":"https://api.github.com/users/WasabiFan/orgs","repos_url":"https://api.github.com/users/WasabiFan/repos","events_url":"https://api.github.com/users/WasabiFan/events{/privacy}","received_events_url":"https://api.github.com/users/WasabiFan/received_events","type":"User","site_admin":false},"body":"Do we really need the additional machinery for checking validity then aborting? I think it's fine to get one error then to fix that and get another if needed.","created_at":"2018-10-27T19:20:18Z","updated_at":"2018-10-27T19:35:20Z","html_url":"https://github.com/ev3dev/ev3dev-lang-python/pull/536#discussion_r228723587","pull_request_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/comments/228723587"},"html":{"href":"https://github.com/ev3dev/ev3dev-lang-python/pull/536#discussion_r228723587"},"pull_request":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536"}}},"pull_request":{"url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536","id":226179167,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MTc5MTY3","html_url":"https://github.com/ev3dev/ev3dev-lang-python/pull/536","diff_url":"https://github.com/ev3dev/ev3dev-lang-python/pull/536.diff","patch_url":"https://github.com/ev3dev/ev3dev-lang-python/pull/536.patch","issue_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/536","number":536,"state":"open","locked":false,"title":"MoveDifferential","user":{"login":"dwalton76","id":468309,"node_id":"MDQ6VXNlcjQ2ODMwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/468309?v=4","gravatar_id":"","url":"https://api.github.com/users/dwalton76","html_url":"https://github.com/dwalton76","followers_url":"https://api.github.com/users/dwalton76/followers","following_url":"https://api.github.com/users/dwalton76/following{/other_user}","gists_url":"https://api.github.com/users/dwalton76/gists{/gist_id}","starred_url":"https://api.github.com/users/dwalton76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwalton76/subscriptions","organizations_url":"https://api.github.com/users/dwalton76/orgs","repos_url":"https://api.github.com/users/dwalton76/repos","events_url":"https://api.github.com/users/dwalton76/events{/privacy}","received_events_url":"https://api.github.com/users/dwalton76/received_events","type":"User","site_admin":false},"body":"For issue #392 ","created_at":"2018-10-26T17:57:50Z","updated_at":"2018-10-27T19:35:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b65510381aec1285ff4cd6370a6e4c8641a3d9a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536/commits","review_comments_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536/comments","review_comment_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/536/comments","statuses_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/statuses/d544a0dec062f815ec86b154c590d0eea6e0c29a","head":{"label":"dwalton76:brickpi3","ref":"brickpi3","sha":"d544a0dec062f815ec86b154c590d0eea6e0c29a","user":{"login":"dwalton76","id":468309,"node_id":"MDQ6VXNlcjQ2ODMwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/468309?v=4","gravatar_id":"","url":"https://api.github.com/users/dwalton76","html_url":"https://github.com/dwalton76","followers_url":"https://api.github.com/users/dwalton76/followers","following_url":"https://api.github.com/users/dwalton76/following{/other_user}","gists_url":"https://api.github.com/users/dwalton76/gists{/gist_id}","starred_url":"https://api.github.com/users/dwalton76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwalton76/subscriptions","organizations_url":"https://api.github.com/users/dwalton76/orgs","repos_url":"https://api.github.com/users/dwalton76/repos","events_url":"https://api.github.com/users/dwalton76/events{/privacy}","received_events_url":"https://api.github.com/users/dwalton76/received_events","type":"User","site_admin":false},"repo":{"id":154533399,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ1MzMzOTk=","name":"ev3dev-lang-python","full_name":"dwalton76/ev3dev-lang-python","private":false,"owner":{"login":"dwalton76","id":468309,"node_id":"MDQ6VXNlcjQ2ODMwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/468309?v=4","gravatar_id":"","url":"https://api.github.com/users/dwalton76","html_url":"https://github.com/dwalton76","followers_url":"https://api.github.com/users/dwalton76/followers","following_url":"https://api.github.com/users/dwalton76/following{/other_user}","gists_url":"https://api.github.com/users/dwalton76/gists{/gist_id}","starred_url":"https://api.github.com/users/dwalton76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwalton76/subscriptions","organizations_url":"https://api.github.com/users/dwalton76/orgs","repos_url":"https://api.github.com/users/dwalton76/repos","events_url":"https://api.github.com/users/dwalton76/events{/privacy}","received_events_url":"https://api.github.com/users/dwalton76/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dwalton76/ev3dev-lang-python","description":"Pure python bindings for ev3dev","fork":true,"url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python","forks_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/forks","keys_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/teams","hooks_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/hooks","issue_events_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/issues/events{/number}","events_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/events","assignees_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/assignees{/user}","branches_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/branches{/branch}","tags_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/tags","blobs_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/statuses/{sha}","languages_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/languages","stargazers_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/stargazers","contributors_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/contributors","subscribers_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/subscribers","subscription_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/subscription","commits_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/contents/{+path}","compare_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/merges","archive_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/downloads","issues_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/issues{/number}","pulls_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/pulls{/number}","milestones_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/milestones{/number}","notifications_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/labels{/name}","releases_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/releases{/id}","deployments_url":"https://api.github.com/repos/dwalton76/ev3dev-lang-python/deployments","created_at":"2018-10-24T16:28:32Z","updated_at":"2018-10-24T16:28:35Z","pushed_at":"2018-10-27T04:33:57Z","git_url":"git://github.com/dwalton76/ev3dev-lang-python.git","ssh_url":"git@github.com:dwalton76/ev3dev-lang-python.git","clone_url":"https://github.com/dwalton76/ev3dev-lang-python.git","svn_url":"https://github.com/dwalton76/ev3dev-lang-python","homepage":null,"size":9739,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"ev3dev-stretch"}},"base":{"label":"ev3dev:ev3dev-stretch","ref":"ev3dev-stretch","sha":"60d598c7565bb9a3f50f58f57c368aa9d8a70ba2","user":{"login":"ev3dev","id":6878323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NzgzMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/6878323?v=4","gravatar_id":"","url":"https://api.github.com/users/ev3dev","html_url":"https://github.com/ev3dev","followers_url":"https://api.github.com/users/ev3dev/followers","following_url":"https://api.github.com/users/ev3dev/following{/other_user}","gists_url":"https://api.github.com/users/ev3dev/gists{/gist_id}","starred_url":"https://api.github.com/users/ev3dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev3dev/subscriptions","organizations_url":"https://api.github.com/users/ev3dev/orgs","repos_url":"https://api.github.com/users/ev3dev/repos","events_url":"https://api.github.com/users/ev3dev/events{/privacy}","received_events_url":"https://api.github.com/users/ev3dev/received_events","type":"Organization","site_admin":false},"repo":{"id":43603757,"node_id":"MDEwOlJlcG9zaXRvcnk0MzYwMzc1Nw==","name":"ev3dev-lang-python","full_name":"ev3dev/ev3dev-lang-python","private":false,"owner":{"login":"ev3dev","id":6878323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4NzgzMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/6878323?v=4","gravatar_id":"","url":"https://api.github.com/users/ev3dev","html_url":"https://github.com/ev3dev","followers_url":"https://api.github.com/users/ev3dev/followers","following_url":"https://api.github.com/users/ev3dev/following{/other_user}","gists_url":"https://api.github.com/users/ev3dev/gists{/gist_id}","starred_url":"https://api.github.com/users/ev3dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev3dev/subscriptions","organizations_url":"https://api.github.com/users/ev3dev/orgs","repos_url":"https://api.github.com/users/ev3dev/repos","events_url":"https://api.github.com/users/ev3dev/events{/privacy}","received_events_url":"https://api.github.com/users/ev3dev/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ev3dev/ev3dev-lang-python","description":"Pure python bindings for ev3dev","fork":false,"url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python","forks_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/forks","keys_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/teams","hooks_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/hooks","issue_events_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/events{/number}","events_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/events","assignees_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/assignees{/user}","branches_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/branches{/branch}","tags_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/tags","blobs_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/statuses/{sha}","languages_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/languages","stargazers_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/stargazers","contributors_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/contributors","subscribers_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/subscribers","subscription_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/subscription","commits_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/contents/{+path}","compare_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/merges","archive_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/downloads","issues_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues{/number}","pulls_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls{/number}","milestones_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/milestones{/number}","notifications_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/labels{/name}","releases_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/releases{/id}","deployments_url":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/deployments","created_at":"2015-10-03T15:32:20Z","updated_at":"2018-10-25T12:27:10Z","pushed_at":"2018-10-27T04:33:59Z","git_url":"git://github.com/ev3dev/ev3dev-lang-python.git","ssh_url":"git@github.com:ev3dev/ev3dev-lang-python.git","clone_url":"https://github.com/ev3dev/ev3dev-lang-python.git","svn_url":"https://github.com/ev3dev/ev3dev-lang-python","homepage":null,"size":9802,"stargazers_count":206,"watchers_count":206,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":77,"mirror_url":null,"archived":false,"open_issues_count":43,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":77,"open_issues":43,"watchers":206,"default_branch":"ev3dev-stretch"}},"_links":{"self":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536"},"html":{"href":"https://github.com/ev3dev/ev3dev-lang-python/pull/536"},"issue":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/536"},"comments":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/issues/536/comments"},"review_comments":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536/comments"},"review_comment":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/pulls/536/commits"},"statuses":{"href":"https://api.github.com/repos/ev3dev/ev3dev-lang-python/statuses/d544a0dec062f815ec86b154c590d0eea6e0c29a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"WasabiFan"}}