mujoco_mpc icon indicating copy to clipboard operation
mujoco_mpc copied to clipboard

Bug in robust planner: not updating nominal policy before optimizing

Open MiaoDragon opened this issue 1 year ago • 3 comments

Hi,

I'm a PhD student and uses mujoco_mpc for my research. When experimenting with the project, I found that there is a potential bug in the robust planner implementation. I found this out by printing the times parameter for the sampling planner, and found that they stay all 0 all the time. I traced out the bug to be in robust_planner.cc,

void RobustPlanner::OptimizePolicy(int horizon, ThreadPool& pool)

The problem is that in sampling planner, we call UpdateNominalPolicy(horizon) before optimizing the policy, but this is not done in the robust planner. One solution to this is to add the function UpdateNominalPolicy(horizon) in the RankedPlanner, and call

delegate_->UpdateNominalPolicy(horizon);

before optimizing the policy candidates.

Thanks and please let me know what you think.

MiaoDragon avatar Apr 05 '24 16:04 MiaoDragon

I think this is @nimrod-gileadi 's code?

yuvaltassa avatar Apr 05 '24 20:04 yuvaltassa

Thanks for diagnosing this issue. I think you are right!

RobustPlanner is meant to be agnostic to which delegate it's using, though, and UpdateNominalPolicy is not part of the RankedPlanner interface. So I think that the fix would be to move this call:

this->UpdateNominalPolicy(horizon);

from SamplingPlanner::OptimizePolicy to SamplingPlanner::OptimizePolicyCandidates.

Do you want to send us a pull request, or would you rather we fixed it?

nimrod-gileadi avatar Apr 08 '24 10:04 nimrod-gileadi

Hi,

Sorry for the late reply. Due to my schedule I might not be able to fix it and debug. Could you fix it instead, since you might be more familiar with the project code? Thanks!

MiaoDragon avatar Jul 18 '24 17:07 MiaoDragon