DAIRLab / dairlib

MIT License
76 stars 27 forks source link

Blend efforts after switch #199

Closed yangwill closed 3 years ago

yangwill commented 3 years ago

Blends efforts after a controller switch message. This is to smoothly transition between controllers.

One issue that still needs to be fixed:

Open to any suggestions about a fix for this. It looks like there's a race condition, but I don't see a clear way to avoid it.


This change is Reviewable

mposa commented 3 years ago

Does the race condition boil down to wanting to control the sequence between the output and update function calls? I think we could force output to be called after update by

  1. Re-writing the LCM-driven loop in the more manual format that's now used elsewhere in our code (e.g. https://github.com/DAIRLab/dairlib/blob/master/examples/Cassie/dispatcher_robot_out.cc#L301-L328)
  2. Declaring the output function to be "forced"
  3. Manually triggering the output.

I'm not sure, however, if this would address your race condition.

yangwill commented 3 years ago

I fixed the race condition by using the same LcmSubscriberSystem in both the driven loop and the other leaf systems. This is done without having to change the API for LcmDrivenLoop.