Skip to content

Always reset when agent is done #3222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jan 16, 2020
Merged

Always reset when agent is done #3222

merged 14 commits into from
Jan 16, 2020

Conversation

vincentpierre
Copy link
Contributor

In this PR:

  • Remove the AgentOnDone virtual method on the Agent class
  • Remove the Reset On Done checkbox from the Agent inspector
  • Create a new FixedSensor that takes as input an Observation and will always return that observation when called
  • Agents that are destroyed will request a final decision to their IPolicy with a true done flag, a list of FixedSensor and an empty callback.
  • Removed tests for AgentOnDone
  • Modified documentation

@vincentpierre vincentpierre self-assigned this Jan 15, 2020
m_VectorSensorBuffer = new float[sensors.GetSensorFloatObservationSize()];
}

// This is a bit of a hack - if we're in inference mode, observations won't be generated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied comment doesn't make sense here.

// This is a bit of a hack - if we're in inference mode, observations won't be generated
// But we need these to be generated for the recorder. So generate them here.
var observations = new List<Observation>();
GenerateSensorData(sensors, m_VectorSensorBuffer, m_WriteAdapter, observations);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - you said before that the problem was some of the agent sensors might not be availble for generation (e.g. camera already cleaned up). If that's the case, won't that still be a problem here? How's this different from passing the actual sensors to RequestDecision?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generate the data earlier. OnDisable is called first on all destroyed gameObjects and then On Destroy is called on all game objects.
We call GenerateSensorData in OnDisable rather than in the next fixed update.

Copy link
Contributor

@surfnerd surfnerd Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally confused about what this function is attempting to achieve.

@chriselion
Copy link
Contributor

Migration guide? Sounds OK otherwise.

Chris Elion and others added 2 commits January 15, 2020 15:24
@vincentpierre
Copy link
Contributor Author

Re-requesting review since a lot changed

Copy link
Contributor

@chriselion chriselion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think we can remove Agent.GenerateSensorData() now, but that can happen in another PR. Never mind, you did.

Maybe "Always reset Agent on Done" would be a user-friendlier PR title?

@vincentpierre vincentpierre changed the title Remove AgentOnDone feature Always reset when agent is done Jan 15, 2020
Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
@vincentpierre vincentpierre merged commit 91b87ec into master Jan 16, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-agentondone branch January 16, 2020 00:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants