{"action":"created","comment":{"url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/26066646","id":26066646,"diff_hunk":"@@ -0,0 +1,26 @@\n+classdef Walking < atlasParams.Base\n+  methods\n+    function obj = Walking(r)\n+      typecheck(r, 'Atlas');\n+      obj = obj@atlasParams.Base(r);\n+      obj.whole_body.w_qdd = zeros(r.getNumVelocities(), 1);\n+      obj.whole_body.w_qdd(findPositionIndices(r, 'arm')) = .0001;\n+      obj.whole_body.w_qdd(findPositionIndices(r, 'back')) = .0001;\n+      obj.whole_body.w_qdd(r.findPositionIndices('back_bkx')) = 0.1;\n+      obj.whole_body.damping_ratio = 0.5;\n+      obj.body_motion(r.findLinkId('pelvis')).Kp = [nan; nan; 20; 20; 20; 20];\n+      obj.body_motion(r.findLinkId('pelvis')).damping_ratio = 0.5;\n+      obj.body_motion(r.foot_body_id.right).Kp = [100; 100; 100; 150; 150; 150];\n+      obj.body_motion(r.foot_body_id.right).damping_ratio = 0.5;\n+      obj.body_motion(r.foot_body_id.left).Kp = [100; 100; 100; 150; 150; 150];\n+      obj.body_motion(r.foot_body_id.left).damping_ratio = 0.5;\n+      [obj.body_motion.weight] = deal(0.15);\n+      obj.body_motion(r.findLinkId('pelvis')).weight = 0.075;","path":"examples/Atlas/+atlasParams/Walking.m","position":18,"original_position":18,"commit_id":"11e2681622d25bc88be18915f0567e9b899ee1bc","original_commit_id":"11e2681622d25bc88be18915f0567e9b899ee1bc","user":{"login":"rdeits","id":591886,"avatar_url":"https://avatars.githubusercontent.com/u/591886?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"body":"Yeah, but those values get changed even more by the time we actually build the controller. If i do runAtlasWalking (using the old controller), I see the following:\r\n\r\nfor the BodyMotionControlBlocks for the feet, we have Kp = [100; 100; 100; 150; 150; 150]\r\n\r\nfor the PelvisMotionControlBlock we have Kp = [0; 0; 150; 200; 200; 200] and an effective damping gain of 0.6\r\n\r\nbody_accel_input_weights = [0.15, 0.15, 0.075]\r\n\r\nSo, I think the defaults in Atlas.m aren't an accurate representation of what we're actually using anyway. These gains seem to work pretty well, and now we have them centralized and easy to update later. \r\n\r\n","created_at":"2015-03-09T19:26:15Z","updated_at":"2015-03-09T19:26:15Z","html_url":"https://github.com/RobotLocomotion/drake/pull/829#discussion_r26066646","pull_request_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829","_links":{"self":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/26066646"},"html":{"href":"https://github.com/RobotLocomotion/drake/pull/829#discussion_r26066646"},"pull_request":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829"}}},"pull_request":{"url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829","id":30533532,"html_url":"https://github.com/RobotLocomotion/drake/pull/829","diff_url":"https://github.com/RobotLocomotion/drake/pull/829.diff","patch_url":"https://github.com/RobotLocomotion/drake/pull/829.patch","issue_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/829","number":829,"state":"open","locked":false,"title":"Shiny new controller reorganization","user":{"login":"rdeits","id":591886,"avatar_url":"https://avatars.githubusercontent.com/u/591886?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"body":"Oooookay, this is a big one...\r\n\r\nThe primary contribution here is the all-new controller layout. This layout splits out all of the plan state, which was previously baked into the controller data, into a separate loop, which I'm calling PlanEval. The QP controller, rather than storing the plan, just receives the instantaneous snapshot of the plan and the robot state, and it produces torques and velocity references. I believe that the primary work for that reorganization is now complete. The next step is to write the additional DRC-side code to interface with the hardware and the simulator, but I'd like to first make sure the Drake changes look good to everybody. \r\n\r\nDoing this has led to a number of exciting changes:\r\n* By simplifying the work that the controller does, it became much easier to move the entire control loop into C++. As a result, the end-to-end time required for the controller has gone down from about 4ms to about 1ms. I think we should be able to achieve 500-1000Hz controller rates on Atlas. \r\n* The separate PlanEval loop means that it's easy to maintain a queue of plans without having multiple separate controllers. For example, we can easily transition from walking to standing using the same controller, and without most of the DRCStateMachine logic\r\n* The PlanEval loop should hopefully also allow us to change plans on the fly without disrupting the control loop, although that hasn't been tested yet\r\n* Because the controller has no internal notion of a plan, we can use the same exact controller object for standing, walking, etc. All that is required to build a standing controller is to hand it the output of a standing plan, and it can become a walking controller just by handing it the output of a walking plan.\r\n\r\nI've also done quite a bit more as part of this pull request:\r\n* Previously, default gains for walking, standing, etc. were stored in a variety of places including within Atlas.m, in the DRC wrappers, and in functions like `atlasUtil.simulateWalking`. To try to simplify that, I've collected all the default params for standing, walking, and recovery stepping in a package called `atlasParams`. The idea is that in order to define a new set of params, you can just create a class which inherits from `atlasParams.Base`, or `atlasParams.Walking`, etc. A new function, `atlasParams.getDefaults()` returns a struct with fields for each set of parameters. Rather than hard-coding gains at startup or receiving them individually over LCM, the controller and PlanEval both load all available param sets at startup and then can look up the correct params at each iteration by name. \r\n* I've also pulled in all of my work on recovery step planning. It's certainly not complete, but I think it's at least ready to start testing and experimenting with. We have a new function, `examples/Atlas/runAtlasStepRecovery` which starts Atlas with a velocity perturbation and then solves for a recovery step plan using the `MixedIntegerConvexProgram` interface. It can simulate that plan using the new controller layout. \r\n* All of the Atlas control blocks have been ported to c++, most of them in `QPCommon.cpp`. Their functions should be recognizable, but I've converted them all to functions instead of classes in order to reduce hidden state\r\n* @manuelli and I have also generalized the concept of a `QPControllerPlan` as something which can produce input to the QPController. Walking, standing, and whole-body motion are now generalized under a common interface. It's now much easier to construct a walking plan from a set of footsteps, or a standing plan from a given state. \r\n\r\nI've introduced a couple of new utilities that have been useful along the way:\r\n* `fcompare`: takes two functions and returns a new function which calls both stored functions, compares their outputs, and returns the output of the stored function.\r\n* `compareLCMMsgs`: recursively compares fields of LCM messages, useful for debugging LCM encoders\r\n* `megaquit`: for when `quit` doesn't actually cause Matlab to quit\r\n\r\nBefore this gets merged in, I need to go through and add documentation to all the new c++ functions. I'll be doing that tonight and tomorrow, but I'd like to get this pull request open now so the build servers can chew on it. @kuindersma can you please take a look at the new controller structure? It starts in InstantaneousQPController.m,  which calls setupAndSolveQP.m or instantaneousQPControllermex, depending on the value of `use_mex`.\r\n\r\n@psiorx can you please take a look at my changes to QPCommon and make sure I'm not doing anything obviously terrible, given that I'm pretty new to c++?\r\n\r\n@RussTedrake I've made the change to DrakeMexPointer that you recommended. The constructor that uses it is in `constructQPDataPointerMex.cpp`. \r\n\r\n","created_at":"2015-03-05T06:32:58Z","updated_at":"2015-03-09T19:26:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"006dd5bf4f3a7a08fa64caea1c59e570af63e9ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829/commits","review_comments_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829/comments","review_comment_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/829/comments","statuses_url":"https://api.github.com/repos/RobotLocomotion/drake/statuses/11e2681622d25bc88be18915f0567e9b899ee1bc","head":{"label":"rdeits:rename-and-reorganize","ref":"rename-and-reorganize","sha":"11e2681622d25bc88be18915f0567e9b899ee1bc","user":{"login":"rdeits","id":591886,"avatar_url":"https://avatars.githubusercontent.com/u/591886?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"repo":{"id":16285002,"name":"drake","full_name":"rdeits/drake","owner":{"login":"rdeits","id":591886,"avatar_url":"https://avatars.githubusercontent.com/u/591886?v=3","gravatar_id":"","url":"https://api.github.com/users/rdeits","html_url":"https://github.com/rdeits","followers_url":"https://api.github.com/users/rdeits/followers","following_url":"https://api.github.com/users/rdeits/following{/other_user}","gists_url":"https://api.github.com/users/rdeits/gists{/gist_id}","starred_url":"https://api.github.com/users/rdeits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdeits/subscriptions","organizations_url":"https://api.github.com/users/rdeits/orgs","repos_url":"https://api.github.com/users/rdeits/repos","events_url":"https://api.github.com/users/rdeits/events{/privacy}","received_events_url":"https://api.github.com/users/rdeits/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rdeits/drake","description":"A planning, control, and analysis toolbox for nonlinear dynamical systems.  Please see the WIKI for documentation.","fork":true,"url":"https://api.github.com/repos/rdeits/drake","forks_url":"https://api.github.com/repos/rdeits/drake/forks","keys_url":"https://api.github.com/repos/rdeits/drake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdeits/drake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdeits/drake/teams","hooks_url":"https://api.github.com/repos/rdeits/drake/hooks","issue_events_url":"https://api.github.com/repos/rdeits/drake/issues/events{/number}","events_url":"https://api.github.com/repos/rdeits/drake/events","assignees_url":"https://api.github.com/repos/rdeits/drake/assignees{/user}","branches_url":"https://api.github.com/repos/rdeits/drake/branches{/branch}","tags_url":"https://api.github.com/repos/rdeits/drake/tags","blobs_url":"https://api.github.com/repos/rdeits/drake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdeits/drake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdeits/drake/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdeits/drake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdeits/drake/statuses/{sha}","languages_url":"https://api.github.com/repos/rdeits/drake/languages","stargazers_url":"https://api.github.com/repos/rdeits/drake/stargazers","contributors_url":"https://api.github.com/repos/rdeits/drake/contributors","subscribers_url":"https://api.github.com/repos/rdeits/drake/subscribers","subscription_url":"https://api.github.com/repos/rdeits/drake/subscription","commits_url":"https://api.github.com/repos/rdeits/drake/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdeits/drake/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdeits/drake/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdeits/drake/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdeits/drake/contents/{+path}","compare_url":"https://api.github.com/repos/rdeits/drake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdeits/drake/merges","archive_url":"https://api.github.com/repos/rdeits/drake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdeits/drake/downloads","issues_url":"https://api.github.com/repos/rdeits/drake/issues{/number}","pulls_url":"https://api.github.com/repos/rdeits/drake/pulls{/number}","milestones_url":"https://api.github.com/repos/rdeits/drake/milestones{/number}","notifications_url":"https://api.github.com/repos/rdeits/drake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdeits/drake/labels{/name}","releases_url":"https://api.github.com/repos/rdeits/drake/releases{/id}","created_at":"2014-01-27T16:35:31Z","updated_at":"2014-06-24T19:16:19Z","pushed_at":"2015-03-09T19:04:26Z","git_url":"git://github.com/rdeits/drake.git","ssh_url":"git@github.com:rdeits/drake.git","clone_url":"https://github.com/rdeits/drake.git","svn_url":"https://github.com/rdeits/drake","homepage":"https://github.com/RobotLocomotion/drake/wiki","size":148464,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"RobotLocomotion:master","ref":"master","sha":"b6a0f07d13f83d3cadbc88d5479516ab52a42d49","user":{"login":"RobotLocomotion","id":6496345,"avatar_url":"https://avatars.githubusercontent.com/u/6496345?v=3","gravatar_id":"","url":"https://api.github.com/users/RobotLocomotion","html_url":"https://github.com/RobotLocomotion","followers_url":"https://api.github.com/users/RobotLocomotion/followers","following_url":"https://api.github.com/users/RobotLocomotion/following{/other_user}","gists_url":"https://api.github.com/users/RobotLocomotion/gists{/gist_id}","starred_url":"https://api.github.com/users/RobotLocomotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobotLocomotion/subscriptions","organizations_url":"https://api.github.com/users/RobotLocomotion/orgs","repos_url":"https://api.github.com/users/RobotLocomotion/repos","events_url":"https://api.github.com/users/RobotLocomotion/events{/privacy}","received_events_url":"https://api.github.com/users/RobotLocomotion/received_events","type":"Organization","site_admin":false},"repo":{"id":16256144,"name":"drake","full_name":"RobotLocomotion/drake","owner":{"login":"RobotLocomotion","id":6496345,"avatar_url":"https://avatars.githubusercontent.com/u/6496345?v=3","gravatar_id":"","url":"https://api.github.com/users/RobotLocomotion","html_url":"https://github.com/RobotLocomotion","followers_url":"https://api.github.com/users/RobotLocomotion/followers","following_url":"https://api.github.com/users/RobotLocomotion/following{/other_user}","gists_url":"https://api.github.com/users/RobotLocomotion/gists{/gist_id}","starred_url":"https://api.github.com/users/RobotLocomotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobotLocomotion/subscriptions","organizations_url":"https://api.github.com/users/RobotLocomotion/orgs","repos_url":"https://api.github.com/users/RobotLocomotion/repos","events_url":"https://api.github.com/users/RobotLocomotion/events{/privacy}","received_events_url":"https://api.github.com/users/RobotLocomotion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RobotLocomotion/drake","description":"A planning, control, and analysis toolbox for nonlinear dynamical systems.  Please see the WIKI for documentation.","fork":false,"url":"https://api.github.com/repos/RobotLocomotion/drake","forks_url":"https://api.github.com/repos/RobotLocomotion/drake/forks","keys_url":"https://api.github.com/repos/RobotLocomotion/drake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RobotLocomotion/drake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RobotLocomotion/drake/teams","hooks_url":"https://api.github.com/repos/RobotLocomotion/drake/hooks","issue_events_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/events{/number}","events_url":"https://api.github.com/repos/RobotLocomotion/drake/events","assignees_url":"https://api.github.com/repos/RobotLocomotion/drake/assignees{/user}","branches_url":"https://api.github.com/repos/RobotLocomotion/drake/branches{/branch}","tags_url":"https://api.github.com/repos/RobotLocomotion/drake/tags","blobs_url":"https://api.github.com/repos/RobotLocomotion/drake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RobotLocomotion/drake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RobotLocomotion/drake/git/refs{/sha}","trees_url":"https://api.github.com/repos/RobotLocomotion/drake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RobotLocomotion/drake/statuses/{sha}","languages_url":"https://api.github.com/repos/RobotLocomotion/drake/languages","stargazers_url":"https://api.github.com/repos/RobotLocomotion/drake/stargazers","contributors_url":"https://api.github.com/repos/RobotLocomotion/drake/contributors","subscribers_url":"https://api.github.com/repos/RobotLocomotion/drake/subscribers","subscription_url":"https://api.github.com/repos/RobotLocomotion/drake/subscription","commits_url":"https://api.github.com/repos/RobotLocomotion/drake/commits{/sha}","git_commits_url":"https://api.github.com/repos/RobotLocomotion/drake/git/commits{/sha}","comments_url":"https://api.github.com/repos/RobotLocomotion/drake/comments{/number}","issue_comment_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/comments{/number}","contents_url":"https://api.github.com/repos/RobotLocomotion/drake/contents/{+path}","compare_url":"https://api.github.com/repos/RobotLocomotion/drake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RobotLocomotion/drake/merges","archive_url":"https://api.github.com/repos/RobotLocomotion/drake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RobotLocomotion/drake/downloads","issues_url":"https://api.github.com/repos/RobotLocomotion/drake/issues{/number}","pulls_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls{/number}","milestones_url":"https://api.github.com/repos/RobotLocomotion/drake/milestones{/number}","notifications_url":"https://api.github.com/repos/RobotLocomotion/drake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RobotLocomotion/drake/labels{/name}","releases_url":"https://api.github.com/repos/RobotLocomotion/drake/releases{/id}","created_at":"2014-01-26T16:11:05Z","updated_at":"2015-03-09T12:41:39Z","pushed_at":"2015-03-09T12:41:38Z","git_url":"git://github.com/RobotLocomotion/drake.git","ssh_url":"git@github.com:RobotLocomotion/drake.git","clone_url":"https://github.com/RobotLocomotion/drake.git","svn_url":"https://github.com/RobotLocomotion/drake","homepage":"https://github.com/RobotLocomotion/drake/wiki","size":174323,"stargazers_count":92,"watchers_count":92,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":99,"forks":88,"open_issues":99,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829"},"html":{"href":"https://github.com/RobotLocomotion/drake/pull/829"},"issue":{"href":"https://api.github.com/repos/RobotLocomotion/drake/issues/829"},"comments":{"href":"https://api.github.com/repos/RobotLocomotion/drake/issues/829/comments"},"review_comments":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829/comments"},"review_comment":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/829/commits"},"statuses":{"href":"https://api.github.com/repos/RobotLocomotion/drake/statuses/11e2681622d25bc88be18915f0567e9b899ee1bc"}}}}