Adding CalcForcedDiscreteVariableUpdate to driven loop to better control discrete updates.
Calling simulator->AdvanceTo() has the potential to call PerStepDiscreteUpdates multiple times, which can be quite costly if there's significant computation. Can also cause issues if there's manual discrete filters. To minimize the chance of a mistake, I'm adding CalcForcedDiscreteVariableUpdate to the driven loop to ensure if we use DeclareForcedDiscreteUpdateEvent, it will only be called once per LcmDrivenLoop AdvanceTo
Adding CalcForcedDiscreteVariableUpdate to driven loop to better control discrete updates.
Calling
simulator->AdvanceTo()
has the potential to call PerStepDiscreteUpdates multiple times, which can be quite costly if there's significant computation. Can also cause issues if there's manual discrete filters. To minimize the chance of a mistake, I'm addingCalcForcedDiscreteVariableUpdate
to the driven loop to ensure if we useDeclareForcedDiscreteUpdateEvent
, it will only be called once per LcmDrivenLoop AdvanceToThis change is