GitHub PullRequestReviewCommentEvent at 2014-08-24 22:28:11
Repository: drake
Actor: RussTedrake
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/16638393","id":16638393,"diff_hunk":"@@ -0,0 +1,179 @@\n+classdef DrakeFunction\n+  % drakeFunction.DrakeFunction   Abstract parent class for all DrakeFunction classes\n+  % A DrakeFunction represents a vector-valued function that maps a\n+  % point in one CoordinateFrame to a point in another CoordinateFrame\n+  \n+  properties (SetAccess = immutable)\n+    input_frame   % CoordinateFrame representing the domain\n+    output_frame  % CoordinateFrame representing the range\n+  end\n+\n+  methods (Abstract)\n+    % All child classes must implement an 'eval' method that evaluates\n+    % the function and its derivative\n+    [f,df] = eval(obj,x);\n+  end\n+\n+  methods\n+    function obj = DrakeFunction(input_frame,output_frame)\n+      % obj = drakeFunction.DrakeFunction(input_frame,output_frame)\n+      %   returns a DrakeFunction object representing a map from\n+      %   input_frame to output_frame\n+      %\n+      % @param input_frame    -- CoordinateFrame representing the domain\n+      % @param output_frame   -- CoordinateFrame representing the range\n+      %\n+      % @retval obj           -- drakeFunction.DrakeFunction object\n+\n+      typecheck(input_frame,'CoordinateFrame');\n+      typecheck(output_frame,'CoordinateFrame');\n+      obj.input_frame = input_frame;\n+      obj.output_frame = output_frame;\n+    end\n+\n+    function [iCfun, jCvar] = getSparsityPattern(obj)\n+      n_input = obj.getInputFrame().dim;\n+      n_output = obj.getOutputFrame().dim;\n+      iCfun = reshape(bsxfun(@times,(1:n_output)',ones(1,n_input)),[],1);\n+      jCvar = reshape(bsxfun(@times,1:n_input,ones(n_output,1)),[],1);\n+    end\n+\n+    function fcn = plus(obj,other,same_input)\n+      import drakeFunction.*\n+      if nargin < 3, same_input = false; end\n+      if isa(other,'drakeFunction.DrakeFunction')\n+        fcn = compose(Sum(obj.output_frame,2),Concatenated({obj,other},same_input));\n+      else\n+        error('Drake:drakeFunction:NotSupported', ...\n+          'Addition of DrakeFunctions with other classes is not supported');\n+      end\n+    end\n+\n+    function fcn = minus(obj,other,varargin)\n+      fcn = plus(obj,-other,varargin{:});\n+    end\n+\n+    function fcn = uminus(obj)\n+      import drakeFunction.*\n+      fcn = compose(ConstantMultiple(obj.getOutputFrame, ...\n+                                      obj.getOutputFrame,-1),obj);\n+    end\n+\n+    function fcn = mtimes(obj,other)\n+      if isnumeric(obj) && isscalar(obj)\n+        fcn = obj.*other;\n+      elseif isnumeric(other) && isscalar(other)\n+        fcn = obj.*other;\n+      else\n+        error('Drake:drakeFunction:DrakeFunction:NoMatrixProducts', ...\n+          'Matrix products of expressions are not yet imiplemented');\n+      end\n+    end\n+\n+    function fcn = times(obj,other)\n+      import drakeFunction.ConstantMultiple\n+      if isnumeric(obj)\n+        fcn_orig = other;\n+        value = obj;\n+      elseif isnumeric(other)\n+        fcn_orig = obj;\n+        value = other;\n+      else\n+        error('Drake:drakeFunction:DrakeFunction:NoDrakeFunctionProducts', ...\n+          'Elementwise products of two DrakeFunctions are not yet imiplemented');\n+      end\n+      frame = fcn_orig.getOutputFrame();\n+      fcn = compose(ConstantMultiple(frame,value),fcn_orig);\n+    end\n+\n+    function fcn = vertcat(obj,varargin)\n+      fcn = concatenate(obj,varargin{:});\n+    end\n+\n+    function fcn = concatenate(obj,varargin)\n+      if islogical(varargin{end})\n+        same_input = varargin{end};\n+        fcns = [{obj}, varargin(1:end-1)];\n+      else\n+        same_input = false;\n+        fcns = [{obj}, varargin];\n+      end\n+      fcn = drakeFunction.Concatenated(fcns,same_input);\n+    end\n+\n+    function fcn3 = compose(fcn1, fcn2)\n+      fcn3 = drakeFunction.Composed(fcn1,fcn2);\n+    end\n+\n+    function fcn = duplicate(obj,n)\n+      % fcn = duplicate(obj,n) returns a concatenated DrakeFunction containing\n+      % n duplicates of obj\n+      more_obj = repmat({obj},1,n-1);\n+      fcn = concatenate(obj,more_obj{:});\n+    end\n+\n+    function fcn = addInputFrame(obj,frame,append)","path":"solvers/+drakeFunction/DrakeFunction.m","position":115,"original_position":115,"commit_id":"30bbdc2bf2ac4b6259757cef55810b1c9a0ad974","original_commit_id":"30bbdc2bf2ac4b6259757cef55810b1c9a0ad974","user":{"login":"RussTedrake","id":6442292,"avatar_url":"https://avatars.githubusercontent.com/u/6442292?v=2","gravatar_id":"97e60f1ecb0b7d8f7238a4e92944e370","url":"https://api.github.com/users/RussTedrake","html_url":"https://github.com/RussTedrake","followers_url":"https://api.github.com/users/RussTedrake/followers","following_url":"https://api.github.com/users/RussTedrake/following{/other_user}","gists_url":"https://api.github.com/users/RussTedrake/gists{/gist_id}","starred_url":"https://api.github.com/users/RussTedrake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RussTedrake/subscriptions","organizations_url":"https://api.github.com/users/RussTedrake/orgs","repos_url":"https://api.github.com/users/RussTedrake/repos","events_url":"https://api.github.com/users/RussTedrake/events{/privacy}","received_events_url":"https://api.github.com/users/RussTedrake/received_events","type":"User","site_admin":false},"body":"i see this now, and it looks like what I wanted from our email exchange.  (i assume that using the drakeFunction.Zeros set the sparsity pattern correctly?)\r\n\r\nbut I do think that, more generally, we should support an inFrame method which searches for a transform and applies it (if that transform is stateless).  ","created_at":"2014-08-24T22:28:11Z","updated_at":"2014-08-24T22:28:11Z","html_url":"https://github.com/RobotLocomotion/drake/pull/341#discussion_r16638393","pull_request_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341","_links":{"self":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/16638393"},"html":{"href":"https://github.com/RobotLocomotion/drake/pull/341#discussion_r16638393"},"pull_request":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341"}}},"pull_request":{"url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341","id":20209391,"html_url":"https://github.com/RobotLocomotion/drake/pull/341","diff_url":"https://github.com/RobotLocomotion/drake/pull/341.diff","patch_url":"https://github.com/RobotLocomotion/drake/pull/341.patch","issue_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/341","number":341,"state":"open","locked":false,"title":"Drake function","user":{"login":"avalenzu","id":2574034,"avatar_url":"https://avatars.githubusercontent.com/u/2574034?v=2","gravatar_id":"672e932a9ab4517fa661cd62a050d13c","url":"https://api.github.com/users/avalenzu","html_url":"https://github.com/avalenzu","followers_url":"https://api.github.com/users/avalenzu/followers","following_url":"https://api.github.com/users/avalenzu/following{/other_user}","gists_url":"https://api.github.com/users/avalenzu/gists{/gist_id}","starred_url":"https://api.github.com/users/avalenzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avalenzu/subscriptions","organizations_url":"https://api.github.com/users/avalenzu/orgs","repos_url":"https://api.github.com/users/avalenzu/repos","events_url":"https://api.github.com/users/avalenzu/events{/privacy}","received_events_url":"https://api.github.com/users/avalenzu/received_events","type":"User","site_admin":false},"body":"This implements the \"DrakeFunction\" idea we'd discussed in #269. I'd like to get feedback about any and all aspects of it, so please, let me know what you think!\r\n\r\nThis could (probably) be merged in as is without breaking things - everything is contained in the `drakeFunction` package. ~~The only exception is that I had to add the drake root folder to the path in `addpath_drake` in order to get `drakeFunction` on the path.~~\r\n","created_at":"2014-08-23T12:28:22Z","updated_at":"2014-08-24T22:28:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2640e2b59267e5ccb3cd56f7eea94021720a4ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341/commits","review_comments_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341/comments","review_comment_url":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/{number}","comments_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/341/comments","statuses_url":"https://api.github.com/repos/RobotLocomotion/drake/statuses/30bbdc2bf2ac4b6259757cef55810b1c9a0ad974","head":{"label":"avalenzu:drake-function","ref":"drake-function","sha":"30bbdc2bf2ac4b6259757cef55810b1c9a0ad974","user":{"login":"avalenzu","id":2574034,"avatar_url":"https://avatars.githubusercontent.com/u/2574034?v=2","gravatar_id":"672e932a9ab4517fa661cd62a050d13c","url":"https://api.github.com/users/avalenzu","html_url":"https://github.com/avalenzu","followers_url":"https://api.github.com/users/avalenzu/followers","following_url":"https://api.github.com/users/avalenzu/following{/other_user}","gists_url":"https://api.github.com/users/avalenzu/gists{/gist_id}","starred_url":"https://api.github.com/users/avalenzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avalenzu/subscriptions","organizations_url":"https://api.github.com/users/avalenzu/orgs","repos_url":"https://api.github.com/users/avalenzu/repos","events_url":"https://api.github.com/users/avalenzu/events{/privacy}","received_events_url":"https://api.github.com/users/avalenzu/received_events","type":"User","site_admin":false},"repo":{"id":16259647,"name":"drake","full_name":"avalenzu/drake","owner":{"login":"avalenzu","id":2574034,"avatar_url":"https://avatars.githubusercontent.com/u/2574034?v=2","gravatar_id":"672e932a9ab4517fa661cd62a050d13c","url":"https://api.github.com/users/avalenzu","html_url":"https://github.com/avalenzu","followers_url":"https://api.github.com/users/avalenzu/followers","following_url":"https://api.github.com/users/avalenzu/following{/other_user}","gists_url":"https://api.github.com/users/avalenzu/gists{/gist_id}","starred_url":"https://api.github.com/users/avalenzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avalenzu/subscriptions","organizations_url":"https://api.github.com/users/avalenzu/orgs","repos_url":"https://api.github.com/users/avalenzu/repos","events_url":"https://api.github.com/users/avalenzu/events{/privacy}","received_events_url":"https://api.github.com/users/avalenzu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/avalenzu/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/avalenzu/drake","forks_url":"https://api.github.com/repos/avalenzu/drake/forks","keys_url":"https://api.github.com/repos/avalenzu/drake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avalenzu/drake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avalenzu/drake/teams","hooks_url":"https://api.github.com/repos/avalenzu/drake/hooks","issue_events_url":"https://api.github.com/repos/avalenzu/drake/issues/events{/number}","events_url":"https://api.github.com/repos/avalenzu/drake/events","assignees_url":"https://api.github.com/repos/avalenzu/drake/assignees{/user}","branches_url":"https://api.github.com/repos/avalenzu/drake/branches{/branch}","tags_url":"https://api.github.com/repos/avalenzu/drake/tags","blobs_url":"https://api.github.com/repos/avalenzu/drake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avalenzu/drake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avalenzu/drake/git/refs{/sha}","trees_url":"https://api.github.com/repos/avalenzu/drake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avalenzu/drake/statuses/{sha}","languages_url":"https://api.github.com/repos/avalenzu/drake/languages","stargazers_url":"https://api.github.com/repos/avalenzu/drake/stargazers","contributors_url":"https://api.github.com/repos/avalenzu/drake/contributors","subscribers_url":"https://api.github.com/repos/avalenzu/drake/subscribers","subscription_url":"https://api.github.com/repos/avalenzu/drake/subscription","commits_url":"https://api.github.com/repos/avalenzu/drake/commits{/sha}","git_commits_url":"https://api.github.com/repos/avalenzu/drake/git/commits{/sha}","comments_url":"https://api.github.com/repos/avalenzu/drake/comments{/number}","issue_comment_url":"https://api.github.com/repos/avalenzu/drake/issues/comments/{number}","contents_url":"https://api.github.com/repos/avalenzu/drake/contents/{+path}","compare_url":"https://api.github.com/repos/avalenzu/drake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avalenzu/drake/merges","archive_url":"https://api.github.com/repos/avalenzu/drake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avalenzu/drake/downloads","issues_url":"https://api.github.com/repos/avalenzu/drake/issues{/number}","pulls_url":"https://api.github.com/repos/avalenzu/drake/pulls{/number}","milestones_url":"https://api.github.com/repos/avalenzu/drake/milestones{/number}","notifications_url":"https://api.github.com/repos/avalenzu/drake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avalenzu/drake/labels{/name}","releases_url":"https://api.github.com/repos/avalenzu/drake/releases{/id}","created_at":"2014-01-26T19:16:04Z","updated_at":"2014-07-30T13:11:38Z","pushed_at":"2014-08-23T13:41:27Z","git_url":"git://github.com/avalenzu/drake.git","ssh_url":"git@github.com:avalenzu/drake.git","clone_url":"https://github.com/avalenzu/drake.git","svn_url":"https://github.com/avalenzu/drake","homepage":"https://github.com/RobotLocomotion/drake/wiki","size":56523,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"RobotLocomotion:master","ref":"master","sha":"5ad47873e04dc2f3ef8bd93de7f6160b1c328cdf","user":{"login":"RobotLocomotion","id":6496345,"avatar_url":"https://avatars.githubusercontent.com/u/6496345?v=2","gravatar_id":"7ced8e1c168977e98e880a286ab2d7e6","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=2","gravatar_id":"7ced8e1c168977e98e880a286ab2d7e6","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":"2014-08-14T17:57:06Z","pushed_at":"2014-08-23T15:06:40Z","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":74539,"stargazers_count":19,"watchers_count":19,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":23,"mirror_url":null,"open_issues_count":56,"forks":23,"open_issues":56,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341"},"html":{"href":"https://github.com/RobotLocomotion/drake/pull/341"},"issue":{"href":"https://api.github.com/repos/RobotLocomotion/drake/issues/341"},"comments":{"href":"https://api.github.com/repos/RobotLocomotion/drake/issues/341/comments"},"review_comments":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341/comments"},"review_comment":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/RobotLocomotion/drake/pulls/341/commits"},"statuses":{"href":"https://api.github.com/repos/RobotLocomotion/drake/statuses/30bbdc2bf2ac4b6259757cef55810b1c9a0ad974"}}}}