{"action":"created","comment":{"url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/comments/56515294","id":56515294,"diff_hunk":"@@ -0,0 +1,349 @@\n+// Copyright 2016 Wolfgang Merkt\n+\n+/**\n+ * Listens for joint position goal commands for the position controlled joints, and feeds them to the robot.\n+ *\n+ * Forwards joint state over LCM in appropriate status messages.\n+ *\n+ * Runs at 500 Hz in the Valkyrie ros_control main loop as a plugin.\n+ *\n+ * Based on LCM2ROSControl originally by gizatt@mit.edu\n+ *\n+ * wolfgang.merkt@ed.ac.uk, 201603**\n+ */\n+\n+#include <map>\n+#include <string>\n+#include <algorithm>\n+#include <vector>\n+#include <set>\n+\n+#include <hardware_interface/joint_command_interface.h>\n+#include <controller_interface/controller.h>\n+#include <pluginlib/class_list_macros.h>\n+\n+#include <joint_limits_interface/joint_limits.h>\n+#include <joint_limits_interface/joint_limits_rosparam.h>\n+\n+#include <lcm/lcm-cpp.hpp>\n+#include \"lcmtypes/bot_core/joint_state_t.hpp\"\n+#include \"lcmtypes/bot_core/robot_state_t.hpp\"\n+\n+inline double clamp(double x, double lower, double upper) {\n+    return x < lower ? lower : (x > upper ? upper : x);  // TODO: move to std::min std::max","path":"src/JointPositionGoalController.cpp","position":33,"original_position":33,"commit_id":"e45df2851b3eefeb8bc65992816a7e82bf475764","original_commit_id":"e45df2851b3eefeb8bc65992816a7e82bf475764","user":{"login":"mauricefallon","id":6404227,"avatar_url":"https://avatars.githubusercontent.com/u/6404227?v=3","gravatar_id":"","url":"https://api.github.com/users/mauricefallon","html_url":"https://github.com/mauricefallon","followers_url":"https://api.github.com/users/mauricefallon/followers","following_url":"https://api.github.com/users/mauricefallon/following{/other_user}","gists_url":"https://api.github.com/users/mauricefallon/gists{/gist_id}","starred_url":"https://api.github.com/users/mauricefallon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauricefallon/subscriptions","organizations_url":"https://api.github.com/users/mauricefallon/orgs","repos_url":"https://api.github.com/users/mauricefallon/repos","events_url":"https://api.github.com/users/mauricefallon/events{/privacy}","received_events_url":"https://api.github.com/users/mauricefallon/received_events","type":"User","site_admin":false},"body":"move to std:min or std:max before merging","created_at":"2016-03-17T14:45:33Z","updated_at":"2016-03-17T14:45:33Z","html_url":"https://github.com/openhumanoids/valkyrie_translator/pull/8#discussion_r56515294","pull_request_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/comments/56515294"},"html":{"href":"https://github.com/openhumanoids/valkyrie_translator/pull/8#discussion_r56515294"},"pull_request":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8","id":63228735,"html_url":"https://github.com/openhumanoids/valkyrie_translator/pull/8","diff_url":"https://github.com/openhumanoids/valkyrie_translator/pull/8.diff","patch_url":"https://github.com/openhumanoids/valkyrie_translator/pull/8.patch","issue_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/8","number":8,"state":"open","locked":false,"title":"Add JointPositionGoalController","user":{"login":"wxmerkt","id":1664508,"avatar_url":"https://avatars.githubusercontent.com/u/1664508?v=3","gravatar_id":"","url":"https://api.github.com/users/wxmerkt","html_url":"https://github.com/wxmerkt","followers_url":"https://api.github.com/users/wxmerkt/followers","following_url":"https://api.github.com/users/wxmerkt/following{/other_user}","gists_url":"https://api.github.com/users/wxmerkt/gists{/gist_id}","starred_url":"https://api.github.com/users/wxmerkt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxmerkt/subscriptions","organizations_url":"https://api.github.com/users/wxmerkt/orgs","repos_url":"https://api.github.com/users/wxmerkt/repos","events_url":"https://api.github.com/users/wxmerkt/events{/privacy}","received_events_url":"https://api.github.com/users/wxmerkt/received_events","type":"User","site_admin":false},"body":"Adds a controller that expects a JOINT_POSITION_GOAL message and executes it adhering to conservative, definable joint position constraints (using ROSControl's preferred JointLimitsInterface) as well as a joint velocity constraint. Example launch file for controlling the neck included.\r\n\r\nTested in simulation with Gazebo:\r\n[![JointPositionGoalController](http://img.youtube.com/vi/MtgpuEE7rHE/0.jpg)](https://www.youtube.com/watch?v=MtgpuEE7rHE)\r\nhttps://www.youtube.com/watch?v=MtgpuEE7rHE","created_at":"2016-03-17T14:14:30Z","updated_at":"2016-03-17T14:45:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3aa045fc4cc9178e9fc36d9940b3fbe8727ac465","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8/commits","review_comments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8/comments","review_comment_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/8/comments","statuses_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/statuses/e45df2851b3eefeb8bc65992816a7e82bf475764","head":{"label":"openhumanoids:wxm-add-joint-position-goal-controller","ref":"wxm-add-joint-position-goal-controller","sha":"e45df2851b3eefeb8bc65992816a7e82bf475764","user":{"login":"openhumanoids","id":6392416,"avatar_url":"https://avatars.githubusercontent.com/u/6392416?v=3","gravatar_id":"","url":"https://api.github.com/users/openhumanoids","html_url":"https://github.com/openhumanoids","followers_url":"https://api.github.com/users/openhumanoids/followers","following_url":"https://api.github.com/users/openhumanoids/following{/other_user}","gists_url":"https://api.github.com/users/openhumanoids/gists{/gist_id}","starred_url":"https://api.github.com/users/openhumanoids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhumanoids/subscriptions","organizations_url":"https://api.github.com/users/openhumanoids/orgs","repos_url":"https://api.github.com/users/openhumanoids/repos","events_url":"https://api.github.com/users/openhumanoids/events{/privacy}","received_events_url":"https://api.github.com/users/openhumanoids/received_events","type":"Organization","site_admin":false},"repo":{"id":53056274,"name":"valkyrie_translator","full_name":"openhumanoids/valkyrie_translator","owner":{"login":"openhumanoids","id":6392416,"avatar_url":"https://avatars.githubusercontent.com/u/6392416?v=3","gravatar_id":"","url":"https://api.github.com/users/openhumanoids","html_url":"https://github.com/openhumanoids","followers_url":"https://api.github.com/users/openhumanoids/followers","following_url":"https://api.github.com/users/openhumanoids/following{/other_user}","gists_url":"https://api.github.com/users/openhumanoids/gists{/gist_id}","starred_url":"https://api.github.com/users/openhumanoids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhumanoids/subscriptions","organizations_url":"https://api.github.com/users/openhumanoids/orgs","repos_url":"https://api.github.com/users/openhumanoids/repos","events_url":"https://api.github.com/users/openhumanoids/events{/privacy}","received_events_url":"https://api.github.com/users/openhumanoids/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openhumanoids/valkyrie_translator","description":"LCM2ROSControl","fork":false,"url":"https://api.github.com/repos/openhumanoids/valkyrie_translator","forks_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/forks","keys_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/teams","hooks_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/hooks","issue_events_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/events{/number}","events_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/events","assignees_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/assignees{/user}","branches_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/branches{/branch}","tags_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/tags","blobs_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/statuses/{sha}","languages_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/languages","stargazers_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/stargazers","contributors_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/contributors","subscribers_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/subscribers","subscription_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/subscription","commits_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/contents/{+path}","compare_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/merges","archive_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/downloads","issues_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues{/number}","pulls_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls{/number}","milestones_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/milestones{/number}","notifications_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/labels{/name}","releases_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/releases{/id}","deployments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/deployments","created_at":"2016-03-03T14:26:42Z","updated_at":"2016-03-03T14:27:09Z","pushed_at":"2016-03-17T14:14:30Z","git_url":"git://github.com/openhumanoids/valkyrie_translator.git","ssh_url":"git@github.com:openhumanoids/valkyrie_translator.git","clone_url":"https://github.com/openhumanoids/valkyrie_translator.git","svn_url":"https://github.com/openhumanoids/valkyrie_translator","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"openhumanoids:master","ref":"master","sha":"0cd708e8aa51c7639c9720ae536e80aa169b36d7","user":{"login":"openhumanoids","id":6392416,"avatar_url":"https://avatars.githubusercontent.com/u/6392416?v=3","gravatar_id":"","url":"https://api.github.com/users/openhumanoids","html_url":"https://github.com/openhumanoids","followers_url":"https://api.github.com/users/openhumanoids/followers","following_url":"https://api.github.com/users/openhumanoids/following{/other_user}","gists_url":"https://api.github.com/users/openhumanoids/gists{/gist_id}","starred_url":"https://api.github.com/users/openhumanoids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhumanoids/subscriptions","organizations_url":"https://api.github.com/users/openhumanoids/orgs","repos_url":"https://api.github.com/users/openhumanoids/repos","events_url":"https://api.github.com/users/openhumanoids/events{/privacy}","received_events_url":"https://api.github.com/users/openhumanoids/received_events","type":"Organization","site_admin":false},"repo":{"id":53056274,"name":"valkyrie_translator","full_name":"openhumanoids/valkyrie_translator","owner":{"login":"openhumanoids","id":6392416,"avatar_url":"https://avatars.githubusercontent.com/u/6392416?v=3","gravatar_id":"","url":"https://api.github.com/users/openhumanoids","html_url":"https://github.com/openhumanoids","followers_url":"https://api.github.com/users/openhumanoids/followers","following_url":"https://api.github.com/users/openhumanoids/following{/other_user}","gists_url":"https://api.github.com/users/openhumanoids/gists{/gist_id}","starred_url":"https://api.github.com/users/openhumanoids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhumanoids/subscriptions","organizations_url":"https://api.github.com/users/openhumanoids/orgs","repos_url":"https://api.github.com/users/openhumanoids/repos","events_url":"https://api.github.com/users/openhumanoids/events{/privacy}","received_events_url":"https://api.github.com/users/openhumanoids/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openhumanoids/valkyrie_translator","description":"LCM2ROSControl","fork":false,"url":"https://api.github.com/repos/openhumanoids/valkyrie_translator","forks_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/forks","keys_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/teams","hooks_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/hooks","issue_events_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/events{/number}","events_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/events","assignees_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/assignees{/user}","branches_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/branches{/branch}","tags_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/tags","blobs_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/refs{/sha}","trees_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/statuses/{sha}","languages_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/languages","stargazers_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/stargazers","contributors_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/contributors","subscribers_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/subscribers","subscription_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/subscription","commits_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/commits{/sha}","git_commits_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/git/commits{/sha}","comments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/comments{/number}","issue_comment_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/comments{/number}","contents_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/contents/{+path}","compare_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/merges","archive_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/downloads","issues_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues{/number}","pulls_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls{/number}","milestones_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/milestones{/number}","notifications_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/labels{/name}","releases_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/releases{/id}","deployments_url":"https://api.github.com/repos/openhumanoids/valkyrie_translator/deployments","created_at":"2016-03-03T14:26:42Z","updated_at":"2016-03-03T14:27:09Z","pushed_at":"2016-03-17T14:14:30Z","git_url":"git://github.com/openhumanoids/valkyrie_translator.git","ssh_url":"git@github.com:openhumanoids/valkyrie_translator.git","clone_url":"https://github.com/openhumanoids/valkyrie_translator.git","svn_url":"https://github.com/openhumanoids/valkyrie_translator","homepage":null,"size":60,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8"},"html":{"href":"https://github.com/openhumanoids/valkyrie_translator/pull/8"},"issue":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/8"},"comments":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/openhumanoids/valkyrie_translator/statuses/e45df2851b3eefeb8bc65992816a7e82bf475764"}}}}