openhumanoids / oh-distro

An integrated humanoid control, planning and perception system. Developed by MIT and the University of Edinburgh for the Boston Dynamics Atlas and the NASA Valkyrie humanoid robots
http://drc.mit.edu/
Other
118 stars 45 forks source link

DRCPlanner with Valkyrie not working #21

Closed patmarion closed 8 years ago

patmarion commented 8 years ago

After updating to drake master:


>> addpath_control;
>> BasePlanner.withValkyrie(2);
Error using Valkyrie
Abstract classes cannot be instantiated.  Class 'Valkyrie' inherits abstract methods or properties but does not implement them.  See the list of methods and properties that 'Valkyrie' must implement if you do not intend the class to be
abstract.

Error in DRCPlanner.constructValkyrie (line 38)
      r = Valkyrie([], options);

Error in BasePlanner.withValkyrie (line 8)
      obj = BasePlanner(BasePlanner.constructValkyrie(varargin{:}));

patmarion commented 8 years ago

Hi @rdeits maybe you know what to do to fix this one? Reported to me by @MarcoCar

patmarion commented 8 years ago

I guess there are two files, should we only be using the drake file?

$ find . -name Valkyrie.m
./software/control/matlab/systems/Valkyrie.m
./software/drake/drake/examples/Valkyrie/@Valkyrie/Valkyrie.m
rdeits commented 8 years ago

I don't know why this hasn't failed before, but yes, you want the Drake one. I don't have a working DRC build on this machine, so it's hard for me to test, but I believe the right thing to do is to port the following code from software/control/.../Valkyrie into the constructor of Drake's @Valkyrie/Valkyrie.m:

      options = applyDefaults(options,...
                              struct('valkyrie_version', 1,...
                                     'use_new_kinsol', true));

      if ~any(options.valkyrie_version == [1,2])
        error('Valkyrie:badVersion','Invalid Valkyrie version. Valid values are 1 and 2')
      end

      if nargin < 1 || isempty(urdf)
        switch options.valkyrie_version
          case 1
            %urdf = strcat(getenv('DRC_PATH'),'/models/valkyrie/V1_sim_mit_drake.urdf');
            urdf = strcat(getenv('DRC_PATH'),'/models/valkyrie/V1_sim_shells_reduced_polygon_count_mit.urdf');
          case 2
            urdf = strcat(getenv('DRC_PATH'),'/models/val_description/urdf/valkyrie_sim_drake.urdf');
        end
      else
        typecheck(urdf,'char');
      end

and then just delete software/control/.../Valkyrie.m entirely.

MarcoCar commented 8 years ago

@rdeits what you suggested solves the issue above but there's still something not working properly in @Valkyrie/Valkyrie.m. This is the output I got

BasePlanner.withValkyrie(2)
Started lcm handle loop
Error using MultiCoordinateFrame/replaceFrameNum (line 353)
new subframe does not match the dimensions of the frame you are trying to replace

Error in Valkyrie/compile (line 90)
        valkyrie_state_frame = replaceFrameNum(valkyrie_state_frame,1,valkyrieFrames.ValkyrieState(obj));

Error in TimeSteppingRigidBodyManipulator (line 88)
      obj = compile(obj);

Error in Valkyrie (line 45)
      obj = obj@TimeSteppingRigidBodyManipulator(urdf,options.dt,options);

Error in DRCPlanner (line 100)
        obj.iris_planner = IRISPlanner(Valkyrie([], struct('floating', true)));

Error in BasePlanner (line 14)
      obj = obj@DRCPlanner(varargin{:});

Error in BasePlanner.withValkyrie (line 8)
      obj = BasePlanner(BasePlanner.constructValkyrie(varargin{:}));

Any idea?

rdeits commented 8 years ago

Ah, I see. That's unfortunate. We have different coordinate frames for the OH and Drake versions of Valkyrie, and it looks like they're not compatible. We'll have to keep the OH version around, then. I'm opening a pull request to resolve the name ambiguity.