{"action":"created","comment":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/90553310","pull_request_review_id":11073141,"id":90553310,"diff_hunk":"@@ -466,6 +466,96 @@ def plan(self, method, args, kw_args):\n         else:\n             raise UnsupportedPlanningError()\n \n+\n+class HardwareJointLimitValidator(MetaPlanner):\n+    def __init__(self, planner):\n+        super(HardwareJointLimitValidator, self).__init__()\n+        self._planner = planner\n+\n+    def __str__(self):\n+        return 'HardLimitValidator({:s})'.format(', '.join(map(str, self._planners)))\n+\n+    def get_planners(self, method_name):\n+        if planner.has_planning_method(method_name):\n+            return [self._planner]\n+        else:\n+            return []\n+\n+    def plan(self, method, args, kw_args):\n+\n+        # TODO : Is this correct?\n+        robot = args[0]\n+\n+        #Get HARD DOF Limits from robot\n+        #hard_limit_min, hard_limit_max = robot.GetHardwareDOFLimits()\n+        active_dof_indices = robot.GetActiveDOFIndices()\n+        currentDOFVals = robot.getActiveDOFValues()\n+        soft_limit_min, soft_limit_max = robot.GetActiveDOFLimits()\n+        resetLimits = False\n+\n+        lower_hard_violations = (currentDOFVals < hard_limit_min)\n+        upper_hard_violations = (currentDOFVals > hard_limit_max)\n+        lower_soft_violations = (currentDOFVals < soft_limit_min)\n+        upper_soft_violations = (currentDOFVals > soft_limit_max)\n+\n+        if lower_soft_violations.any() || upper_soft_violations.any():\n+            \n+            # Check if hard limits violated\n+            if lower_hard_violations.any():\n+                index = lower_hard_violations.nonzero()[0][0]\n+                raise HardJointLimitError(\n+                    robot,\n+                    dof_index=active_dof_indices[index],\n+                    dof_value=currentDOFVals[index],\n+                    dof_limit=hard_limit_min[index],\n+                    description='position',\n+                    deterministic=deterministic)\n+            if upper_hard_violations.any():\n+                index = upper_hard_violations.nonzero()[0][0]\n+                raise HardJointLimitError(\n+                    robot,\n+                    dof_index=active_dof_indices[index],\n+                    dof_value=currentDOFVals[index],\n+                    dof_limit=hard_limit_max[index],\n+                    description='position',\n+                    deterministic=deterministic)\n+\n+            # Between software and hardware limits\n+            # Temporarily extend joint limits as needed\n+            soft_limit_min_new = soft_limit_min\n+            soft_limit_max_new = soft_limit_max\n+\n+            if lower_soft_violations.any():\n+                soft_limit_min_new[lower_soft_violations] = currentDOFVals[lower_soft_violations]\n+            if upper_soft_violations.any():\n+                soft_limit_max_new[upper_soft_violations] = currentDOFVals[upper_soft_violations]\n+\n+            robot.SetDOFLimits(soft_limit_min_new, soft_limit_max_new)\n+\n+            resetLimits = True\n+\n+        result = None    \n+\n+        if planner.has_planning_method(method):\n+            plan_fn = getattr(planner, method)\n+\n+            try:\n+                result =  plan_fn(*args, **kw_args)\n+            except UnsupportedPlanningError:\n+                continue\n+","path":"src/prpy/planning/base.py","position":81,"original_position":81,"commit_id":"1be4e8544a8d5667931adc19d8097833c8b7bd6e","original_commit_id":"1be4e8544a8d5667931adc19d8097833c8b7bd6e","user":{"login":"Shushman","id":1007251,"avatar_url":"https://avatars.githubusercontent.com/u/1007251?v=3","gravatar_id":"","url":"https://api.github.com/users/Shushman","html_url":"https://github.com/Shushman","followers_url":"https://api.github.com/users/Shushman/followers","following_url":"https://api.github.com/users/Shushman/following{/other_user}","gists_url":"https://api.github.com/users/Shushman/gists{/gist_id}","starred_url":"https://api.github.com/users/Shushman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shushman/subscriptions","organizations_url":"https://api.github.com/users/Shushman/orgs","repos_url":"https://api.github.com/users/Shushman/repos","events_url":"https://api.github.com/users/Shushman/events{/privacy}","received_events_url":"https://api.github.com/users/Shushman/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-12-01T22:39:28Z","updated_at":"2016-12-01T22:39:28Z","html_url":"https://github.com/personalrobotics/prpy/pull/362#discussion_r90553310","pull_request_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/362","_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/90553310"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/362#discussion_r90553310"},"pull_request":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/362"}}},"pull_request":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/362","id":95092442,"html_url":"https://github.com/personalrobotics/prpy/pull/362","diff_url":"https://github.com/personalrobotics/prpy/pull/362.diff","patch_url":"https://github.com/personalrobotics/prpy/pull/362.patch","issue_url":"https://api.github.com/repos/personalrobotics/prpy/issues/362","number":362,"state":"open","locked":false,"title":"Changes for soft joint limit error handling","user":{"login":"Shushman","id":1007251,"avatar_url":"https://avatars.githubusercontent.com/u/1007251?v=3","gravatar_id":"","url":"https://api.github.com/users/Shushman","html_url":"https://github.com/Shushman","followers_url":"https://api.github.com/users/Shushman/followers","following_url":"https://api.github.com/users/Shushman/following{/other_user}","gists_url":"https://api.github.com/users/Shushman/gists{/gist_id}","starred_url":"https://api.github.com/users/Shushman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shushman/subscriptions","organizations_url":"https://api.github.com/users/Shushman/orgs","repos_url":"https://api.github.com/users/Shushman/repos","events_url":"https://api.github.com/users/Shushman/events{/privacy}","received_events_url":"https://api.github.com/users/Shushman/received_events","type":"User","site_admin":false},"body":"This allows the disambiguation between the joint limits from the `openrave Robot` and the actual joint limits of the hardware (from looking up specs). Currently, the two `prpy` planners that call `CheckJointLimits` are now configured to catch `SoftJointLimitError` exceptions and continue.\r\n\r\n@gilwoolee please take a look. There aren't many changes, and this is definitely still in progress. We also need to something about OMPL planners.","created_at":"2016-11-23T22:55:21Z","updated_at":"2016-12-01T22:39:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0b34746bf9fb481994838bb52f6c7cb581924c8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/362/commits","review_comments_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/362/comments","review_comment_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/personalrobotics/prpy/issues/362/comments","statuses_url":"https://api.github.com/repos/personalrobotics/prpy/statuses/1be4e8544a8d5667931adc19d8097833c8b7bd6e","head":{"label":"personalrobotics:feature/startInJointLimit","ref":"feature/startInJointLimit","sha":"1be4e8544a8d5667931adc19d8097833c8b7bd6e","user":{"login":"personalrobotics","id":4705918,"avatar_url":"https://avatars.githubusercontent.com/u/4705918?v=3","gravatar_id":"","url":"https://api.github.com/users/personalrobotics","html_url":"https://github.com/personalrobotics","followers_url":"https://api.github.com/users/personalrobotics/followers","following_url":"https://api.github.com/users/personalrobotics/following{/other_user}","gists_url":"https://api.github.com/users/personalrobotics/gists{/gist_id}","starred_url":"https://api.github.com/users/personalrobotics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/personalrobotics/subscriptions","organizations_url":"https://api.github.com/users/personalrobotics/orgs","repos_url":"https://api.github.com/users/personalrobotics/repos","events_url":"https://api.github.com/users/personalrobotics/events{/privacy}","received_events_url":"https://api.github.com/users/personalrobotics/received_events","type":"Organization","site_admin":false},"repo":{"id":21152391,"name":"prpy","full_name":"personalrobotics/prpy","owner":{"login":"personalrobotics","id":4705918,"avatar_url":"https://avatars.githubusercontent.com/u/4705918?v=3","gravatar_id":"","url":"https://api.github.com/users/personalrobotics","html_url":"https://github.com/personalrobotics","followers_url":"https://api.github.com/users/personalrobotics/followers","following_url":"https://api.github.com/users/personalrobotics/following{/other_user}","gists_url":"https://api.github.com/users/personalrobotics/gists{/gist_id}","starred_url":"https://api.github.com/users/personalrobotics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/personalrobotics/subscriptions","organizations_url":"https://api.github.com/users/personalrobotics/orgs","repos_url":"https://api.github.com/users/personalrobotics/repos","events_url":"https://api.github.com/users/personalrobotics/events{/privacy}","received_events_url":"https://api.github.com/users/personalrobotics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/personalrobotics/prpy","description":"Python utilities used by the Personal Robotics Laboratory.","fork":false,"url":"https://api.github.com/repos/personalrobotics/prpy","forks_url":"https://api.github.com/repos/personalrobotics/prpy/forks","keys_url":"https://api.github.com/repos/personalrobotics/prpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/personalrobotics/prpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/personalrobotics/prpy/teams","hooks_url":"https://api.github.com/repos/personalrobotics/prpy/hooks","issue_events_url":"https://api.github.com/repos/personalrobotics/prpy/issues/events{/number}","events_url":"https://api.github.com/repos/personalrobotics/prpy/events","assignees_url":"https://api.github.com/repos/personalrobotics/prpy/assignees{/user}","branches_url":"https://api.github.com/repos/personalrobotics/prpy/branches{/branch}","tags_url":"https://api.github.com/repos/personalrobotics/prpy/tags","blobs_url":"https://api.github.com/repos/personalrobotics/prpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/personalrobotics/prpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/personalrobotics/prpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/personalrobotics/prpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/personalrobotics/prpy/statuses/{sha}","languages_url":"https://api.github.com/repos/personalrobotics/prpy/languages","stargazers_url":"https://api.github.com/repos/personalrobotics/prpy/stargazers","contributors_url":"https://api.github.com/repos/personalrobotics/prpy/contributors","subscribers_url":"https://api.github.com/repos/personalrobotics/prpy/subscribers","subscription_url":"https://api.github.com/repos/personalrobotics/prpy/subscription","commits_url":"https://api.github.com/repos/personalrobotics/prpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/personalrobotics/prpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/personalrobotics/prpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/personalrobotics/prpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/personalrobotics/prpy/contents/{+path}","compare_url":"https://api.github.com/repos/personalrobotics/prpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/personalrobotics/prpy/merges","archive_url":"https://api.github.com/repos/personalrobotics/prpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/personalrobotics/prpy/downloads","issues_url":"https://api.github.com/repos/personalrobotics/prpy/issues{/number}","pulls_url":"https://api.github.com/repos/personalrobotics/prpy/pulls{/number}","milestones_url":"https://api.github.com/repos/personalrobotics/prpy/milestones{/number}","notifications_url":"https://api.github.com/repos/personalrobotics/prpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/personalrobotics/prpy/labels{/name}","releases_url":"https://api.github.com/repos/personalrobotics/prpy/releases{/id}","deployments_url":"https://api.github.com/repos/personalrobotics/prpy/deployments","created_at":"2014-06-24T04:44:39Z","updated_at":"2016-11-21T08:13:20Z","pushed_at":"2016-11-28T23:42:50Z","git_url":"git://github.com/personalrobotics/prpy.git","ssh_url":"git@github.com:personalrobotics/prpy.git","clone_url":"https://github.com/personalrobotics/prpy.git","svn_url":"https://github.com/personalrobotics/prpy","homepage":"","size":7497,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":44,"forks":11,"open_issues":44,"watchers":9,"default_branch":"master"}},"base":{"label":"personalrobotics:master","ref":"master","sha":"630f31cc5e56efcb716730cdcc70118961e0e35e","user":{"login":"personalrobotics","id":4705918,"avatar_url":"https://avatars.githubusercontent.com/u/4705918?v=3","gravatar_id":"","url":"https://api.github.com/users/personalrobotics","html_url":"https://github.com/personalrobotics","followers_url":"https://api.github.com/users/personalrobotics/followers","following_url":"https://api.github.com/users/personalrobotics/following{/other_user}","gists_url":"https://api.github.com/users/personalrobotics/gists{/gist_id}","starred_url":"https://api.github.com/users/personalrobotics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/personalrobotics/subscriptions","organizations_url":"https://api.github.com/users/personalrobotics/orgs","repos_url":"https://api.github.com/users/personalrobotics/repos","events_url":"https://api.github.com/users/personalrobotics/events{/privacy}","received_events_url":"https://api.github.com/users/personalrobotics/received_events","type":"Organization","site_admin":false},"repo":{"id":21152391,"name":"prpy","full_name":"personalrobotics/prpy","owner":{"login":"personalrobotics","id":4705918,"avatar_url":"https://avatars.githubusercontent.com/u/4705918?v=3","gravatar_id":"","url":"https://api.github.com/users/personalrobotics","html_url":"https://github.com/personalrobotics","followers_url":"https://api.github.com/users/personalrobotics/followers","following_url":"https://api.github.com/users/personalrobotics/following{/other_user}","gists_url":"https://api.github.com/users/personalrobotics/gists{/gist_id}","starred_url":"https://api.github.com/users/personalrobotics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/personalrobotics/subscriptions","organizations_url":"https://api.github.com/users/personalrobotics/orgs","repos_url":"https://api.github.com/users/personalrobotics/repos","events_url":"https://api.github.com/users/personalrobotics/events{/privacy}","received_events_url":"https://api.github.com/users/personalrobotics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/personalrobotics/prpy","description":"Python utilities used by the Personal Robotics Laboratory.","fork":false,"url":"https://api.github.com/repos/personalrobotics/prpy","forks_url":"https://api.github.com/repos/personalrobotics/prpy/forks","keys_url":"https://api.github.com/repos/personalrobotics/prpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/personalrobotics/prpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/personalrobotics/prpy/teams","hooks_url":"https://api.github.com/repos/personalrobotics/prpy/hooks","issue_events_url":"https://api.github.com/repos/personalrobotics/prpy/issues/events{/number}","events_url":"https://api.github.com/repos/personalrobotics/prpy/events","assignees_url":"https://api.github.com/repos/personalrobotics/prpy/assignees{/user}","branches_url":"https://api.github.com/repos/personalrobotics/prpy/branches{/branch}","tags_url":"https://api.github.com/repos/personalrobotics/prpy/tags","blobs_url":"https://api.github.com/repos/personalrobotics/prpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/personalrobotics/prpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/personalrobotics/prpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/personalrobotics/prpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/personalrobotics/prpy/statuses/{sha}","languages_url":"https://api.github.com/repos/personalrobotics/prpy/languages","stargazers_url":"https://api.github.com/repos/personalrobotics/prpy/stargazers","contributors_url":"https://api.github.com/repos/personalrobotics/prpy/contributors","subscribers_url":"https://api.github.com/repos/personalrobotics/prpy/subscribers","subscription_url":"https://api.github.com/repos/personalrobotics/prpy/subscription","commits_url":"https://api.github.com/repos/personalrobotics/prpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/personalrobotics/prpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/personalrobotics/prpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/personalrobotics/prpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/personalrobotics/prpy/contents/{+path}","compare_url":"https://api.github.com/repos/personalrobotics/prpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/personalrobotics/prpy/merges","archive_url":"https://api.github.com/repos/personalrobotics/prpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/personalrobotics/prpy/downloads","issues_url":"https://api.github.com/repos/personalrobotics/prpy/issues{/number}","pulls_url":"https://api.github.com/repos/personalrobotics/prpy/pulls{/number}","milestones_url":"https://api.github.com/repos/personalrobotics/prpy/milestones{/number}","notifications_url":"https://api.github.com/repos/personalrobotics/prpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/personalrobotics/prpy/labels{/name}","releases_url":"https://api.github.com/repos/personalrobotics/prpy/releases{/id}","deployments_url":"https://api.github.com/repos/personalrobotics/prpy/deployments","created_at":"2014-06-24T04:44:39Z","updated_at":"2016-11-21T08:13:20Z","pushed_at":"2016-11-28T23:42:50Z","git_url":"git://github.com/personalrobotics/prpy.git","ssh_url":"git@github.com:personalrobotics/prpy.git","clone_url":"https://github.com/personalrobotics/prpy.git","svn_url":"https://github.com/personalrobotics/prpy","homepage":"","size":7497,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":44,"forks":11,"open_issues":44,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/362"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/362"},"issue":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/362"},"comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/362/comments"},"review_comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/362/comments"},"review_comment":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/362/commits"},"statuses":{"href":"https://api.github.com/repos/personalrobotics/prpy/statuses/1be4e8544a8d5667931adc19d8097833c8b7bd6e"}}}}
{"actor":{"display_login":"Shushman"}}