{"action":"created","issue":{"url":"https://api.github.com/repos/RobotLocomotion/drake/issues/9929","repository_url":"https://api.github.com/repos/RobotLocomotion/drake","labels_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/9929/labels{/name}","comments_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/9929/comments","events_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/9929/events","html_url":"https://github.com/RobotLocomotion/drake/issues/9929","id":377225287,"node_id":"MDU6SXNzdWUzNzcyMjUyODc=","number":9929,"title":"Simulator's event collections carry hidden state","user":{"login":"RussTedrake","id":6442292,"node_id":"MDQ6VXNlcjY0NDIyOTI=","avatar_url":"https://avatars2.githubusercontent.com/u/6442292?v=4","gravatar_id":"","url":"https://api.github.com/users/RussTedrake","html_url":"https://github.com/RussTedrake","followers_url":"https://api.github.com/users/RussTedrake/followers","following_url":"https://api.github.com/users/RussTedrake/following{/other_user}","gists_url":"https://api.github.com/users/RussTedrake/gists{/gist_id}","starred_url":"https://api.github.com/users/RussTedrake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RussTedrake/subscriptions","organizations_url":"https://api.github.com/users/RussTedrake/orgs","repos_url":"https://api.github.com/users/RussTedrake/repos","events_url":"https://api.github.com/users/RussTedrake/events{/privacy}","received_events_url":"https://api.github.com/users/RussTedrake/received_events","type":"User","site_admin":false},"labels":[{"id":366762542,"node_id":"MDU6TGFiZWwzNjY3NjI1NDI=","url":"https://api.github.com/repos/RobotLocomotion/drake/labels/priority:%20medium","name":"priority: medium","color":"e99695","default":false},{"id":351649295,"node_id":"MDU6TGFiZWwzNTE2NDkyOTU=","url":"https://api.github.com/repos/RobotLocomotion/drake/labels/team:%20dynamics","name":"team: dynamics","color":"0052cc","default":false},{"id":77074782,"node_id":"MDU6TGFiZWw3NzA3NDc4Mg==","url":"https://api.github.com/repos/RobotLocomotion/drake/labels/type:%20bug","name":"type: bug","color":"0e8a16","default":false},{"id":77074786,"node_id":"MDU6TGFiZWw3NzA3NDc4Ng==","url":"https://api.github.com/repos/RobotLocomotion/drake/labels/type:%20question","name":"type: question","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":{"login":"edrumwri","id":2224335,"node_id":"MDQ6VXNlcjIyMjQzMzU=","avatar_url":"https://avatars0.githubusercontent.com/u/2224335?v=4","gravatar_id":"","url":"https://api.github.com/users/edrumwri","html_url":"https://github.com/edrumwri","followers_url":"https://api.github.com/users/edrumwri/followers","following_url":"https://api.github.com/users/edrumwri/following{/other_user}","gists_url":"https://api.github.com/users/edrumwri/gists{/gist_id}","starred_url":"https://api.github.com/users/edrumwri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edrumwri/subscriptions","organizations_url":"https://api.github.com/users/edrumwri/orgs","repos_url":"https://api.github.com/users/edrumwri/repos","events_url":"https://api.github.com/users/edrumwri/events{/privacy}","received_events_url":"https://api.github.com/users/edrumwri/received_events","type":"User","site_admin":false},"assignees":[{"login":"edrumwri","id":2224335,"node_id":"MDQ6VXNlcjIyMjQzMzU=","avatar_url":"https://avatars0.githubusercontent.com/u/2224335?v=4","gravatar_id":"","url":"https://api.github.com/users/edrumwri","html_url":"https://github.com/edrumwri","followers_url":"https://api.github.com/users/edrumwri/followers","following_url":"https://api.github.com/users/edrumwri/following{/other_user}","gists_url":"https://api.github.com/users/edrumwri/gists{/gist_id}","starred_url":"https://api.github.com/users/edrumwri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edrumwri/subscriptions","organizations_url":"https://api.github.com/users/edrumwri/orgs","repos_url":"https://api.github.com/users/edrumwri/repos","events_url":"https://api.github.com/users/edrumwri/events{/privacy}","received_events_url":"https://api.github.com/users/edrumwri/received_events","type":"User","site_admin":false},{"login":"sherm1","id":4088016,"node_id":"MDQ6VXNlcjQwODgwMTY=","avatar_url":"https://avatars1.githubusercontent.com/u/4088016?v=4","gravatar_id":"","url":"https://api.github.com/users/sherm1","html_url":"https://github.com/sherm1","followers_url":"https://api.github.com/users/sherm1/followers","following_url":"https://api.github.com/users/sherm1/following{/other_user}","gists_url":"https://api.github.com/users/sherm1/gists{/gist_id}","starred_url":"https://api.github.com/users/sherm1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sherm1/subscriptions","organizations_url":"https://api.github.com/users/sherm1/orgs","repos_url":"https://api.github.com/users/sherm1/repos","events_url":"https://api.github.com/users/sherm1/events{/privacy}","received_events_url":"https://api.github.com/users/sherm1/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-11-05T02:09:22Z","updated_at":"2018-11-05T12:06:31Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The `Context` is supposed to contain everything required to deterministically reproduce a simulation.  I believe that the current implementation of the event handling violates that contract.\r\n\r\nEffectively, the variables declared here: https://github.com/RobotLocomotion/drake/blob/master/systems/analysis/simulator.h#L574\r\nact like hidden state.  Shouldn't the event collections be stored in the Context?\r\n\r\nAs just one example of this pitfall, it looks like if I had a `LeafSystem` that implemented `DoCalcNextUpdate` (which takes a mutable event collection), with something like \"if (t=0.5) then declare a timed event at t=2\".  I believe that if I started the simulator at t=0, and called\r\n``` \r\nsimulator.StepTo(5.0);\r\n```\r\nI would see that event (assuming I got a step at 0.5), but if I instead called\r\n```\r\nsimulator.StepTo(1.0);\r\nsimulator.StepTo(5.0);\r\n```\r\nthen I would drop the event at the end of the first `StepTo` and not handle it in the second call to `StepTo`?\r\n\r\nN.B. -- I was also surprised to see code like this: https://github.com/RobotLocomotion/drake/blob/master/systems/lcm/lcm_log_playback_system.cc#L44 ,\r\nwhere the time of an `Event` with `TriggerType == kTimed` is passed back as a return value of this method instead of staying associated with the event as `EventData`?   What would you do if a `LeafSystem` added multiple events to the collection during that call?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RobotLocomotion/drake/issues/comments/435851828","html_url":"https://github.com/RobotLocomotion/drake/issues/9929#issuecomment-435851828","issue_url":"https://api.github.com/repos/RobotLocomotion/drake/issues/9929","id":435851828,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTg1MTgyOA==","user":{"login":"RussTedrake","id":6442292,"node_id":"MDQ6VXNlcjY0NDIyOTI=","avatar_url":"https://avatars2.githubusercontent.com/u/6442292?v=4","gravatar_id":"","url":"https://api.github.com/users/RussTedrake","html_url":"https://github.com/RussTedrake","followers_url":"https://api.github.com/users/RussTedrake/followers","following_url":"https://api.github.com/users/RussTedrake/following{/other_user}","gists_url":"https://api.github.com/users/RussTedrake/gists{/gist_id}","starred_url":"https://api.github.com/users/RussTedrake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RussTedrake/subscriptions","organizations_url":"https://api.github.com/users/RussTedrake/orgs","repos_url":"https://api.github.com/users/RussTedrake/repos","events_url":"https://api.github.com/users/RussTedrake/events{/privacy}","received_events_url":"https://api.github.com/users/RussTedrake/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T12:06:31Z","updated_at":"2018-11-05T12:06:31Z","author_association":"CONTRIBUTOR","body":"> It is OK for the Simulator to have its own \"state\" (it is not part of the System), but that should just represent its own internal progress, not that of the System. \r\n\r\nI also think that this needs to be spelled out more carefully (at least for me).  Presumably, we would expect that the result of `StepTo(5.0)` should not change if I called `StepTo(1.0)` first, correct?\r\n\r\nWe also had the idea of serializing the `Context` (e.g. to disk), and then restoring it for a future playback.  Simulator \"state\" complicates that thinking, too.  Even the simulator parameters (e.g. `publish_every_time_step`) would need to be restored to have an exact match.  "}}
{"actor":{"display_login":"RussTedrake"}}