Skip to content

Commit

Permalink
publish state manually to keep up with qp_input
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeits committed Mar 13, 2015
1 parent 6ea6ef9 commit ee45bff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
properties(SetAccess=protected)
control
plan_eval;
robot;
options;
lc
monitor
Expand Down Expand Up @@ -52,6 +53,7 @@
obj.control = control;
obj.plan_eval = plan_eval;
obj.options = options;
obj.robot = r;

if isempty(obj.plan_eval) || isempty(obj.control)
obj.lc = lcm.lcm.LCM.getSingleton();
Expand Down Expand Up @@ -104,6 +106,10 @@
t0 = tic();
end
encodeQPInputLCMMex(qp_input);
out_frame = obj.robot.getOutputFrame();
if isprop(out_frame, 'lcmcoder')
obj.lc.publish('EST_ROBOT_STATE', out_frame.lcmcoder.encode(t, x));
end
if ~obj.quiet
lcm_time = toc(t0);
fprintf(1, 'lcm_serialize: %f, ', lcm_time);
Expand Down
10 changes: 5 additions & 5 deletions examples/Atlas/runAtlasWalkingAsync.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ function runAtlasWalkingAsync(example_options)
% walking_plan_data = StandingPlan.from_standing_state(x0, r);
planeval = atlasControllers.AtlasPlanEval(r, walking_plan_data);

% Make our Atlas listen for ATLAS_COMMAND over LCM and publish EST_ROBOT_STATE
r = r.setInputFrame(drcFrames.AtlasInput(r));
r = r.setOutputFrame(drcFrames.AtlasState(r));

% Wrap the planeval in a Drake system
planeval_sys = atlasControllers.AtlasPlanEvalAndControlSystem(r, [], planeval);
% Make sure planeval_sys can publish EST_ROBOT_STATE over LCM
planeval_sys = planeval_sys.setOutputFrame(drcFrames.AtlasState(r));

% Make our Atlas listen for ATLAS_COMMAND over LCM
r = r.setInputFrame(drcFrames.AtlasInput(r));
planeval_sys = planeval_sys.setInputFrame(r.getOutputFrame);

sys = cascade(r, planeval_sys);

Expand Down

0 comments on commit ee45bff

Please sign in to comment.