{"action":"created","comment":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/37804892","id":37804892,"diff_hunk":"@@ -749,3 +749,178 @@ def IsTimedTrajectory(trajectory):\n     \"\"\"\n     cspec = trajectory.GetConfigurationSpecification()\n     return cspec.ExtractDeltaTime(trajectory.GetWaypoint(0)) is not None\n+\n+\n+def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):\n+    \"\"\"\n+    Helper function to extract the joint position, velocity and acceleration\n+    from an OpenRAVE trajectory.\n+    @param robot The OpenRAVE robot\n+    @param traj An OpenRAVE trajectory\n+    @param times List of times in seconds\n+    @param derivatives list of desired derivatives (only supports 0, 1, 2),\n+                       defaults to [0, 1, 2]\n+    @return pva_list List of list of position, velocity and acceleration\n+                     at specified times.\n+                     Inserts 'None' for unavailable or undesired fields\n+                     The i-th element is the i-th derivative of position\n+                     Of size |times| x 3\n+\n+    \"\"\"\n+    for d in derivatives:\n+        if not (d == 0 or d == 1 or d == 2):\n+            raise ValueError('Derivative input {0:} is not 0, 1, or 2'\n+                             .format(derivatives))\n+\n+    duration = traj.GetDuration()\n+\n+    if any(times > duration):\n+        raise ValueError('Input times {0:} exceed duration {1:.2f}'\n+                         .format(times, duration))\n+\n+    cspec = traj.GetConfigurationSpecification()\n+    num_dofs = robot.GetDOF()\n+    dof_indices = range(num_dofs)\n+\n+    pva_list = []\n+    for t in times:\n+        pva = [None] * 3\n+        trajdata = traj.Sample(t)\n+        for d in derivatives:\n+            pva[d] = cspec.ExtractJointValues(trajdata, robot,\n+                                              dof_indices, d)\n+        pva_list.append(pva)\n+\n+    return pva_list\n+\n+\n+def JointStateFromTraj(robot, traj, time):\n+    \"\"\"\n+    Helper function to extract the joint position, velocity and acceleration\n+    from an OpenRAVE trajectory.\n+    @param robot The OpenRAVE robot\n+    @param traj An OpenRAVE trajectory\n+    @param time time in seconds\n+    @return pva Position, velocity and acceleration\n+                at specified time. Inserts 'None' for unavailable fields\n+    \"\"\"","path":"src/prpy/util.py","position":58,"original_position":58,"commit_id":"1fd2aeddc63d99cf86b996bcd0f7e1c46c402d64","original_commit_id":"1fd2aeddc63d99cf86b996bcd0f7e1c46c402d64","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":"It would be nice to add `derivatives` as an argument here, too, and pass it down to `JointStatesFromTraj`.","created_at":"2015-08-24T21:08:18Z","updated_at":"2015-08-24T21:08:18Z","html_url":"https://github.com/personalrobotics/prpy/pull/166#discussion_r37804892","pull_request_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/166","_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments/37804892"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/166#discussion_r37804892"},"pull_request":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/166"}}},"pull_request":{"url":"https://api.github.com/repos/personalrobotics/prpy/pulls/166","id":42973324,"html_url":"https://github.com/personalrobotics/prpy/pull/166","diff_url":"https://github.com/personalrobotics/prpy/pull/166.diff","patch_url":"https://github.com/personalrobotics/prpy/pull/166.patch","issue_url":"https://api.github.com/repos/personalrobotics/prpy/issues/166","number":166,"state":"open","locked":false,"title":"Helper functions for computing body point acceleration twists","user":{"login":"siddhss5","id":7348473,"avatar_url":"https://avatars.githubusercontent.com/u/7348473?v=3","gravatar_id":"","url":"https://api.github.com/users/siddhss5","html_url":"https://github.com/siddhss5","followers_url":"https://api.github.com/users/siddhss5/followers","following_url":"https://api.github.com/users/siddhss5/following{/other_user}","gists_url":"https://api.github.com/users/siddhss5/gists{/gist_id}","starred_url":"https://api.github.com/users/siddhss5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddhss5/subscriptions","organizations_url":"https://api.github.com/users/siddhss5/orgs","repos_url":"https://api.github.com/users/siddhss5/repos","events_url":"https://api.github.com/users/siddhss5/events{/privacy}","received_events_url":"https://api.github.com/users/siddhss5/received_events","type":"User","site_admin":false},"body":"I added some functionality in `prpy/util` to enable computation of acceleration twists of arbitrary body points, on their own, and also from an OpenRAVE trajectory.","created_at":"2015-08-20T20:18:15Z","updated_at":"2015-08-24T21:08:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80b612c649bb84e338c08fe320bb78fbf21b8770","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/166/commits","review_comments_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/166/comments","review_comment_url":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/personalrobotics/prpy/issues/166/comments","statuses_url":"https://api.github.com/repos/personalrobotics/prpy/statuses/1fd2aeddc63d99cf86b996bcd0f7e1c46c402d64","head":{"label":"personalrobotics:feature/bodypoint_acceleration_helper_functions","ref":"feature/bodypoint_acceleration_helper_functions","sha":"1fd2aeddc63d99cf86b996bcd0f7e1c46c402d64","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-07-02T20:42:38Z","pushed_at":"2015-08-24T20:37:33Z","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":2260,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":34,"forks":4,"open_issues":34,"watchers":4,"default_branch":"master"}},"base":{"label":"personalrobotics:master","ref":"master","sha":"a28c91c0813b1cea6b07393b656834ec9b1ba5d9","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-07-02T20:42:38Z","pushed_at":"2015-08-24T20:37:33Z","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":2260,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":34,"forks":4,"open_issues":34,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/166"},"html":{"href":"https://github.com/personalrobotics/prpy/pull/166"},"issue":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/166"},"comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/issues/166/comments"},"review_comments":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/166/comments"},"review_comment":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/personalrobotics/prpy/pulls/166/commits"},"statuses":{"href":"https://api.github.com/repos/personalrobotics/prpy/statuses/1fd2aeddc63d99cf86b996bcd0f7e1c46c402d64"}}}}