Class DemonstrationRecorder
The Demonstration Recorder component facilitates the recording of demonstrations used for imitation learning.
Inherited Members
Namespace: Unity.MLAgents.Demonstrations
Assembly: Unity.ML-Agents.dll
Syntax
[RequireComponent(typeof(Agent))]
[AddComponentMenu("ML Agents/Demonstration Recorder", 0)]
public class DemonstrationRecorder : MonoBehaviour
Remarks
Add this component to the [GameObject] containing an Agent
to enable recording the agent for imitation learning. You must implement the
Heuristic(in Action
See [Imitation Learning - Recording Demonstrations] for more information.
[GameObject]: https://docs.unity3d.com/Manual/GameObjects.html
[Imitation Learning - Recording Demonstrations]: https://github.com/Unity-Technologies/ml-agents/blob/release_22_docs/docs//Learning-Environment-Design-Agents.md#recording-demonstrations
Fields
DemonstrationDirectory
Directory to save the demo files. Will default to a "Demonstrations/" folder in the Application data path if not specified.
Declaration
[FormerlySerializedAs("demonstrationDirectory")]
[Tooltip("Directory to save the demo files. Will default to {Application.dataPath}/Demonstrations if not specified.")]
public string DemonstrationDirectory
Field Value
Type | Description |
---|---|
string |
DemonstrationName
Base demonstration file name. If multiple files are saved, the additional filenames will have a sequence of unique numbers appended.
Declaration
[FormerlySerializedAs("demonstrationName")]
[Tooltip("Base demonstration file name. If multiple files are saved, the additional filenames will have a unique number appended.")]
public string DemonstrationName
Field Value
Type | Description |
---|---|
string |
NumStepsToRecord
Number of steps to record. The editor will stop playing when it reaches this threshold. Set to zero to record indefinitely.
Declaration
[Tooltip("Number of steps to record. The editor will stop playing when it reaches this threshold. Set to zero to record indefinitely.")]
public int NumStepsToRecord
Field Value
Type | Description |
---|---|
int |
Record
Whether or not to record demonstrations.
Declaration
[FormerlySerializedAs("record")]
[Tooltip("Whether or not to record demonstrations.")]
public bool Record
Field Value
Type | Description |
---|---|
bool |
Methods
AddDemonstrationWriterToAgent(DemonstrationWriter)
Add additional DemonstrationWriter to the Agent. It is still up to the user to Close this DemonstrationWriters when recording is done.
Declaration
public void AddDemonstrationWriterToAgent(DemonstrationWriter demoWriter)
Parameters
Type | Name | Description |
---|---|---|
Demonstration |
demoWriter |
|
Close()
Close the DemonstrationWriter and remove it from the Agent. Has no effect if the DemonstrationWriter is already closed (or wasn't opened)
Declaration
public void Close()
RemoveDemonstrationWriterFromAgent(DemonstrationWriter)
Remove additional DemonstrationWriter to the Agent. It is still up to the user to Close this DemonstrationWriters when recording is done.
Declaration
public void RemoveDemonstrationWriterFromAgent(DemonstrationWriter demoWriter)
Parameters
Type | Name | Description |
---|---|---|
Demonstration |
demoWriter |
|