{"action":"created","comment":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/44679882","id":44679882,"diff_hunk":"@@ -914,6 +914,204 @@ def ComputeUnitTiming(robot, traj, env=None):\n     return new_traj\n \n \n+def CheckJointLimits(robot, q):\n+    \"\"\"\n+    Check if a configuration is within a robot's joint position limits.\n+\n+    If outside limits, this procedure throws an exception\n+    of type JointLimitError.\n+\n+    @param openravepy.robot robot: The robot.\n+    @param list             q:     List or array of joint positions.\n+    \"\"\"\n+    from prpy.planning.exceptions import JointLimitError\n+\n+    q_limit_min, q_limit_max = robot.GetActiveDOFLimits()\n+    active_dof_indices = robot.GetActiveDOFIndices()\n+\n+    if len(q) != len(active_dof_indices):\n+        raise ValueError('The number of joints in the configuration q '\n+                         'is not equal to the number of active DOF.')\n+\n+    lower_position_violations = (q < q_limit_min)\n+    if lower_position_violations.any():\n+        index = lower_position_violations.nonzero()[0][0]\n+        raise JointLimitError(robot,\n+            dof_index=active_dof_indices[index],\n+            dof_value=q[index],\n+            dof_limit=q_limit_min[index],\n+            description='position')\n+\n+    upper_position_violations = (q > q_limit_max)\n+    if upper_position_violations.any():\n+        index = upper_position_violations.nonzero()[0][0]\n+        raise JointLimitError(robot,\n+            dof_index=active_dof_indices[index],\n+            dof_value=q[index],\n+            dof_limit=q_limit_max[index],\n+            description='position')\n+\n+\n+def ConvertIntToBinaryString(x, reverse=False):\n+    \"\"\"\n+    Convert an integer to a binary string.\n+\n+    Optionally reverse the output string, which is\n+    required for producing a Van Der Corput sequence.\n+\n+    @param int  x:       The number to be converted.\n+    @param bool reverse: If True, the output string will be reversed.\n+\n+    @returns string: A binary number as a string.\n+    \"\"\"\n+    if type(x) != int:\n+        raise ValueError('Input number must be an integer')\n+\n+    if reverse == True:\n+        return ''.join(reversed(bin(x)[2:]))\n+\n+    return ''.join(bin(x)[2:])\n+\n+\n+def VanDerCorputSequence(lower=0.0, upper=1.0, include_endpoints=True):\n+    \"\"\"\n+    Generate the binary Van der Corput sequence, where each value\n+    is a dyadic fraction re-scaled to the desired range.\n+\n+    For example, on the interval [0,1], the first 5 values of\n+    the Van der Corput sequence are:\n+    [0.0, 1.0, 0.5, 0.5, 0.75]\n+\n+    @param float lower: The first value of the range of the sequence.\n+    @param float upper: The last value of the range of the sequence.\n+\n+    @param bool include_endpoints: If True, the output sequence will\n+                                   include the value 'lower' and the\n+                                   value 'upper'.\n+                                   If False, these endpoint values\n+                                   will not be returned.\n+\n+    @returns generator: A sequence of float values.\n+    \"\"\"\n+    from itertools import count, chain\n+\n+    if include_endpoints == True:\n+        endpoints = (0.0, 1.0)\n+    else:\n+        endpoints = None","path":"src/prpy/util.py","position":88,"original_position":88,"commit_id":"fa0a356fe7dc476498256b0e16e0611daceefac2","original_commit_id":"fa0a356fe7dc476498256b0e16e0611daceefac2","user":{"login":"mkoval","id":142251,"avatar_url":"https://avatars.githubusercontent.com/u/142251?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoval","html_url":"https://github.com/mkoval","followers_url":"https://api.github.com/users/mkoval/followers","following_url":"https://api.github.com/users/mkoval/following{/other_user}","gists_url":"https://api.github.com/users/mkoval/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoval/subscriptions","organizations_url":"https://api.github.com/users/mkoval/orgs","repos_url":"https://api.github.com/users/mkoval/repos","events_url":"https://api.github.com/users/mkoval/events{/privacy}","received_events_url":"https://api.github.com/users/mkoval/received_events","type":"User","site_admin":false},"body":"If you set `endpoints = []` here you can skip the `endpoints or []` check below.","created_at":"2015-11-12T16:36:53Z","updated_at":"2015-11-12T16:36:53Z","html_url":"https://github.com/personalrobotics/prpy/pull/228#discussion_r44679882","pull_request_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/228","_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/44679882"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/228#discussion_r44679882"},"pull_request":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/228","id":50436539,"html_url":"https://github.com/personalrobotics/prpy/pull/228","diff_url":"https://github.com/personalrobotics/prpy/pull/228.diff","patch_url":"https://github.com/personalrobotics/prpy/pull/228.patch","issue_url":"https://api.github.com/repos/personalrobotics/prpy/issues/228","number":228,"state":"open","locked":false,"title":"New method for getting collision sample points, Switch SnapPlanner...","user":{"login":"DavidB-CMU","id":14189705,"avatar_url":"https://avatars.githubusercontent.com/u/14189705?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidB-CMU","html_url":"https://github.com/DavidB-CMU","followers_url":"https://api.github.com/users/DavidB-CMU/followers","following_url":"https://api.github.com/users/DavidB-CMU/following{/other_user}","gists_url":"https://api.github.com/users/DavidB-CMU/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidB-CMU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidB-CMU/subscriptions","organizations_url":"https://api.github.com/users/DavidB-CMU/orgs","repos_url":"https://api.github.com/users/DavidB-CMU/repos","events_url":"https://api.github.com/users/DavidB-CMU/events{/privacy}","received_events_url":"https://api.github.com/users/DavidB-CMU/received_events","type":"User","site_admin":false},"body":"More details in issue #226 ","created_at":"2015-11-11T21:09:10Z","updated_at":"2015-11-12T16:36:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d204f9f35367dae11bfcb70a9ebfdc35bbc7f989","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/228/commits","review_comments_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/228/comments","review_comment_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/personalrobotics/prpy/issues/228/comments","statuses_url":"https://api.github.com/repos/personalrobotics/prpy/statuses/fa0a356fe7dc476498256b0e16e0611daceefac2","head":{"label":"DavidB-CMU:master","ref":"master","sha":"fa0a356fe7dc476498256b0e16e0611daceefac2","user":{"login":"DavidB-CMU","id":14189705,"avatar_url":"https://avatars.githubusercontent.com/u/14189705?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidB-CMU","html_url":"https://github.com/DavidB-CMU","followers_url":"https://api.github.com/users/DavidB-CMU/followers","following_url":"https://api.github.com/users/DavidB-CMU/following{/other_user}","gists_url":"https://api.github.com/users/DavidB-CMU/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidB-CMU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidB-CMU/subscriptions","organizations_url":"https://api.github.com/users/DavidB-CMU/orgs","repos_url":"https://api.github.com/users/DavidB-CMU/repos","events_url":"https://api.github.com/users/DavidB-CMU/events{/privacy}","received_events_url":"https://api.github.com/users/DavidB-CMU/received_events","type":"User","site_admin":false},"repo":{"id":44842764,"name":"prpy","full_name":"DavidB-CMU/prpy","owner":{"login":"DavidB-CMU","id":14189705,"avatar_url":"https://avatars.githubusercontent.com/u/14189705?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidB-CMU","html_url":"https://github.com/DavidB-CMU","followers_url":"https://api.github.com/users/DavidB-CMU/followers","following_url":"https://api.github.com/users/DavidB-CMU/following{/other_user}","gists_url":"https://api.github.com/users/DavidB-CMU/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidB-CMU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidB-CMU/subscriptions","organizations_url":"https://api.github.com/users/DavidB-CMU/orgs","repos_url":"https://api.github.com/users/DavidB-CMU/repos","events_url":"https://api.github.com/users/DavidB-CMU/events{/privacy}","received_events_url":"https://api.github.com/users/DavidB-CMU/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DavidB-CMU/prpy","description":"Python utilities used by the Personal Robotics Laboratory.","fork":true,"url":"https://api.github.com/repos/DavidB-CMU/prpy","forks_url":"https://api.github.com/repos/DavidB-CMU/prpy/forks","keys_url":"https://api.github.com/repos/DavidB-CMU/prpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DavidB-CMU/prpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DavidB-CMU/prpy/teams","hooks_url":"https://api.github.com/repos/DavidB-CMU/prpy/hooks","issue_events_url":"https://api.github.com/repos/DavidB-CMU/prpy/issues/events{/number}","events_url":"https://api.github.com/repos/DavidB-CMU/prpy/events","assignees_url":"https://api.github.com/repos/DavidB-CMU/prpy/assignees{/user}","branches_url":"https://api.github.com/repos/DavidB-CMU/prpy/branches{/branch}","tags_url":"https://api.github.com/repos/DavidB-CMU/prpy/tags","blobs_url":"https://api.github.com/repos/DavidB-CMU/prpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DavidB-CMU/prpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DavidB-CMU/prpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/DavidB-CMU/prpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DavidB-CMU/prpy/statuses/{sha}","languages_url":"https://api.github.com/repos/DavidB-CMU/prpy/languages","stargazers_url":"https://api.github.com/repos/DavidB-CMU/prpy/stargazers","contributors_url":"https://api.github.com/repos/DavidB-CMU/prpy/contributors","subscribers_url":"https://api.github.com/repos/DavidB-CMU/prpy/subscribers","subscription_url":"https://api.github.com/repos/DavidB-CMU/prpy/subscription","commits_url":"https://api.github.com/repos/DavidB-CMU/prpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/DavidB-CMU/prpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/DavidB-CMU/prpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/DavidB-CMU/prpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/DavidB-CMU/prpy/contents/{+path}","compare_url":"https://api.github.com/repos/DavidB-CMU/prpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DavidB-CMU/prpy/merges","archive_url":"https://api.github.com/repos/DavidB-CMU/prpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DavidB-CMU/prpy/downloads","issues_url":"https://api.github.com/repos/DavidB-CMU/prpy/issues{/number}","pulls_url":"https://api.github.com/repos/DavidB-CMU/prpy/pulls{/number}","milestones_url":"https://api.github.com/repos/DavidB-CMU/prpy/milestones{/number}","notifications_url":"https://api.github.com/repos/DavidB-CMU/prpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DavidB-CMU/prpy/labels{/name}","releases_url":"https://api.github.com/repos/DavidB-CMU/prpy/releases{/id}","created_at":"2015-10-23T22:57:24Z","updated_at":"2015-10-23T22:57:25Z","pushed_at":"2015-11-11T22:32:46Z","git_url":"git://github.com/DavidB-CMU/prpy.git","ssh_url":"git@github.com:DavidB-CMU/prpy.git","clone_url":"https://github.com/DavidB-CMU/prpy.git","svn_url":"https://github.com/DavidB-CMU/prpy","homepage":"","size":1058,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"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":"personalrobotics:master","ref":"master","sha":"3d1e8425b085f1f5443f42d9310673adf894c6e2","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}","created_at":"2014-06-24T04:44:39Z","updated_at":"2015-09-07T19:00:26Z","pushed_at":"2015-11-11T22:32:46Z","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":2785,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":32,"forks":7,"open_issues":32,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/228"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/228"},"issue":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/228"},"comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/personalrobotics/prpy/statuses/fa0a356fe7dc476498256b0e16e0611daceefac2"}}}}