RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.17k stars 1.24k forks source link

[framework] Add ExecuteForcedEvents() to System API #21664

Closed sherm1 closed 1 day ago

sherm1 commented 2 days ago

Adds ExecuteForcedEvents() to trigger all the forced events in a System (or Diagram) and write any modified variables back to a Context.

This is like the existing System::ExecuteInitializationEvents(), but for Forced triggers rather than Initialization triggers. ExecuteForcedEvents() sequences the events in the same way as the Simulator does: unrestricted events, then discrete events, then publish events. There is an option to suppress publish events.

Unit tests and python bindings are included.

Resolves #21659


This change is Reviewable