mujoco_mpc icon indicating copy to clipboard operation
mujoco_mpc copied to clipboard

Humanoid-Walk task bug report

Open ppap36 opened this issue 1 year ago • 1 comments

Thank you for your contribution. I found a little bug in mjpc/tasks/humanoid/walk/task.xml and walk.cc In line 33 and 34 of task.xml

    <user name="Velocity" dim="2" user="7 0.625 0 25.0 0.2 4.0" />
    <user name="Walk" dim="1" user="7 1.0 0.0 25.0 0.5 3.0" />

The definition of "velocity" is before the definition of "walk" However in "walk.cc".

  // com vel
  double* waist_lower_subcomvel =
      SensorByName(model, data, "waist_lower_subcomvel");
  double* torso_velocity = SensorByName(model, data, "torso_velocity");
  double com_vel[2];
  mju_add(com_vel, waist_lower_subcomvel, torso_velocity, 2);
  mju_scl(com_vel, com_vel, 0.5, 2);

  // walk forward
  residual[counter++] =
      standing * (mju_dot(com_vel, forward, 2) - parameters_[1]);

  // ----- move feet ----- //
  double* foot_right_vel = SensorByName(model, data, "foot_right_velocity");
  double* foot_left_vel = SensorByName(model, data, "foot_left_velocity");
  double move_feet[2];
  mju_copy(move_feet, com_vel, 2);
  mju_addToScl(move_feet, foot_right_vel, -0.5, 2);
  mju_addToScl(move_feet, foot_left_vel, -0.5, 2);

  mju_copy(&residual[counter], move_feet, 2);
  mju_scl(&residual[counter], &residual[counter], standing, 2);
  counter += 2;

It is reversed.

ppap36 avatar Nov 21 '24 07:11 ppap36

Thanks for this!

yuvaltassa avatar Nov 23 '24 11:11 yuvaltassa