Remove unnecessary physics tick delay after the initial reset issued from Python server - #66
Open
stefanfausser wants to merge 1 commit into
Open
Remove unnecessary physics tick delay after the initial reset issued from Python server#66stefanfausser wants to merge 1 commit into
stefanfausser wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue - affects the first steps in the training mode:
After the reset is initiated from the Python server by a
resetmessage, all agents are correctly resetted. However, after doing the actual reset in the env(s), it is waited another physics tick before the action (for the resetted-state(s)) is retrieved from the Python server via anactionmessage and then applied to the env(s). This is unnecessary because the Python server sends anactionmessage immediately after receiving theresetmessage with the observations so there is no need to wait another physics tick before receiving theactionmessage and applying it to the env(s).(I checked this behaviour with the SB3 example by some debug messages that are removed in this final submission).
Edit: In addition to waiting one physics tick too much, without this PR, the first action is unlikely to be the correct action for the resetted states (in the best case the player is not moving). In contrast, ONNX inference has no such delay. Overall, it is a minor issue as this only happens once after the initial reset via
resetmessage. However, I would like to fix this to eventually get the exact same sequence of obs + actions during Python model inference and ONNX inference. I know how to get there and this is the first out of two required PRs. This does not touch resets triggered from the Godot side, e.g. after a game over or time out / truncation.How this is fixed:
After having resetted the environments and sending back the
resetmessage with the currentobs, theactionmessage is now immediately received and applied from the Python server (with debug messages I could confirm that theactionmessage was indeed received immediately after sending theresetmessage on the Godot side).