Skip to content

Commit aff408d

Browse files
erez-tomcopybara-github
authored andcommitted
Fix bug in cube residual, improve formatting.
PiperOrigin-RevId: 603333266 Change-Id: I8eeae82bc46fd3ddd4311f9da38a28b12cd848ca
1 parent 6f0b99f commit aff408d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

mjpc/planners/sampling/planner.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,10 @@ void SamplingPlanner::Plots(mjvFigure* fig_planner, mjvFigure* fig_timer,
433433

434434
// ----- timer ----- //
435435

436-
PlotUpdateData(
437-
fig_timer, timer_bounds, fig_timer->linedata[0 + timer_shift][0] + 1,
438-
1.0e-3 * noise_compute_time * planning, 100, 0 + timer_shift, 0, 1, -100);
436+
PlotUpdateData(fig_timer, timer_bounds,
437+
fig_timer->linedata[0 + timer_shift][0] + 1,
438+
1.0e-3 * noise_compute_time * planning, 100,
439+
0 + timer_shift, 0, 1, -100);
439440

440441
PlotUpdateData(fig_timer, timer_bounds,
441442
fig_timer->linedata[1 + timer_shift][0] + 1,

mjpc/tasks/cube/solve.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,17 @@ void CubeSolve::ResidualFn::Residual(const mjModel* model, const mjData* data,
109109
counter += 6;
110110

111111
// ---------- Residual (4) ----------
112+
113+
// The unmodified cube model has 20 ball joints: nq=86, nv=66.
114+
// The patch adds a free joint: nq=93, nv=72.
115+
// The task adds a ball joint: nq=97, nv=75.
116+
// The shadow hand has 24 DoFs: nq=121, nv=99.
117+
// The following two residuals apply for the last 24 entries of qpos and qvel:
112118
mju_sub(residual + counter, data->qpos + 97, model->key_qpos + 97, 24);
113119
counter += 24;
114120

115121
// ---------- Residual (5) ----------
116-
mju_copy(residual + counter, data->qvel + 97, 24);
122+
mju_copy(residual + counter, data->qvel + 75, 24);
117123
counter += 24;
118124

119125
// ---------- Residual (6) ----------

0 commit comments

Comments
 (0)